:root {
    /* Harmonious Modern Studio Palette (Royal Indigo + Nordic Teal + Warm Pearl) */
    --bg-dark: #090d16;
    --bg-sidebar: linear-gradient(180deg, #0b1120 0%, #111827 55%, #0f172a 100%);
    --bg-main: #f4f6fb;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.86);

    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --border: #e2e8f0;
    --border-subtle: rgba(15, 23, 42, 0.07);

    /* Primary Royal Indigo & Violet */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-border: #c7d2fe;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 55%, #0d9488 100%);
    --btn-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);

    /* Secondary Nordic Emerald / Teal */
    --success: #0d9488;
    --success-bright: #10b981;
    --success-light: #ecfdf5;

    /* Warm Amber & Coral Rose */
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #e11d48;
    --danger-light: #fff1f2;

    /* Elevations & Radii */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.14), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
    --shadow-indigo: 0 6px 18px -3px rgba(79, 70, 229, 0.35);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 45%),
        radial-gradient(at 100% 0%, rgba(13, 148, 136, 0.06) 0px, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.55;
    overflow-x: hidden;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

h1, h2, h3, .brand-title, .card-title, .kpi-value {
    font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.02em;
}

.hidden {
    display: none !important;
}

/* CUSTOM SCROLLBARS */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================
   APP SHELL & RESPONSIVE SIDEBAR
   ========================================== */
.app-shell {
    display: grid;
    grid-template-columns: 276px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-sidebar);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    z-index: 60;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(9, 13, 22, 0.12);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
    background: linear-gradient(90deg, #ffffff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 11.5px;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.sidebar-close-btn {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.role-badge-box {
    margin: 18px 0;
    padding: 13px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-badge-box:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(165, 180, 252, 0.35);
    transform: translateY(-1px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11.5px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #cbd5e1;
    font-size: 13.8px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--btn-gradient);
    color: #ffffff;
    font-weight: 600;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: var(--shadow-indigo);
}

.nav-icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-pill {
    font-size: 10px;
    padding: 2.5px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-weight: 700;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.nav-pill.live {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.55);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.72; transform: scale(0.97); }
}

.sidebar-footer {
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.62);
    backdrop-filter: blur(4px);
    z-index: 55;
}

/* ==========================================
   MAIN CONTENT & FROSTED GLASS TOPBAR
   ========================================== */
.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-titles {
    min-width: 0;
}

.topbar h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar p {
    font-size: 12.8px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: #ffffff;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4.5px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.timer-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 6px 13px;
    border-radius: 99px;
    font-size: 13px;
    box-shadow: var(--shadow-xs);
    font-variant-numeric: tabular-nums;
}

.timer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

.timer-dot.running {
    background: var(--success-bright);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
}

.btn-icon {
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 50%;
    width: 27px;
    height: 27px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
}

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

.user-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 99px;
    background: linear-gradient(135deg, #eef2ff 0%, #f0fdfa 100%);
    border: 1px solid var(--primary-border);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease;
    max-width: 260px;
}

