/* ============================================
   Vaidik Eduservices - Global Styles
   ============================================ */

:root {
    /* Brand Colors - Light */
    --brand-navy: #0D2B6B;
    --brand-navy-mid: #1B3A8A;
    --brand-navy-light: #2952C4;
    --brand-orange: #F97316;
    --brand-orange-hover: #EA580C;
    --brand-orange-light: rgba(249, 115, 22, 0.10);
    --brand-gold: #FCD34D;

    --bg-primary: #F7F9FC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #EEF2F8;
    --bg-card: #FFFFFF;
    --bg-overlay: rgba(7, 20, 55, 0.65);
    --bg-glass: rgba(255, 255, 255, 0.85);

    --text-primary: #0D1A3A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;

    --border-color: #DDE4EF;
    --border-light: #EEF2F8;

    --accent-primary: var(--brand-navy-mid);
    --accent-hover: var(--brand-navy);
    --accent-light: rgba(27, 58, 138, 0.08);

    --shadow-sm: 0 1px 2px rgba(13, 43, 107, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(13, 43, 107, 0.08), 0 2px 4px -2px rgba(13, 43, 107, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(13, 43, 107, 0.10), 0 4px 6px -4px rgba(13, 43, 107, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(13, 43, 107, 0.10), 0 8px 10px -6px rgba(13, 43, 107, 0.05);
    --shadow-card-hover: 0 20px 40px -8px rgba(13, 43, 107, 0.18);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --header-height: 72px;
    --content-max-width: 1280px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #080F24;
    --bg-secondary: #0F1E45;
    --bg-tertiary: #162454;
    --bg-card: #0F1E45;
    --bg-overlay: rgba(0, 0, 0, 0.75);
    --bg-glass: rgba(15, 30, 69, 0.90);

    --text-primary: #E8EEF8;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --text-inverse: #0D1A3A;

    --border-color: #1E2E5C;
    --border-light: #0F1E45;

    --accent-light: rgba(41, 82, 196, 0.20);
    --brand-orange-light: rgba(249, 115, 22, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.50);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.55);
    --shadow-card-hover: 0 20px 40px -8px rgba(0, 0, 0, 0.60);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition-normal), color var(--transition-normal);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: var(--brand-navy-light); border-radius: 4px; opacity: 0.5; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-navy-mid); }

/* ============================================
   Welcome Popup
   ============================================ */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 20, 55, 0.70);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: overlayFadeIn 0.3s ease;
}

.welcome-overlay.hidden {
    display: none;
}

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

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

.welcome-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 48px 40px 36px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 32px 64px rgba(7, 20, 55, 0.35);
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.welcome-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--brand-navy), var(--brand-orange));
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(32px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-navy-mid);
    margin-bottom: 14px;
    margin-top: 8px;
    line-height: 1.3;
}

[data-theme="dark"] .welcome-title {
    color: var(--text-primary);
}

.welcome-msg {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.welcome-msg strong {
    color: var(--brand-orange);
    font-weight: 600;
}

.welcome-sub {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 28px;
}

.welcome-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 32px;
    background: linear-gradient(135deg, var(--brand-navy-mid), var(--brand-navy-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 16px rgba(27, 58, 138, 0.35);
    width: 100%;
    justify-content: center;
    margin-bottom: 14px;
}

.welcome-btn:hover {
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-mid));
    box-shadow: 0 6px 20px rgba(27, 58, 138, 0.45);
    transform: translateY(-1px);
}

.welcome-btn svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

.welcome-btn:hover svg {
    transform: translateX(3px);
}

/* (welcome-note removed) */

/* ============================================
   Header / Top Bar
   ============================================ */
.top-bar {
    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-color);
    z-index: 100;
    transition: background var(--transition-normal);
}

.top-bar-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-navy-mid);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

[data-theme="dark"] .logo-text h1 {
    color: var(--text-primary);
}

.logo-text .tagline {
    font-size: 0.67rem;
    color: var(--brand-orange);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    overflow: hidden;
}

.breadcrumb-link {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--transition-fast);
    cursor: pointer;
}

.breadcrumb-link:hover { color: var(--brand-orange); }

.breadcrumb-link.active {
    color: var(--brand-navy-mid);
    font-weight: 600;
}

[data-theme="dark"] .breadcrumb-link.active { color: var(--text-primary); }

.breadcrumb-separator {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    user-select: none;
}

