/**
 * ============================================================
 * IIT JAM Physics LMS - Complete Stylesheet
 * ============================================================
 * 
 * Color Theme with Light/Dark Mode Support
 * Uses CSS custom properties for theming.
 * Default: Dark mode. Toggle via [data-theme="light"] on <html>.
 * ============================================================
 */

/* ===================== THEME VARIABLES ===================== */
:root {
    /* Light Theme (default) - improved contrast */
    --bg-primary: #ffffff; /* pure white app background */
    --bg-secondary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.96);
    --bg-card-solid: #ffffff;
    --bg-input: rgba(241, 245, 249, 0.95);
    --bg-hover: rgba(99, 102, 241, 0.08);
    --bg-hover-strong: rgba(99, 102, 241, 0.12);

    --border-primary: rgba(99, 102, 241, 0.22);
    --border-subtle: rgba(99, 102, 241, 0.18); /* slightly darker */
    --border-muted: rgba(148, 163, 184, 0.28); /* slightly darker */
    --border-input: rgba(148, 163, 184, 0.4);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b; /* increased contrast */
    --text-heading: #0f172a;
    --text-card-desc: #64748b;
    --text-link: #6366f1;
    --text-link-hover: #4f46e5;

    --accent: #6366f1;
    --accent-light: #6366f1;
    --accent-bg: rgba(99, 102, 241, 0.12);
    --success: #059669;
    --success-bg: rgba(16, 185, 129, 0.18);
    --warning: #d97706;
    --warning-bg: rgba(245, 158, 11, 0.16);
    --danger: #dc2626;
    --danger-bg: rgba(239, 68, 68, 0.14);

    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-accent: 0 4px 15px rgba(99, 102, 241, 0.15);

    --glass-blur: blur(12px);
    --navbar-bg: rgba(255, 255, 255, 0.98);
    --sidebar-bg: rgba(255, 255, 255, 0.99);
    --overlay-bg: rgba(0, 0, 0, 0.28);
    --video-bg: #1e293b;

    --progress-track: rgba(148, 163, 184, 0.3);
    --hamburger-color: #1e293b;
    --chat-bot-bg: rgba(241, 245, 249, 0.95);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-solid: #1e293b;
    --bg-input: rgba(51, 65, 85, 0.5);
    --bg-hover: rgba(99, 102, 241, 0.1);
    --bg-hover-strong: rgba(99, 102, 241, 0.15);

    --border-primary: rgba(99, 102, 241, 0.15);
    --border-subtle: rgba(99, 102, 241, 0.1);
    --border-muted: rgba(148, 163, 184, 0.1);
    --border-input: rgba(148, 163, 184, 0.2);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;
    --text-card-desc: #94a3b8;
    --text-link: #818cf8;
    --text-link-hover: #a5b4fc;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-bg: rgba(99, 102, 241, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    --scrollbar-track: #0f172a;
    --scrollbar-thumb: #334155;
    --scrollbar-thumb-hover: #475569;

    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 15px rgba(99, 102, 241, 0.3);

    --glass-blur: blur(12px);
    --navbar-bg: rgba(15, 23, 42, 0.95);
    --sidebar-bg: rgba(15, 23, 42, 0.98);
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --video-bg: #0f172a;

    --progress-track: rgba(51, 65, 85, 0.5);
    --hamburger-color: #f1f5f9;
    --chat-bot-bg: rgba(51, 65, 85, 0.5);
}

/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--text-link-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ===================== NAVBAR ===================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--navbar-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    height: 36px;
    width: auto;
    vertical-align: middle;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.navbar-center {
    display: none;
}

.course-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--hamburger-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Notification Button */
.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.notification-btn:hover {
    background: var(--accent-bg);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

/* User Profile Dropdown */
.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 50px;
    transition: background 0.3s ease;
}

.user-profile:hover {
    background: var(--bg-hover);
}

.profile-pic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}

.profile-pic-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 8px;
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.user-dropdown.active {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-muted);
}

.dropdown-header strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
}

.dropdown-header small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: var(--accent-bg);
    color: var(--text-primary);
}

