/* ============================================
   Di Tích Đồng Nai - Main Stylesheet
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@400;500;600;700;800&display=swap');

/* ============================================
   CSS Variables (Light / Dark Theme)
   ============================================ */
:root {
    /* Colors - Warm Gold & Teal palette */
    --primary: #0d7377;
    --primary-light: #14a3a8;
    --primary-dark: #095456;
    --accent: #e8a838;
    --accent-light: #f0c060;
    --accent-dark: #c78c20;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f2f5;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888a0;
    --text-inverse: #ffffff;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f0f0f5;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(13, 115, 119, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0d7377 0%, #14a3a8 100%);
    --gradient-accent: linear-gradient(135deg, #e8a838 0%, #f0c060 100%);
    --gradient-hero: linear-gradient(135deg, rgba(13, 115, 119, 0.85) 0%, rgba(26, 26, 46, 0.9) 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);

    /* Layout */
    --header-height: 70px;
    --max-width: 1280px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: #1a1a2e;
    --bg-glass: rgba(26, 26, 46, 0.8);

    --text-primary: #e8e8f0;
    --text-secondary: #b0b0c8;
    --text-muted: #6a6a88;
    --text-inverse: #1a1a2e;

    --border-color: #2a2a4a;
    --border-light: #222240;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(20, 163, 168, 0.2);

    --gradient-card: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: all var(--transition-normal);
}

.site-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
}

.logo img {
    height: 42px;
    width: auto;
    border-radius: var(--radius-sm);
}

.logo span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
    background: rgba(13, 115, 119, 0.08);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.header-actions button:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Search bar */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.search-overlay.active {
    display: flex;
}

.search-box {
    width: 90%;
    max-width: 640px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    animation: slideDown 0.3s ease;
}

.search-box input {
    width: 100%;
    padding: 16px 24px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Mobile menu */
.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100vh - var(--header-height));
        height: calc(100dvh - var(--header-height));
        background: var(--bg-primary);
        flex-direction: column;
        padding: 20px;
        gap: 4px;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        overflow-y: auto;
    }

    .main-nav.open {
        transform: translateX(0);
    }

    .main-nav a {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 20px;
    animation: fadeInUp 1s ease 0.3s both;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 40px;
    line-height: 1.8;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    background: var(--gradient-accent);
    color: #1a1a2e;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 50px;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(232, 168, 56, 0.4);
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(232, 168, 56, 0.5);
    color: #1a1a2e;
}

/* Scroll indicator */
.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: bounce 2s infinite;
}

.hero-scroll i {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   Section Styles
   ============================================ */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header .badge {
    display: inline-block;
    padding: 6px 18px;
    background: rgba(13, 115, 119, 0.1);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 50px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Category Cards (Home Page)
   ============================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.category-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 3/4;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.category-card:hover img {
    transform: scale(1.08);
}

.category-card .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
}

.category-card .overlay i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.category-card .overlay h3 {
    color: #fff;
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.category-card .overlay p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ============================================
   Content Cards (List Pages)
   ============================================ */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.content-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.content-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.content-card .card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.content-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.content-card:hover .card-image img {
    transform: scale(1.06);
}

.content-card .card-image .views-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.content-card .card-body {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-card .card-subtitle {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.content-card .card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-card .card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.content-card .card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.content-card .card-badges span {
    padding: 4px 10px;
    background: rgba(13, 115, 119, 0.08);
    color: var(--primary);
    font-size: 0.72rem;
    border-radius: 50px;
    font-weight: 500;
}

.content-card .card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: gap var(--transition-fast);
}

.content-card .card-link:hover {
    gap: 12px;
}

/* ============================================
   Filter Bar & Sort (List Pages)
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.filter-bar .filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.filter-bar .filter-btn:hover,
.filter-bar .filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.sort-select {
    margin-left: auto;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

/* ============================================
   Detail Page
   ============================================ */
.detail-page {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 80px;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

.detail-main .detail-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-main .detail-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-main .detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-main .detail-content {
    line-height: 1.9;
    color: var(--text-secondary);
}

.detail-main .detail-content h2,
.detail-main .detail-content h3 {
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    margin-top: 30px;
    margin-bottom: 14px;
}

.detail-main .detail-content h2 {
    font-size: 1.6rem;
}

.detail-main .detail-content h3 {
    font-size: 1.3rem;
}

.detail-main .detail-content p {
    margin-bottom: 16px;
}

.detail-main .detail-content img {
    border-radius: var(--radius-md);
    margin: 20px 0;
}

/* Sidebar */
.detail-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.sidebar-card h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.sidebar-card .badges-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sidebar-card .badges-list span {
    padding: 6px 14px;
    background: rgba(13, 115, 119, 0.08);
    color: var(--primary);
    font-size: 0.8rem;
    border-radius: 50px;
    font-weight: 500;
}

/* Video embed */
.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-sidebar {
        position: static;
    }
}

/* ============================================
   Quiz Section (Embedded in Detail Page)
   ============================================ */
.quiz-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
}

.quiz-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-section h3 i {
    color: var(--accent);
}

.quiz-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    transition: border-color var(--transition-fast);
}

.quiz-card .quiz-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.quiz-card .quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-card);
}