/* Theme Toggle */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--brand-orange-light);
    color: var(--brand-orange);
    border-color: var(--brand-orange);
}

.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    padding-top: var(--header-height);
    min-height: calc(100vh - 60px);
}

.view {
    display: none;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 32px 24px;
    animation: fadeSlideIn 0.4s ease;
}

.view.active { display: block; }

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

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-mid) 55%, var(--brand-navy-light) 100%);
    border-radius: var(--radius-xl);
    padding: 48px;
    margin-bottom: 40px;
    overflow: hidden;
    color: white;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.hero-title .highlight {
    background: linear-gradient(120deg, var(--brand-gold), var(--brand-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    opacity: 0.88;
    max-width: 520px;
    line-height: 1.65;
    font-weight: 400;
}

.hero-decoration {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 50%;
    overflow: hidden;
    z-index: 1;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.12;
}

.shape-1 {
    width: 220px; height: 220px;
    background: white;
    top: -50px; right: -30px;
    animation: float 6s ease-in-out infinite;
}

.shape-2 {
    width: 130px; height: 130px;
    background: var(--brand-gold);
    bottom: -30px; right: 110px;
    animation: float 8s ease-in-out infinite reverse;
    opacity: 0.18;
}

.shape-3 {
    width: 80px; height: 80px;
    background: var(--brand-orange);
    top: 50%; right: 38%;
    animation: float 5s ease-in-out infinite 1s;
    opacity: 0.20;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* ============================================
   Subject Cards Grid — 3 + 2 centered layout
   ============================================ */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
}

/* Row 1: 3 cards, each spans 2 of 6 cols */
.subject-card:nth-child(1),
.subject-card:nth-child(2),
.subject-card:nth-child(3) {
    grid-column: span 2;
}

/* Row 2: 2 cards centred — columns 2-3 and 4-5 of 6 */
.subject-card:nth-child(4) {
    grid-column: 2 / span 2;
}

.subject-card:nth-child(5) {
    grid-column: 4 / span 2;
}

.subject-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 24px 24px;
    cursor: pointer;
    transition: all var(--transition-slow);
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-color-1), var(--card-color-2));
    transition: height var(--transition-slow);
}

.subject-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
    border-color: transparent;
}

.subject-card:hover::before {
    height: 6px;
}

.subject-card-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 7px;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.subject-card-desc {
    font-size: 0.855rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.55;
}

.subject-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.stat-badge-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.stat-badge-icon svg {
    width: 13px;
    height: 13px;
}

/* ============================================
   Subject Detail / Sections Grid
   ============================================ */
.subject-header { margin-bottom: 32px; }

.subject-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 32px;
    border-radius: var(--radius-xl);
    color: white;
    position: relative;
    overflow: hidden;
}

.subject-header-info h2 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.subject-header-info p {
    opacity: 0.88;
    font-size: 0.95rem;
    font-weight: 400;
}