.logout-item:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ===================== MAIN LAYOUT ===================== */
.main-layout {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 20px 16px;
    z-index: 999;
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    z-index: 998;
}

/* Sidebar Profile */
.sidebar-profile {
    text-align: center;
    padding: 20px 12px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
}

.sidebar-profile-pic {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    margin-bottom: 12px;
    object-fit: cover;
}

.sidebar-profile-pic-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
    color: white;
    margin-bottom: 12px;
}

.sidebar-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sidebar-roll {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Overall Progress */
.overall-progress {
    margin-top: 12px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    transition: width 1s ease;
}

/* Sidebar Section */
.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 8px 8px;
}

/* Module Tree */
.module-tree-item {
    margin-bottom: 4px;
}

.module-tree-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.module-tree-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.module-tree-header.active {
    background: var(--accent-bg);
    color: var(--text-link-hover);
}

.module-tree-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.module-tree-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.module-tree-arrow.expanded {
    transform: rotate(90deg);
}

.module-tree-topics {
    display: none;
    padding-left: 24px;
}

.module-tree-topics.expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

.topic-tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-tree-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topic-tree-item a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* Sidebar Links */
.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px;
    min-height: calc(100vh - 64px);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===================== WELCOME BANNER ===================== */
.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-text h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-text p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 500px;
}

.welcome-emoji {
    font-size: 64px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===================== STATS GRID ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--border-primary);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* ===================== CONTENT ROW ===================== */
.content-row {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Progress Circle */
.progress-circle-card {
    text-align: center;
}

.progress-circle-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
}

.progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: var(--progress-track);
    stroke-width: 8;
}

.progress-value {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease;
}

/* Fallback gradient for progress circle */
.progress-value {
    stroke: var(--accent);
}

.progress-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-circle-text span {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-circle-text small {
    font-size: 16px;
    color: var(--text-secondary);
}

.progress-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Active Module Card */
.active-module-card {
    display: flex;
    flex-direction: column;
}

.active-module-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.module-icon-large {
    font-size: 48px;
}

.active-module-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.active-module-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.module-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.module-progress-bar {
    flex: 1;
}

/* ===================== SECTION TITLE ===================== */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===================== MODULES GRID ===================== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.module-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.module-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.module-card-icon {
    font-size: 36px;
}

.module-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.module-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.module-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.module-card-topics {
    font-size: 12px;
    color: var(--text-muted);
}

.module-card-progress {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    box-shadow: var(--shadow-accent);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    color: white;
}

.btn-success.completed {
    background: var(--success-bg);
    color: var(--success);
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
}

.btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--accent-light);
}

.btn-disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ===================== MODULE HEADER ===================== */
.module-header {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.module-header-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.module-header-info {
    flex: 1;
}

.module-header-info h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.module-header-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.module-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--bg-input);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge-upcoming {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge-completed {
    background: var(--accent-bg);
    color: var(--accent-light);
}

.module-header-progress {
    text-align: right;
    min-width: 160px;
}

.module-header-progress .progress-bar {
    margin-bottom: 8px;
}

.module-header-progress span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===================== TOPIC CARDS ===================== */
.topics-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topic-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.3s ease;
}

.topic-card:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.topic-card-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.topic-number {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-bg);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.topic-completed .topic-number {
    background: var(--success-bg);
    color: var(--success);
}

.topic-upcoming .topic-number {
    background: var(--bg-input);
    color: var(--text-muted);
}

.topic-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.topic-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.topic-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.topic-card-right {
    flex-shrink: 0;
}

/* ===================== VIDEO PLAYER ===================== */
.video-container {
    margin-bottom: 24px;
    border-radius: 20px;
    overflow: hidden;
    background: var(--video-bg);
    box-shadow: var(--shadow-lg);
}

.video-wrapper {
    position: relative;
    padding-top: 56.25%; /* 16:9 ratio */
    background: var(--scrollbar-track);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--scrollbar-track);
    z-index: 1;
}

.video-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.video-loading p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Topic Detail Info */
.topic-detail-info {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}