.user-switcher:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.view-container {
    padding: 28px 30px 56px;
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================
   CARDS, KPI TILES & ADAPTIVE GRIDS
   ========================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0.85;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.kpi-value {
    font-size: 27px;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 12.2px;
    color: var(--text-muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.grid-equal {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    min-width: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.35;
}

/* ==========================================
   BUTTONS & BADGES
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9.5px 17px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.3;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--btn-gradient);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #0d9488 0%, #10b981 100%);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.25);
}

.btn-success:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
    color: #ffffff;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.16);
    color: #f1f5f9;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}

.btn-light {
    background: #f8fafc;
    color: var(--text-secondary);
    border-color: #cbd5e1;
}

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

.btn-sm {
    padding: 6.5px 12px;
    font-size: 12.2px;
    border-radius: 9px;
}

.btn-block {
    width: 100%;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3.5px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.badge-success {
    background: var(--success-light);
    color: #0f766e;
    border: 1px solid rgba(16, 185, 129, 0.24);
}
.badge-warning {
    background: var(--warning-light);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-danger {
    background: var(--danger-light);
    color: #be123c;
    border: 1px solid rgba(244, 63, 94, 0.24);
}

/* ==========================================
   TABLES & DATA GRIDS
   ========================================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 580px;
}

th, td {
    padding: 13px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: #f8fafc;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #f8fafc;
}

/* ==========================================
   FORMS & INPUTS
   ========================================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

input, select, textarea {
    padding: 10px 13px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    max-width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(79, 70, 229, 0.14);
}

/* ==========================================
   INTERACTIVE COURSES & EXERCISES
   ========================================== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.course-card {
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow-xs);
}

.course-card:hover {
    border-color: #818cf8;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.course-card.active {
    border-color: var(--primary);
    background: linear-gradient(180deg, #f5f7ff 0%, #ffffff 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.12);
}

.theory-card {
    background: linear-gradient(135deg, #eef2ff 0%, #f0fdfa 100%);
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 20px;
}

.theory-card h3 {
    margin-bottom: 10px;
    color: #1e1b4b;
}

.theory-card ul, .theory-card ol {
    padding-left: 20px;
    margin: 8px 0;
}

.grammar-box {
    background: #ffffff;
    border-left: 4px solid var(--primary);
    padding: 13px 16px;
    border-radius: 10px;
    margin-top: 12px;
    box-shadow: var(--shadow-xs);
}

.grammar-table {
    width: 100%;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
    min-width: 0;
}

.exercise-card {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
    background: #ffffff;
    transition: all 0.15s ease;
}

.exercise-card.solved-correct {
    border-color: #10b981;
    background: #f0fdf4;
}

.exercise-card.solved-wrong {
    border-color: #f43f5e;
    background: #fff1f2;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.quiz-option {
    padding: 11px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 11px;
    background: #ffffff;
    cursor: pointer;
    font-weight: 500;
    text-align: left;
    transition: all 0.14s ease;
}

.quiz-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: var(--btn-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.word-chip-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px dashed #cbd5e1;
}

.word-chip {
    padding: 7px 13px;
    border-radius: 9px;
    background: #ffffff;
    border: 1px solid #94a3b8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.12s ease;
}

.word-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ==========================================
   FLASHCARD 3D TRAINER
   ========================================== */
.flashcard-stage {
    perspective: 1000px;
    max-width: 520px;
    margin: 0 auto 20px;
}

.flashcard-box {
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 55%, #0d9488 100%);
    color: #ffffff;
    border-radius: 22px;
    padding: 38px 28px;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.flashcard-box:hover {
    transform: translateY(-2px) scale(1.01);
}

.flashcard-word {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 6px;
}

.flashcard-trans {
    font-size: 15px;
    opacity: 0.86;
    margin-bottom: 14px;
}

.flashcard-meaning {
    font-size: 22px;
    font-weight: 700;
    color: #fde047;
    margin-top: 8px;
}

/* ==========================================
   SKILL BARS
   ========================================== */
.skill-row {
    margin-bottom: 14px;
}

.skill-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.skill-track {
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--primary-gradient);
    transition: width 0.4s ease;
}

/* ==========================================
   VIRTUAL CLASSROOM & GROUP VIDEO CONFERENCE
   ========================================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.video-participant-card {
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.video-participant-card.online {
    border-color: var(--success-bright);
    box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.16);
}

.video-tile {
    background: radial-gradient(circle at 50% 35%, #1e293b 0%, #090d16 100%);
    color: #ffffff;
    padding: 14px;
    min-height: 215px;
    aspect-ratio: 16 / 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.video-tile video,
.video-tile .relay-video-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.video-tile-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    flex: 1;
    pointer-events: none;
}

.video-avatar {
    font-size: 48px;
    margin: auto;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.video-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: rgba(9, 13, 22, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 7px 11px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-controls-bar {
    padding: 12px 14px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.volume-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.volume-slider-row input[type="range"] {
    flex: 1;
    padding: 0;
    height: 6px;
    accent-color: var(--primary);
    cursor: pointer;
}

.student-chat-drawer {
    border-top: 1px solid var(--border);
    background: #ffffff;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.student-chat-messages {
    max-height: 165px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.chat-bubble {
    padding: 8px 11px;
    border-radius: 11px;
    font-size: 12.5px;
    line-height: 1.4;
    background: #f1f5f9;
    color: var(--text-main);
}

.chat-bubble.from-teacher {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}

.chat-bubble-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 700;
}

/* ==========================================
   INTERACTIVE GRAPHICAL WHITEBOARD
   ========================================== */
.wb-toolbar {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 12px;
}

.wb-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7.5px 12px;
    border-radius: 9px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.wb-tool-btn.active {
    background: var(--btn-gradient);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
}

.wb-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
    transition: transform 0.14s ease;
    flex-shrink: 0;
}

.wb-color-swatch.active {
    transform: scale(1.22);
    box-shadow: 0 0 0 2.5px var(--primary);
}

.wb-canvas-wrap {
    position: relative;
    width: 100%;
    border-radius: 16px;
    border: 2px solid #cbd5e1;
    background-color: #ffffff;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 22px 22px;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.04);
}

.wb-canvas {
    display: block;
    width: 100%;
    height: 460px;
    cursor: crosshair;
    touch-action: none;
}

.wb-Divider {
    width: 1px;
    height: 24px;
    background: #cbd5e1;
    margin: 0 3px;
    flex-shrink: 0;
}

/* ==========================================
   AUTHENTICATION MODAL
   ========================================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow-y: auto;
}

.auth-card {
    background: #ffffff;
    border-radius: 22px;
    max-width: 640px;
    width: 100%;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-height: 92vh;
    overflow-y: auto;
}

.auth-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand h1 {
    font-size: 23px;
    font-weight: 800;
}

.auth-brand h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-brand p {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-close-modal {
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    overflow-x: auto;
}

.auth-tab {
    padding: 8.5px 14px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.auth-tab.active {
    background: var(--btn-gradient);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.25);
}

.demo-accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.demo-account-item {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.16s ease;
}

.demo-account-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* ==========================================
   MOBILE & TABLET BOTTOM NAVIGATION BAR
   ========================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 17, 32, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -8px 24px rgba(9, 13, 22, 0.22);
}

.mob-nav-item {
    flex: 1;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0;
}

.mob-nav-icon {
    font-size: 18px;
    line-height: 1;
}

.mob-nav-label {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mob-nav-item.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.24);
}

.mob-nav-item.mob-nav-live .mob-nav-icon {
    filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.65));
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    animation: slideIn 0.22s ease;
}

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

/* ==========================================
   RESPONSIVE BREAKPOINTS FOR ALL DEVICES
   ========================================== */

/* 1. ULTRAWIDE MONITORS (2K / 4K / 21:9 >= 1680px) */
@media (min-width: 1680px) {
    .app-shell {
        grid-template-columns: 304px minmax(0, 1fr);
    }
    .view-container {
        max-width: 1860px;
        padding: 34px 44px 64px;
    }
    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 22px;
    }
    .video-grid {
        grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
        gap: 20px;
    }
    .wb-canvas {
        height: 540px;
    }
}

/* 2. TABLETS & SMALL LAPTOPS (<= 1120px) */
@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 288px;
        max-width: 84vw;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: inline-flex;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .view-container {
        padding: 20px 20px 96px;
    }

    .grid-2, .grid-equal {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .toast-container {
        bottom: 82px;
        right: 16px;
    }
}

/* 3. SMARTPHONES (iPhone 17, Google Pixel, Android <= 768px) */
@media (max-width: 768px) {
    .topbar {
        padding: 10px 14px;
        gap: 8px;
    }

    .topbar h2 {
        font-size: 16.5px;
    }

    .topbar p {
        display: none;
    }

    .timer-label {
        display: none;
    }

    .timer-widget {
        padding: 5px 10px;
        font-size: 12px;
        gap: 5px;
    }

    .user-switcher {
        padding: 6px 10px;
        font-size: 12px;
        max-width: 155px;
    }

    .user-switcher span:nth-child(2) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .view-container {
        padding: 14px 12px 96px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 14px;
        border-radius: 14px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .kpi-top {
        font-size: 11.5px;
    }

    .card {
        padding: 16px 14px;
        border-radius: 15px;
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 15.5px;
    }

    /* Prevent iOS Safari auto-zoom on input focus */
    input, select, textarea {
        font-size: 16px;
        padding: 10px 12px;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .video-tile {
        min-height: 210px;
    }

    /* Horizontal swipeable whiteboard toolbar ribbon on mobile */
    .wb-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 10px;
        gap: 6px;
    }

    .wb-canvas {
        height: 340px;
    }

    .auth-card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    .demo-accounts-grid {
        grid-template-columns: 1fr;
    }
}

/* 4. COMPACT SMARTPHONES (<= 420px) */
@media (max-width: 420px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .user-switcher span:nth-child(2) {
        max-width: 82px;
    }

    .mob-nav-label {
        font-size: 9.5px;
    }
}
