:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #00d4ff;
    --text-color: #e8e8e8;
    --text-muted: #a8a8a8;
    --card-bg: #1e1e30;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* Hero Section */
.hero {
    position: relative;
    text-align: center;
    padding: 120px 20px 80px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow: hidden;
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 60px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 90px 10px, white, transparent),
        radial-gradient(1px 1px at 150px 120px, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 40px 150px, rgba(255, 255, 255, 0.6), transparent);
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.3;
    animation: twinkle 4s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    25% { opacity: 0.5; }
    50% { opacity: 0.4; }
    75% { opacity: 0.6; }
}

.title {
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #00d4ff, #667eea, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    animation: titleGlow 3s infinite alternate;
}

@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.3)); }
    100% { filter: drop-shadow(0 0 40px rgba(0, 212, 255, 0.6)); }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--highlight-color);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    position: relative;
    z-index: 1;
}

/* Introduction Section */
.intro {
    padding: 60px 40px;
    background-color: var(--secondary-color);
    text-align: center;
}

.intro-text {
    max-width: 900px;
    margin: 0 auto 20px;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-color);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 60px 40px;
    background-color: var(--primary-color);
}

.book-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--highlight-color);
    box-shadow: 0 15px 50px rgba(0, 212, 255, 0.4);
}

.book-card:hover::before {
    opacity: 1;
}

/* Book Covers */
.book-cover {
    position: relative;
    height: 200px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    overflow: hidden;
    transition: transform 0.4s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-cover::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 8s infinite linear;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.book-cover-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.book-cover-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.book-cover-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.book-cover-4 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.book-cover-5 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.book-cover-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
}

.book-cover-number {
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    text-align: right;
    position: relative;
    z-index: 1;
}

.book-number {
    font-size: 0.9rem;
    color: var(--highlight-color);
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.book-card h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: var(--text-color);
    letter-spacing: 3px;
}

.book-description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.7;
    min-height: 120px;
}

.book-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.theme-tag {
    background-color: rgba(0, 212, 255, 0.2);
    color: var(--highlight-color);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.theme-tag:hover {
    background-color: rgba(0, 212, 255, 0.3);
    transform: scale(1.05);
}

.read-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.read-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Resources Section */
.resources-section {
    padding: 60px 40px;
    background-color: var(--secondary-color);
}

.resources-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--highlight-color);
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.resource-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-8px);
    border-color: var(--highlight-color);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.resource-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    text-align: center;
}

.resource-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-color);
    text-align: center;
}

.resource-card p {
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
}

/* About Section */
.about {
    padding: 60px 40px;
    background-color: var(--primary-color);
}

.about h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--highlight-color);
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.about-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.about-section ul {
    list-style: none;
    padding-left: 0;
}

.about-section li {
    padding: 10px 0;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.about-section li:last-child {
    border-bottom: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--secondary-color);
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

footer p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.footer-quote {
    font-style: italic;
    color: var(--highlight-color);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 20px auto 0;
}

/* Reader View */
.reader-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    z-index: 1000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reader-header {
    background-color: var(--secondary-color);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-color);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 15px;
}

.reader-title {
    font-size: 1.5rem;
    color: var(--highlight-color);
    flex: 1;
    min-width: 200px;
}

.reader-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: 5px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    padding: 5px;
}

.control-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background-color: var(--highlight-color);
    color: var(--primary-color);
}

.control-btn.active {
    background-color: var(--highlight-color);
    color: var(--primary-color);
    border-color: var(--highlight-color);
}

.toc-button, .search-button, .close-reader {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--highlight-color);
    color: var(--highlight-color);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.toc-button:hover, .search-button:hover, .close-reader:hover {
    background-color: var(--highlight-color);
    color: var(--primary-color);
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: rgba(0, 212, 255, 0.2);
    z-index: 1001;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #667eea);
    width: 0%;
    transition: width 0.1s ease;
}

/* Chapter Sidebar */
.chapter-sidebar {
    position: fixed;
    left: -300px;
    top: 70px;
    width: 280px;
    height: calc(100% - 140px);
    background-color: var(--secondary-color);
    border-right: 2px solid var(--accent-color);
    overflow-y: auto;
    z-index: 99;
    transition: left 0.3s ease;
    padding: 20px;
}

.chapter-sidebar.open {
    left: 0;
}