.topic-detail-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.topic-detail-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.topic-detail-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.topic-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.topic-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.topic-navigation {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-muted);
}

.nav-btn {
    min-width: 180px;
    text-align: center;
}

/* Related Topics */
.related-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.related-topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    color: var(--text-primary);
}

.related-topic-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.related-topic-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ===================== ANNOUNCEMENTS ===================== */
.announcements-list, .announcements-full-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.announcement-card {
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.announcement-card:hover {
    transform: translateX(4px);
}

.announcement-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.announcement-icon {
    font-size: 20px;
}

.announcement-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.announcement-type-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

.announcement-message {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.announcement-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===================== PROGRESS TABLE ===================== */
.progress-table-container {
    overflow-x: auto;
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
}

.progress-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-muted);
}

.progress-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-muted);
}

.progress-table tr:hover td {
    background: var(--bg-hover);
}

.table-progress {
    width: 120px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.module-icon-sm {
    font-size: 16px;
    margin-right: 4px;
}

/* Completed/Remaining Topic Items */
.completed-topic-item, .remaining-topic-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.completed-topic-item:hover, .remaining-topic-item:hover {
    background: var(--bg-hover);
}

.completed-topic-item .topic-check {
    font-size: 18px;
    flex-shrink: 0;
}

.remaining-topic-item .topic-pending {
    font-size: 18px;
    flex-shrink: 0;
}

.completed-topic-item div, .remaining-topic-item div {
    flex: 1;
}

.completed-topic-item strong, .remaining-topic-item strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.completed-topic-item small, .remaining-topic-item small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===================== NOTIFICATION PANEL ===================== */
.notification-panel {
    position: fixed;
    top: 64px;
    right: -380px;
    width: 360px;
    max-height: calc(100vh - 80px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    z-index: 1002;
    box-shadow: var(--shadow-lg);
    transition: right 0.3s ease;
    overflow: hidden;
}

.notification-panel.active {
    right: 16px;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-muted);
}

.notification-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.notification-panel-body {
    padding: 16px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* ===================== CHATBOT ===================== */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-accent);
    z-index: 1003;
    transition: all 0.3s ease;
}

.chatbot-fab:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-accent);
}

.chatbot-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-height: 600px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    z-index: 1004;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chatbot-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border-bottom: 1px solid var(--border-primary);
    border-radius: 20px 20px 0 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    font-size: 28px;
}

.chatbot-header-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chatbot-header-info small {
    font-size: 11px;
    color: var(--text-secondary);
}

.chatbot-header-actions {
    display: flex;
    gap: 4px;
}

.chatbot-clear-btn, .chatbot-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chatbot-clear-btn:hover, .chatbot-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 380px;
    min-height: 300px;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.bot-message .message-content {
    background: var(--bg-input);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    font-family: monospace;
    background: var(--overlay-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.copy-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--overlay-bg);
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-content:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--overlay-bg);
    color: var(--text-primary);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    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; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input */
.chatbot-input-area {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-muted);
}

