/* ==========================================================================
   SISTEMA DE CURSOS Y EVALUACIONES - PROGRAMACIÓN 3RO 7MA
   Estilos Modernos, Glassmorphism, Paleta Curada y Soporte Dark/Light
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=Roboto+Mono:wght@400;500;600&display=swap');

:root {
    /* Paleta Modo Oscuro (Por Defecto) */
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-elevated: #1e293b;
    --bg-surface-glass: rgba(17, 24, 39, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.15);
    --primary-glow: rgba(99, 102, 241, 0.35);

    --accent: #0284c7;
    --accent-glow: rgba(2, 132, 199, 0.25);
    --guia-heading: #38bdf8;
    --code-inline-color: #38bdf8;
    --code-inline-bg: rgba(56, 189, 248, 0.12);
    --code-inline-border: rgba(56, 189, 248, 0.25);

    --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);

    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--border-color);
    --card-shadow-hover: 0 20px 40px -12px rgba(79, 70, 229, 0.25), 0 0 1px 1px var(--primary);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-code: 'Consolas', 'Courier New', 'Roboto Mono', monospace;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-glass: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(79, 70, 229, 0.3);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.08);
    --primary-glow: rgba(79, 70, 229, 0.2);

    --accent: #0369a1;
    --accent-glow: rgba(3, 105, 161, 0.2);
    --guia-heading: #0369a1;
    --code-inline-color: #0369a1;
    --code-inline-bg: rgba(3, 105, 161, 0.08);
    --code-inline-border: rgba(3, 105, 161, 0.2);

    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 0 1px 1px var(--border-color);
    --card-shadow-hover: 0 16px 32px -8px rgba(79, 70, 229, 0.15), 0 0 1px 1px var(--primary);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

main {
    flex: 1;
    padding: 36px 0 64px 0;
}

/* ==========================================================================
   Navbar (Glassmorphic & Polished)
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
    flex-shrink: 0;
}

.brand-title {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.brand-subtitle {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.88rem;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-link svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.nav-link.active svg {
    color: var(--primary);
    opacity: 1;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.user-name {
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

.user-badge .role-tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.user-badge .role-tag.profesor {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.theme-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ==========================================================================
   Buttons & UI Components
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #4f46e5);
    box-shadow: 0 6px 20px var(--primary-glow);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   Hero & Header Banners
   ========================================================================== */
.hero-banner {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-surface-elevated));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 2.1rem;
    margin-bottom: 8px;
    background: linear-gradient(120deg, var(--text-primary) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 680px;
}

/* ==========================================================================
   Dashboard Stats Bar
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-val {
    font-size: 1.7rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Course Modules Grid (10 Cursos)
   ========================================================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.45rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.module-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.module-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.module-number {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.module-title-wrap {
    flex: 1;
}

.module-title {
    font-size: 1.15rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.module-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.module-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    margin-bottom: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.status-badge.aprobado {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.desaprobado {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.pendiente {
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.module-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ==========================================================================
   Guía de Estudio (Material Viewer)
   ========================================================================== */
.document-view {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--card-shadow);
    max-width: 900px;
    margin: 0 auto;
}

.doc-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.doc-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.doc-title {
    font-size: 2.2rem;
    margin-bottom: 14px;
}

.doc-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.guia-seccion {
    margin-bottom: 36px;
}

.guia-seccion h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--guia-heading, var(--accent));
    display: flex;
    align-items: center;
    gap: 8px;
}

.guia-seccion p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 1.02rem;
    line-height: 1.7;
}