.chapter-sidebar h3 {
    color: var(--highlight-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.chapter-list {
    list-style: none;
}

.chapter-item {
    padding: 10px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 5px;
    color: var(--text-color);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.chapter-item:hover {
    background-color: rgba(0, 212, 255, 0.1);
    border-left-color: var(--highlight-color);
}

.chapter-item.active {
    background-color: rgba(0, 212, 255, 0.2);
    border-left-color: var(--highlight-color);
    font-weight: 600;
}

.chapter-item.h3 {
    padding-left: 20px;
    font-size: 0.9rem;
}

.sidebar-toggle {
    position: fixed;
    left: 10px;
    top: 80px;
    z-index: 98;
    background-color: var(--secondary-color);
    border: 1px solid var(--accent-color);
    color: var(--highlight-color);
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: var(--highlight-color);
    color: var(--primary-color);
}

/* Reader Content */
.reader-content-wrapper {
    display: flex;
    transition: margin-left 0.3s ease;
}

.reader-content {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 150px;
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.reader-content.width-narrow {
    max-width: 700px;
    font-size: 1.05rem;
}

.reader-content.width-wide {
    max-width: 1200px;
    font-size: 1.15rem;
}

.reader-content.font-small {
    font-size: 0.95rem;
    line-height: 1.7;
}

.reader-content.font-large {
    font-size: 1.25rem;
    line-height: 2.0;
}

.reader-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--highlight-color);
    text-align: center;
    scroll-margin-top: 80px;
}

.reader-content h2 {
    font-size: 2rem;
    margin: 40px 0 20px;
    color: var(--highlight-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    scroll-margin-top: 80px;
}

.reader-content h3 {
    font-size: 1.5rem;
    margin: 30px 0 15px;
    color: var(--text-color);
    scroll-margin-top: 80px;
}

.reader-content p {
    margin-bottom: 20px;
    text-align: justify;
}

/* Search Highlight */
.search-highlight {
    background-color: rgba(255, 255, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Reader Navigation */
.reader-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--secondary-color);
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    border-top: 2px solid var(--accent-color);
    z-index: 100;
}

.nav-button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--secondary-color);
    border-radius: 15px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 30px;
    background-color: var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--highlight-color);
}

.modal-header h2 {
    color: var(--highlight-color);
    font-size: 1.8rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--highlight-color);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: rgba(0, 212, 255, 0.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* TOC Modal */
.toc-book {
    margin-bottom: 30px;
}

.toc-book-title {
    font-size: 1.5rem;
    color: var(--highlight-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

.toc-chapters {
    list-style: none;
}

.toc-chapter {
    padding: 10px 15px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 5px;
    color: var(--text-color);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.toc-chapter:hover {
    background-color: rgba(0, 212, 255, 0.1);
    border-left-color: var(--highlight-color);
}

/* Search Modal */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    background-color: var(--card-bg);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--highlight-color);
}

.search-box button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-box button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.search-results {
    max-height: 500px;
    overflow-y: auto;
}

.search-result {
    padding: 15px;
    margin-bottom: 15px;
    background-color: var(--card-bg);
    border-radius: 8px;
    border-left: 3px solid var(--highlight-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result:hover {
    background-color: rgba(0, 212, 255, 0.1);
}

.search-result-book {
    font-size: 0.9rem;
    color: var(--highlight-color);
    margin-bottom: 5px;
}

.search-result-text {
    color: var(--text-muted);
    line-height: 1.6;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 1.1rem;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--highlight-color);
    font-size: 1.2rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 46, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

.spinner {
    border: 4px solid rgba(0, 212, 255, 0.1);
    border-top: 4px solid var(--highlight-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
        padding: 40px 20px;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .intro {
        padding: 40px 20px;
    }

    .intro-text {
        font-size: 1rem;
    }

    .about {
        padding: 40px 20px;
    }

    .resources-section {
        padding: 40px 20px;
    }

    .reader-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .reader-title {
        font-size: 1.2rem;
    }

    .reader-controls {
        width: 100%;
        justify-content: space-between;
    }

    .control-group {
        flex: 1;
        justify-content: center;
    }

    .reader-content {
        padding: 30px 15px 150px;
        font-size: 1rem;
    }

    .reader-nav {
        flex-direction: column;
        padding: 15px;
    }

    .nav-button {
        width: 100%;
    }

    .chapter-sidebar {
        width: 250px;
        left: -250px;
    }

    .sidebar-toggle {
        left: 5px;
        padding: 8px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .book-cover {
        height: 150px;
    }

    .book-cover-title {
        font-size: 1.4rem;
    }

    .book-cover-number {
        font-size: 3rem;
    }
}

/* Touch Gesture Support */
@media (hover: none) and (pointer: coarse) {
    .book-card:active {
        transform: translateY(-5px) scale(1.01);
    }

    .resource-card:active {
        transform: translateY(-5px);
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--primary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--highlight-color);
}