.chatbot-remaining {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.chatbot-input-row {
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input:focus {
    border-color: var(--accent);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-accent);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===================== LOADING SPINNER ===================== */
.loading-spinner {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===================== RESPONSIVE DESIGN ===================== */
@media (max-width: 1024px) {
    .content-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar-center {
        display: none;
    }

    .modules-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .navbar {
        padding: 0 16px;
    }

    .user-name {
        display: none;
    }

    .welcome-banner {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }

    .welcome-text h1 {
        font-size: 20px;
    }

    .welcome-emoji {
        font-size: 48px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    .topic-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .topic-card-right {
        width: 100%;
    }

    .topic-card-right .btn {
        width: 100%;
    }

    .topic-actions {
        flex-direction: column;
    }

    .topic-actions .btn {
        width: 100%;
    }

    .topic-navigation {
        flex-direction: column;
    }

    .nav-btn {
        min-width: auto;
        width: 100%;
    }

    .chatbot-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 8px;
        max-height: calc(100vh - 80px);
    }

    .chatbot-fab .fab-text {
        display: none;
    }

    .chatbot-fab {
        padding: 16px;
        border-radius: 50%;
    }

    .notification-panel {
        width: calc(100vw - 32px);
    }

    .module-header {
        flex-direction: column;
        text-align: center;
    }

    .module-header-progress {
        width: 100%;
        text-align: center;
    }

    .page-title {
        font-size: 22px;
    }

    .related-topics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .logo-text {
        font-size: 14px;
    }
}

/* ===================== DESKTOP ENHANCEMENTS ===================== */
@media (min-width: 1025px) {
    .navbar-center {
        display: block;
    }
}

/* ===================== PRINT STYLES ===================== */
@media print {
    .navbar, .sidebar, .chatbot-fab, .chatbot-panel, .notification-panel {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ===================== NO-VIDEO PLACEHOLDER ===================== */
.no-video-placeholder {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 80px 24px;
    text-align: center;
    margin-bottom: 24px;
}
.no-video-inner .no-video-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}
.no-video-inner h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.no-video-inner p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===================== TESTS LIST PAGE ===================== */
.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.test-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: cardEntrance 0.5s ease both;
}
@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.test-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.test-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.test-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.test-card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.test-card-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.test-badge { padding: 3px 12px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.test-badge-mcq { background: rgba(99,102,241,.15); color: #6366f1; }
.test-badge-msq { background: rgba(16,185,129,.15); color: #10b981; }
.test-badge-nat { background: rgba(245,158,11,.15); color: #f59e0b; }
.test-badge-status-published { background: var(--success-bg); color: var(--success); }
.test-badge-status-draft { background: var(--warning-bg); color: var(--warning); }
.test-attempt-info { font-size: 12px; color: var(--text-secondary); }
.test-attempt-info .score-highlight { font-weight: 700; color: var(--accent-light); font-size: 14px; }

/* ===================== EXAM PAGE ===================== */
.exam-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0;
    height: calc(100vh - 64px);
    margin-top: 64px;
    overflow: hidden;
}
.exam-main {
    overflow-y: auto;
    padding: 24px 28px;
    border-right: 1px solid var(--border-muted);
}
.exam-sidebar {
    overflow-y: auto;
    padding: 16px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}
.exam-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--navbar-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}
.exam-timer {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 8px;
}
.exam-timer.warning { color: var(--warning); animation: pulse 1s infinite; }
.exam-timer.critical { color: var(--danger); animation: pulse 0.5s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.exam-section-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-muted);
}
.exam-section-tab {
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-input);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
}
.exam-section-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.exam-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 20px;
    animation: slideInLeft 0.3s ease;
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}
.exam-q-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.exam-q-num { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.exam-q-type { font-size: 11px; padding: 3px 12px; border-radius: 50px; font-weight: 700; }
.exam-q-marks { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.exam-q-text {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 10px;
}
.exam-q-latex {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow-x: auto;
}
.exam-q-image {
    max-width: 100%;
    max-height: 280px;
    border-radius: 12px;
    object-fit: contain;
    margin-bottom: 16px;
    border: 1px solid var(--border-muted);
}
.exam-options { display: flex; flex-direction: column; gap: 10px; }
.exam-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid var(--border-input);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
}
.exam-option:hover { border-color: var(--accent); background: var(--bg-hover); }
.exam-option.selected { border-color: var(--accent); background: var(--accent-bg); }
.exam-option.correct-show { border-color: var(--success); background: var(--success-bg); }
.exam-option.wrong-show { border-color: var(--danger); background: var(--danger-bg); opacity: 0.8; }
.exam-option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    color: var(--text-primary);
}
.exam-option.selected .exam-option-letter { background: var(--accent); color: #fff; }
.exam-nat-input {
    width: 200px;
    padding: 12px 16px;
    border: 2px solid var(--border-input);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border 0.2s;
}
.exam-nat-input:focus { border-color: var(--accent); }
.exam-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-muted);
    flex-wrap: wrap;
}

/* Q palette */
.q-palette-title { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; letter-spacing: 0.5px; }
.q-palette-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 11px; color: var(--text-muted); }
.q-palette-legend-item { display: flex; align-items: center; gap: 4px; }
.q-dot { width: 10px; height: 10px; border-radius: 3px; }
.q-dot-answered { background: var(--success); }
.q-dot-marked { background: var(--warning); }
.q-dot-not-visited { background: var(--bg-input); border: 1px solid var(--border-muted); }
.q-dot-unanswered { background: var(--danger); }
.q-palette-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.q-palette-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--border-muted);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.q-palette-btn.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--accent-bg); }
.q-palette-btn.answered { background: var(--success); border-color: var(--success); color: #fff; }
.q-palette-btn.marked { background: var(--warning); border-color: var(--warning); color: #fff; }
.q-palette-btn.unanswered { background: var(--danger-bg); border-color: var(--danger); }

/* ===================== RESULT PAGE ===================== */
.result-hero {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    padding: 40px 32px;
    text-align: center;
    margin-bottom: 28px;
    animation: fadeInUp 0.7s ease;
}
.result-score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 32px rgba(99,102,241,0.35);
    animation: scaleIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.result-score-circle .score-num { font-size: 36px; font-weight: 800; color: #fff; line-height: 1; }
.result-score-circle .score-total { font-size: 14px; color: rgba(255,255,255,0.8); }
.result-hero h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.result-hero p { font-size: 14px; color: var(--text-secondary); }
.result-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 28px; }
.result-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    animation: cardEntrance 0.5s ease both;
}
.result-stat-card .r-num { font-size: 26px; font-weight: 700; }
.result-stat-card .r-lbl { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.r-correct { color: var(--success); }
.r-wrong { color: var(--danger); }
.r-unattempted { color: var(--text-secondary); }
.r-score { color: var(--accent-light); }

/* Solution accordion */
.solution-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
}
.solution-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.solution-q-status { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.s-correct { background: var(--success-bg); }
.s-wrong { background: var(--danger-bg); }
.s-skipped { background: var(--bg-input); }
.solution-body { display: none; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border-muted); }
.solution-body.open { display: block; }

/* ===================== EXTENDED MOBILE RESPONSIVE ===================== */
@media (max-width: 900px) {
    .exam-layout { grid-template-columns: 1fr; height: auto; }
    .exam-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 220px;
        overflow-x: auto;
        overflow-y: hidden;
        border-top: 1px solid var(--border-muted);
        border-right: none;
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 12px 16px;
        background: var(--bg-card-solid);
        z-index: 500;
    }
    .exam-main { padding-bottom: 240px; }
    .q-palette-grid { flex-direction: row; }
    .exam-nav-row { flex-direction: column; }
    .exam-nav-row .btn { width: 100%; }
}