.quiz-option:hover {
    border-color: var(--primary-light);
    background: rgba(13, 115, 119, 0.04);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: rgba(13, 115, 119, 0.08);
}

.quiz-option.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.quiz-option.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.quiz-option .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.quiz-option.selected .option-letter {
    background: var(--primary);
    color: #fff;
}

.quiz-option.correct .option-letter {
    background: #22c55e;
    color: #fff;
}

.quiz-option.wrong .option-letter {
    background: #ef4444;
    color: #fff;
}

.quiz-result {
    margin-top: 30px;
    padding: 24px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    color: #fff;
    text-align: center;
    display: none;
}

.quiz-result.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.quiz-result .score {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Playfair Display', serif;
}

.quiz-result .score-text {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 8px;
}

.quiz-submit-btn {
    margin-top: 24px;
    padding: 14px 36px;
    background: var(--gradient-accent);
    color: #1a1a2e;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.quiz-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(232, 168, 56, 0.4);
}

/* ============================================
   Book Library
   ============================================ */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}

.book-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.book-card .book-cover {
    aspect-ratio: 3/4;
    overflow: hidden;
}

.book-card .book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-card .book-info {
    padding: 18px;
}

.book-card .book-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card .book-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Book modal */
.book-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.book-modal.active {
    display: flex;
}

.book-modal-content {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease;
}

.book-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.book-modal-header h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
}

.book-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.book-modal-close:hover {
    background: #ef4444;
    color: #fff;
}

.book-modal-body {
    flex: 1;
}

.book-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   Chatbot
   ============================================ */
.chat-page {
    padding-top: var(--header-height);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeInUp 0.3s ease;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.chat-message.bot .avatar {
    background: var(--gradient-primary);
    color: #fff;
}

.chat-message.user .avatar {
    background: var(--gradient-accent);
    color: #1a1a2e;
}

.chat-message .bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    line-height: 1.7;
    font-size: 0.95rem;
}

.chat-message.bot .bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message.user .bubble {
    background: var(--gradient-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Chat input area */
.chat-input-area {
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
}

.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    max-height: 100px;
    line-height: 1.5;
}

.chat-input-wrapper button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-input-wrapper .btn-send {
    background: var(--gradient-primary);
    color: #fff;
}

.chat-input-wrapper .btn-send:hover {
    transform: scale(1.08);
}

.chat-input-wrapper .btn-mic,
.chat-input-wrapper .btn-image {
    background: transparent;
    color: var(--text-muted);
}

.chat-input-wrapper .btn-mic:hover,
.chat-input-wrapper .btn-image:hover {
    color: var(--primary);
    background: rgba(13, 115, 119, 0.08);
}

.chat-input-wrapper .btn-mic.recording {
    color: #ef4444;
    animation: pulse 1s infinite;
}

/* Image preview */
.chat-image-preview {
    display: none;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    position: relative;
}

.chat-image-preview.active {
    display: block;
}

.chat-image-preview img {
    max-height: 120px;
    border-radius: var(--radius-sm);
}

.chat-image-preview .remove-img {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.footer-col p,
.footer-col a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.footer-col a {
    display: block;
    transition: color var(--transition-fast);
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-col .contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.footer-col .contact-item i {
    color: var(--primary);
    width: 18px;
}

.footer-social {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.footer-social a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   Google Translate Widget
   ============================================ */
.goog-te-banner-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

.goog-te-gadget {
    font-size: 0 !important;
}

.goog-te-gadget .goog-te-combo {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
}

/* ============================================
   Page Banner (List Pages)
   ============================================ */
.page-banner {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    margin-top: var(--header-height);
}

.page-banner .banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.page-banner .banner-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
}

.page-banner .banner-content {
    position: relative;
    z-index: 2;
}

.page-banner h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    color: #fff;
    font-weight: 800;
    margin-bottom: 14px;
}

.page-banner p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================
   Utilities
   ============================================ */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   PREMIUM UI ENHANCEMENTS
   ============================================ */

/* Animated gradient border on hero */
.hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light), var(--accent-light), var(--primary));
    background-size: 300% 100%;
    animation: gradientSlide 4s linear infinite;
    z-index: 3;
}