.guia-seccion ul, .guia-seccion ol {
    margin-left: 24px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.guia-seccion li {
    margin-bottom: 8px;
}

.info-box {
    background: rgba(79, 70, 229, 0.07);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 20px 0;
    color: var(--text-primary);
}

.code-block {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 20px 0;
    overflow: hidden;
}

.code-title {
    display: block;
    background: #161b22;
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-code);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-block pre {
    padding: 16px;
    overflow-x: auto;
    margin: 0;
    font-family: var(--font-code);
    font-variant-ligatures: none !important;
    font-feature-settings: "liga" 0, "calt" 0, "dlig" 0 !important;
    letter-spacing: 0.02em;
}

.code-block code {
    font-family: var(--font-code);
    font-size: 0.92rem;
    color: #79c0ff;
    line-height: 1.5;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-weight: 500;
    font-variant-ligatures: none !important;
    font-feature-settings: "liga" 0, "calt" 0, "dlig" 0 !important;
    letter-spacing: 0.02em;
}

/* Código inline destacado (en párrafos, tablas, guías y cajas): oscuro y bold */
code {
    font-family: var(--font-code);
    font-size: 0.92em;
    font-weight: 700;
    color: var(--code-inline-color);
    background: var(--code-inline-bg);
    border: 1px solid var(--code-inline-border);
    padding: 2px 7px;
    border-radius: 5px;
    display: inline-block;
    vertical-align: baseline;
    font-variant-ligatures: none !important;
    font-feature-settings: "liga" 0, "calt" 0, "dlig" 0 !important;
    letter-spacing: 0.02em;
}

.tabla-doc td code {
    font-weight: 700;
    font-size: 0.94rem;
}

.tabla-doc {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
}

.tabla-doc th, .tabla-doc td {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.tabla-doc th {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-weight: 600;
}

.tabla-doc tr:hover td {
    background: var(--bg-surface-elevated);
}

/* ==========================================================================
   Exam Interface
   ========================================================================== */
.exam-container {
    max-width: 840px;
    margin: 0 auto;
}

.exam-header-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-code);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg-surface-elevated);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.question-card:hover {
    border-color: var(--border-hover);
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.q-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
}

.q-pts {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-surface-elevated);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.option-item:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.08);
}

.option-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.option-item input[type="radio"] {
    display: none;
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.option-item.selected .option-letter {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.option-text {
    flex: 1;
    font-size: 0.98rem;
    color: var(--text-primary);
}

/* ==========================================================================
   Exam Results Screen
   ========================================================================== */
.result-hero {
    text-align: center;
    padding: 40px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    box-shadow: var(--card-shadow);
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 6px solid var(--border-color);
    position: relative;
}

.score-circle.approved {
    border-color: var(--success);
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 80%);
}

.score-circle.failed {
    border-color: var(--danger);
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, transparent 80%);
}

.score-num {
    font-size: 2.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1;
}

.score-max {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 18px;
}

.feedback-card.correct {
    border-left: 5px solid var(--success);
}

.feedback-card.incorrect {
    border-left: 5px solid var(--danger);
}

.explanation-box {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Teacher / Admin Matrix & Table
   ========================================================================== */
.admin-table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow-x: auto;
    margin-top: 24px;
}

.table-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    white-space: nowrap;
}

.table-matrix th, .table-matrix td {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.table-matrix th {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-weight: 600;
}

.table-matrix td.student-name {
    text-align: left;
    font-weight: 600;
    position: sticky;
    left: 0;
    background: var(--bg-surface);
    z-index: 10;
}

.grade-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: var(--font-code);
    font-size: 0.82rem;
}

.grade-pill.pass {
    background: var(--success-bg);
    color: var(--success);
}

.grade-pill.fail {
    background: var(--danger-bg);
    color: var(--danger);
}

.grade-pill.none {
    color: var(--text-muted);
}

/* ==========================================================================
   Forms & Login
   ========================================================================== */
.login-wrap {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--card-shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ==========================================================================
   Interactive Tour System
   ========================================================================== */
.btn-tour-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn-tour-trigger:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: var(--primary);
    transform: translateY(-1px);
    color: var(--primary);
}

.app-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 29, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.app-tour-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.app-tour-target-highlight {
    position: relative !important;
    z-index: 9999 !important;
    box-shadow: 0 0 0 4px var(--primary), 0 10px 30px rgba(99, 102, 241, 0.45) !important;
    border-radius: var(--radius-md) !important;
    transition: box-shadow 0.3s ease !important;
    background: var(--bg-surface) !important;
}

.app-tour-popover {
    position: fixed;
    z-index: 10000;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), top 0.25s ease, left 0.25s ease;
}

.app-tour-popover.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.app-tour-popover.is-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.app-tour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.app-tour-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.app-tour-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.app-tour-close-btn:hover {
    color: var(--text-primary);
}

.app-tour-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-tour-body {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.app-tour-body p {
    margin: 0 0 8px 0;
}

.app-tour-body p:last-child {
    margin-bottom: 0;
}

.app-tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
}

.app-tour-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.app-tour-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.2s ease;
}

.app-tour-dot.active {
    width: 20px;
    border-radius: 9999px;
    background: var(--primary);
}

.app-tour-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    visibility: hidden;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.student-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.progress-mini-bar {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    height: 7px;
    width: 90px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
    .hero-banner {
        padding: 24px 20px;
    }
    .hero-title {
        font-size: 1.6rem;
    }
    .document-view {
        padding: 24px 18px;
    }
    .nav-links {
        display: none;
    }
    .module-actions {
        grid-template-columns: 1fr;
    }
}