@media (max-width: 768px) {
    /* Dashboard */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-row { grid-template-columns: 1fr; }
    .modules-grid { grid-template-columns: 1fr; }
    .welcome-banner { flex-direction: column; text-align: center; padding: 24px 20px; gap: 16px; }
    .welcome-emoji { font-size: 48px; }
    .welcome-text h1 { font-size: 20px; }
    /* Topic */
    .topic-detail-header { flex-direction: column; }
    .topic-actions { flex-direction: column; }
    .topic-actions .btn { width: 100%; justify-content: center; }
    .topic-navigation { flex-direction: column; }
    .nav-btn { width: 100%; text-align: center; }
    /* Tests */
    .tests-grid { grid-template-columns: 1fr; }
    .result-stats-row { grid-template-columns: repeat(2,1fr); }
    /* Exam */
    .exam-section-tabs { gap: 4px; }
    .exam-section-tab { padding: 6px 12px; font-size: 12px; }
    .exam-question-card { padding: 18px 14px; }
    .exam-q-text { font-size: 14px; }
    .exam-option { padding: 12px 14px; font-size: 13px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .stat-info h3 { font-size: 18px; }
    .section-title { font-size: 16px; }
    .page-title { font-size: 20px; }
    .navbar { padding: 0 12px; }
    .logo-text { display: none; }
    .main-content { padding: 12px; }
    .card { padding: 16px; border-radius: 14px; }
    .breadcrumb { font-size: 12px; }
    /* Buttons */
    .btn { font-size: 13px; padding: 10px 16px; }
    .chatbot-fab { bottom: 16px; right: 16px; padding: 14px; }
    /* Test result */
    .result-hero { padding: 28px 16px; }
    .result-score-circle { width: 110px; height: 110px; }
    .result-score-circle .score-num { font-size: 28px; }
    .q-palette-btn { width: 32px; height: 32px; font-size: 11px; }
}

/* ===================== ANIMATION UTILITIES ===================== */
.animate-in { animation: cardEntrance 0.4s ease both; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.10s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.20s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(n+6) { animation-delay: 0.30s; }

/* Ripple effect on buttons */
.btn { position: relative; overflow: hidden; }
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    transform: scale(0);
    border-radius: 50%;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}
.btn:active::after { transform: scale(2.5); opacity: 1; transition: 0s; }

/* Shimmer skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Slide-up toast (mobile-friendly) */
@media (max-width: 600px) {
    .toast { left: 16px; right: 16px; bottom: 88px; text-align: center; }
}

/* Touch targets: ensure min 44px tap area */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-item, .sidebar-link, .exam-option, .dropdown-item, .q-palette-btn {
        min-height: 44px;
    }
    .q-palette-btn { width: 40px; height: 40px; }
}