/* Sections container — flex column of section blocks */
.sections-grid {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

/* ============================================
   Section Block + Divider
   ============================================ */
.section-block {
    opacity: 0;
    animation: staggerIn 0.4s ease forwards;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.section-divider-icon { flex-shrink: 0; display: flex; align-items: center; color: var(--text-secondary); }
.section-divider-icon svg { width: 16px; height: 16px; }

.section-divider-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.9px;
    white-space: nowrap;
}

.section-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.section-divider-count {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 9px;
    border-radius: 20px;
}

/* ============================================
   Content Row List
   ============================================ */
.content-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.content-row {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px 14px 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.content-row:hover {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.row-thumb {
    width: 96px;
    height: 68px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.content-row.type-video .row-thumb { background: linear-gradient(145deg, #0d1117, #1a1f36); }
.content-row.type-html .row-thumb  { background: linear-gradient(145deg, var(--brand-navy), var(--brand-navy-light)); }
.content-row.type-pdf .row-thumb   { background: linear-gradient(145deg, #92400e, #f97316); }
.content-row.type-lesson .row-thumb { background: linear-gradient(145deg, #065f46, #059669); }

.row-thumb-play {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex; align-items: center; justify-content: center;
    color: white;
    transition: background var(--transition-fast);
}

.content-row:hover .row-thumb-play {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
}

.row-thumb-play svg { width: 14px; height: 14px; margin-left: 2px; }

.row-thumb-icon { color: white; display: flex; align-items: center; justify-content: center; }
.row-thumb-icon svg { width: 26px; height: 26px; }

.row-thumb-lesson {
    color: white;
    display: flex; align-items: center; justify-content: center;
}
.row-thumb-lesson svg { width: 20px; height: 20px; margin-left: 1px; }

.row-body { flex: 1; min-width: 0; }

.row-type-badge {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--brand-navy-mid);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 2px;
}

[data-theme="dark"] .row-type-badge { color: var(--brand-orange); }

.row-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 2px;
}

.row-desc {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.row-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.row-tag-icon { display: flex; align-items: center; }
.row-tag-icon svg { width: 11px; height: 11px; }

.row-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--brand-navy-mid);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background var(--transition-fast);
    pointer-events: none;
}

.content-row:hover .row-action { background: var(--brand-orange); }
.row-action svg { width: 12px; height: 12px; }

/* ============================================
   Content List
   ============================================ */
.section-header { margin-bottom: 28px; }

.section-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-header-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    background: var(--brand-orange-light);
    flex-shrink: 0;
}

.section-header-info h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.section-header-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.content-list { display: grid; gap: 14px; }

.content-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.content-item:hover {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.content-item-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.content-item-icon svg { width: 22px; height: 22px; }

.content-item-icon.type-video {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
}
.content-item-icon.type-html {
    background: linear-gradient(135deg, #1B3A8A, #2952C4);
    color: white;
}
.content-item-icon.type-pdf {
    background: linear-gradient(135deg, #F97316, #EA580C);
    color: white;
}
.content-item-icon.type-lesson {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.content-item-info { flex: 1; min-width: 0; }

.content-item-title {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.content-item-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.meta-tag-icon { display: flex; align-items: center; }
.meta-tag-icon svg { width: 12px; height: 12px; }

.content-item-play {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--brand-navy-mid);
    color: white;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.content-item:hover .content-item-play {
    background: var(--brand-orange);
    transform: scale(1.1);
}

.content-item-play svg { width: 15px; height: 15px; }

/* ============================================
   Content Viewer Overlay
   ============================================ */
.viewer-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 200;
    display: none;
    flex-direction: column;
    animation: viewerOpen 0.3s ease;
}

.viewer-overlay.active { display: flex; }

@keyframes viewerOpen {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--brand-navy-mid);
    min-height: 56px;
    flex-shrink: 0;
}

.viewer-title {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.viewer-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
}

.viewer-btn:hover {
    background: var(--accent-light);
    color: var(--brand-navy-mid);
    border-color: var(--brand-navy-mid);
}

.viewer-btn.viewer-close:hover {
    background: #FEE2E2;
    color: #EF4444;
    border-color: #EF4444;
}

[data-theme="dark"] .viewer-btn.viewer-close:hover {
    background: rgba(239, 68, 68, 0.2);
}

.viewer-btn svg { width: 18px; height: 18px; }

.viewer-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

/* Video Player */
.video-player-container {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #000;
}
.video-player-container video { max-width: 100%; max-height: 100%; width: 100%; }

/* HTML Viewer */
.html-viewer-frame { width: 100%; height: 100%; border: none; background: white; }

/* PDF Viewer */
.pdf-viewer-container { width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg-secondary, #f1f5f9); }

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: var(--brand-navy);
    color: white;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
    border-bottom: 2px solid var(--brand-orange);
}

.pdf-toolbar-left,
.pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdf-toolbar-center { flex: 1; min-width: 0; text-align: center; }

.pdf-title {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-page-info {
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.pdf-zoom-info {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 42px;
    text-align: center;
    opacity: 0.8;
}

.pdf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.pdf-btn:hover { background: var(--brand-orange); }
.pdf-btn svg { width: 18px; height: 18px; }

.pdf-canvas-wrap {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #e2e8f0;
}

.pdf-canvas-wrap canvas {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    background: white;
}

.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    width: 100%;
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
    font-weight: 500;
}

.pdf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #cbd5e1;
    border-top-color: var(--brand-navy);
    border-radius: 50%;
    animation: pdfSpin 0.8s linear infinite;
}

@keyframes pdfSpin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .pdf-toolbar { padding: 6px 10px; gap: 6px; }
    .pdf-toolbar-center { display: none; }
    .pdf-btn { width: 30px; height: 30px; }
    .pdf-btn svg { width: 15px; height: 15px; }
    .pdf-canvas-wrap { padding: 10px; }
}

/* Lesson Viewer */
.lesson-viewer { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.lesson-video-section {
    flex: 1; background: #000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    min-height: 0;
}
.lesson-video-section video { max-width: 100%; max-height: 100%; width: 100%; object-fit: contain; }
.lesson-quiz-section { flex: 1; overflow: hidden; }
.lesson-quiz-section iframe { width: 100%; height: 100%; border: none; }

/* Viewer Footer */
.viewer-footer {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    gap: 12px;
    flex-shrink: 0;
}

.viewer-footer.active { display: flex; }

.lesson-step-indicator {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.lesson-step {
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
    transition: all var(--transition-fast);
}

.lesson-step.active { background: var(--brand-navy-mid); color: white; }
.lesson-step.inactive { background: var(--bg-tertiary); color: var(--text-tertiary); }

.lesson-nav-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.lesson-nav-btn.primary { background: var(--brand-navy-mid); color: white; }
.lesson-nav-btn.primary:hover { background: var(--brand-navy); }
.lesson-nav-btn.secondary { background: var(--bg-tertiary); color: var(--text-secondary); }
.lesson-nav-btn.secondary:hover { background: var(--border-color); }
.lesson-nav-btn svg { width: 15px; height: 15px; }

/* Placeholder */
.viewer-placeholder {
    text-align: center;
    padding: 48px;
    color: var(--text-tertiary);
}
.viewer-placeholder-icon { margin-bottom: 16px; opacity: 0.5; color: var(--text-secondary); }
.viewer-placeholder-icon svg { width: 64px; height: 64px; }
.viewer-placeholder h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }
.viewer-placeholder p { font-size: 0.88rem; max-width: 400px; margin: 0 auto; }

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed; inset: 0;
    background: var(--bg-overlay);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}
.loading-overlay.active { display: flex; }

.loader {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; color: white; font-size: 0.88rem; font-weight: 500;
}

.loader-ring {
    width: 48px; height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Footer
   ============================================ */
.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Empty / Back
   ============================================ */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-tertiary); }
.empty-state-icon { margin-bottom: 16px; opacity: 0.4; color: var(--text-secondary); }
.empty-state-icon svg { width: 48px; height: 48px; }
.empty-state h3 { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.83rem; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
    border: none;
    background: none;
    transition: color var(--transition-fast);
}

.back-btn:hover { color: var(--brand-orange); }
.back-btn svg { width: 15px; height: 15px; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    /* On tablets, switch to 2-col then 1-col */
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .subject-card:nth-child(1),
    .subject-card:nth-child(2),
    .subject-card:nth-child(3),
    .subject-card:nth-child(4),
    .subject-card:nth-child(5) {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .top-bar-inner { padding: 0 16px; gap: 12px; }
    .logo-text h1 { font-size: 1rem; }
    .logo-text .tagline { display: none; }
    .breadcrumb { display: none; }
    .hero-section { padding: 32px 24px; }
    .hero-title { font-size: 1.7rem; }
    .hero-subtitle { font-size: 0.92rem; }
    .hero-decoration { display: none; }
    .view { padding: 20px 16px; }
    .subjects-grid { grid-template-columns: 1fr; gap: 14px; }
    .sections-grid { grid-template-columns: 1fr; }
    .subject-header-inner { padding: 24px; flex-direction: column; text-align: center; }
    .subject-header-info h2 { font-size: 1.5rem; }
    .content-item { padding: 14px 16px; }
    .content-item-desc { display: none; }
    .viewer-header { padding: 10px 16px; }
    .viewer-footer { padding: 10px 16px; flex-wrap: wrap; }
    .welcome-modal { padding: 36px 24px 28px; }
    .welcome-title { font-size: 1.25rem; }
    .content-rows { gap: 6px; }
    .row-meta { display: none; }
    .sections-grid { gap: 24px; }
}

@media (max-width: 480px) {
    :root { --header-height: 60px; }

    .hero-section { padding: 24px 20px; margin-bottom: 24px; }
    .hero-title { font-size: 1.35rem; }
    .subject-card { padding: 20px 18px; }
    .row-action { padding: 6px 10px; font-size: 0.7rem; }
}

/* ============================================
   Stagger Animation
   ============================================ */
.subject-card,
.section-card,
.content-item {
    opacity: 0;
    transform: translateY(18px);
    animation: staggerIn 0.4s ease forwards;
}

@keyframes staggerIn {
    to { opacity: 1; transform: translateY(0); }
}