@keyframes gradientSlide {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 300% 50%;
    }
}

/* Floating particles effect on hero */
.hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.3) 0%, transparent 100%),
        radial-gradient(2px 2px at 50% 60%, rgba(255, 255, 255, 0.2) 0%, transparent 100%),
        radial-gradient(2px 2px at 80% 20%, rgba(255, 255, 255, 0.25) 0%, transparent 100%),
        radial-gradient(3px 3px at 10% 80%, rgba(232, 168, 56, 0.2) 0%, transparent 100%),
        radial-gradient(2px 2px at 70% 70%, rgba(255, 255, 255, 0.15) 0%, transparent 100%),
        radial-gradient(3px 3px at 40% 10%, rgba(20, 163, 168, 0.2) 0%, transparent 100%),
        radial-gradient(2px 2px at 90% 50%, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    animation: floatParticles 20s linear infinite;
    z-index: 1;
}

@keyframes floatParticles {
    0% {
        transform: translateY(0) translateX(0);
    }

    25% {
        transform: translateY(-20px) translateX(10px);
    }

    50% {
        transform: translateY(-10px) translateX(-10px);
    }

    75% {
        transform: translateY(-30px) translateX(5px);
    }

    100% {
        transform: translateY(0) translateX(0);
    }
}

/* Hero title shimmer effect */
.hero h1 {
    position: relative;
    background: linear-gradient(90deg, #fff 0%, #fff 40%, var(--accent-light) 50%, #fff 60%, #fff 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

    0%,
    100% {
        background-position: -200% 50%;
    }

    50% {
        background-position: 200% 50%;
    }
}

/* Category card premium hover */
.category-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--primary-light));
    border-radius: calc(var(--radius-lg) + 2px);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: -1;
}

.category-card:hover::before {
    opacity: 1;
}

.category-card .overlay i {
    transition: transform var(--transition-normal);
}

.category-card:hover .overlay i {
    transform: scale(1.3) rotate(-5deg);
}

/* Content card gradient glow on hover */
.content-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: -1;
}

.content-card {
    position: relative;
}

.content-card:hover::before {
    opacity: 1;
}

/* Section header decorative line */
.section-header h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--gradient-accent);
    margin: 16px auto 0;
    border-radius: 2px;
}

/* Page banner parallax */
.page-banner .banner-bg {
    transition: transform 0.1s ease-out;
}

.page-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(0deg, var(--bg-primary) 0%, transparent 100%);
    z-index: 2;
}

/* Quiz card enhanced hover */
.quiz-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 20px rgba(13, 115, 119, 0.1);
}

/* Sidebar card hover glow */
.sidebar-card {
    transition: all var(--transition-normal);
}

.sidebar-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

/* Book card shimmer */
.book-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.book-card {
    position: relative;
    overflow: hidden;
}

.book-card:hover::after {
    left: 100%;
}

/* Filter button enhanced */
.filter-bar .filter-btn {
    position: relative;
    overflow: hidden;
}

.filter-bar .filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(13, 115, 119, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.filter-bar .filter-btn:hover::before {
    width: 200px;
    height: 200px;
}

/* Stats counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Decorative corner flourish for detail pages */
.detail-main .detail-title::before {
    content: '❖';
    display: inline-block;
    margin-right: 12px;
    color: var(--accent);
    font-size: 0.7em;
}

/* Chat bubble enhanced */
.chat-message.bot .bubble {
    position: relative;
}

.chat-message.bot .bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Footer wave effect */
.site-footer {
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 30'%3E%3Cpath fill='%23f8f9fa' d='M0,15 C360,30 720,0 1080,15 C1260,22 1350,8 1440,15 L1440,30 L0,30 Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: cover;
}

[data-theme="dark"] .site-footer::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 30'%3E%3Cpath fill='%231a1a2e' d='M0,15 C360,30 720,0 1080,15 C1260,22 1350,8 1440,15 L1440,30 L0,30 Z'/%3E%3C/svg%3E");
}

/* Enhanced swiper pagination */
.swiper-pagination-bullet {
    width: 12px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.4;
    transition: all var(--transition-fast);
}

.swiper-pagination-bullet-active {
    width: 30px;
    background: var(--primary);
    opacity: 1;
}

/* Button ripple effect */
.btn-primary,
.hero-cta,
.quiz-submit-btn {
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.hero-cta::after,
.quiz-submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after,
.hero-cta:active::after,
.quiz-submit-btn:active::after {
    width: 400px;
    height: 400px;
}

/* Responsive enhancements */
@media (max-width: 640px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .category-card {
        aspect-ratio: 1/1;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .section {
        padding: 60px 0;
    }

    .page-banner {
        height: 300px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}