/* ===================== PAGE HEADER ROW ===================== */
.page-header-row { margin: 1.5rem 0 .25rem; }
.page-title   { font-size: 1.6rem; font-weight: 700; margin: 0; }
.page-subtitle{ color: var(--text-secondary); font-size: .9rem; margin: .25rem 0 0; }

/* ===================== RESULT PAGE – SCORE CIRCLE INNER ===================== */
.rsc-inner   { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rsc-score   { font-size: 2rem; font-weight: 800; color: #fff; line-height: 1; }
.rsc-total   { font-size: .9rem; color: rgba(255,255,255,.8); }
/* Alias rs-* to result-stat-card inner elements */
.rs-value    { font-size: 1.6rem; font-weight: 700; }
.rs-label    { font-size: .75rem; color: var(--text-secondary); margin-top: .2rem; }

/* ===================== SOLUTION CARD (extended) ===================== */
.sc-qnum    { font-weight: 700; font-size: .9rem; min-width: 2.5rem; }
.sc-status  { font-size: .8rem; padding: .2rem .5rem; border-radius: 20px; font-weight: 600; }
.sc-status.correct     { background: var(--success-bg, #d1fae5); color: var(--success, #065f46); }
.sc-status.wrong       { background: var(--danger-bg,  #fee2e2); color: var(--danger,  #991b1b); }
.sc-status.unattempted { background: var(--bg-secondary); color: var(--text-secondary); }
.sc-marks   { font-size: .82rem; color: var(--text-secondary); margin-left: auto; }
.sc-qtext   { margin-top: .5rem; font-size: .92rem; line-height: 1.6; }

/* ===================== QUESTION TYPE BADGE VARIANTS ===================== */
.q-type-badge-mcq { background: rgba(99,102,241,.12); color: #6366f1; }
.q-type-badge-msq { background: rgba(139,92,246,.12);  color: #7c3aed; }
.q-type-badge-nat { background: rgba(20,184,166,.12);  color: #0d9488; }

/* ===================== PALETTE SECTION LABEL ===================== */
.q-palette-section-label {
    width: 100%;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-secondary);
    margin: .5rem 0 .25rem;
    padding-top: .25rem;
    border-top: 1px solid var(--border);
}
.q-palette-section-label:first-child { border-top: none; margin-top: 0; }

/* ===================== EXAM TITLE TEXT ===================== */
.exam-title-text   { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.exam-section-badge{ background: var(--accent-bg); color: var(--accent, var(--primary)); border-radius: 12px; padding: .15rem .6rem; font-size: .78rem; font-weight: 600; margin-left: .5rem; white-space: nowrap; }

/* ===================== Q-INDEX BADGE ===================== */
.q-index-badge { background: var(--bg-secondary); border-radius: 8px; padding: .2rem .6rem; font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
