/* ===== STYLESHEET UPDATES FOR PORTAL MODALS & TOASTS ===== */
:root {
    --bg-primary: #080d19;
    --bg-secondary: #0f1422;
    --bg-card: #151c2e;
    --bg-card-hover: #1a233b;
    --accent-green: #10b981;
    --accent-green-hover: #0d9668;
    --accent-green-glow: rgba(16, 185, 129, 0.12);
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.1);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.1);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --border: #1e293b;
    --border-hover: #334155;
    
    --radius: 16px;
    --radius-sm: 8px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1) 0.25s;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* ===== LAYOUT & CORE VIEWS ===== */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.brand-icon {
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-info {
    display: flex;
    flex-direction: column;
}
.brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}
.brand-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* User summary profile (Settings click trigger) */
.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    position: relative;
}
.user-profile-summary.clickable {
    cursor: pointer;
    transition: var(--transition);
}
.user-profile-summary.clickable:hover {
    border-color: var(--accent-green);
    background: var(--bg-card-hover);
}
.user-avatar-wrapper {
    position: relative;
}
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fff;
}
.status-indicator {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.status-indicator.online { background-color: var(--accent-green); }

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.user-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}
.user-role {
    font-size: 10px;
    color: var(--text-secondary);
}
.settings-gear {
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
}
.user-profile-summary:hover .settings-gear {
    color: #fff;
    transform: rotate(45deg);
}

/* Menu links */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.nav-item {
    background: none;
    border: none;
    padding: 14px 18px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.03);
}
.nav-item.active {
    color: #fff;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.nav-icon {
    font-size: 16px;
}

/* Sidebar Promo card */
.sidebar-promo {
    background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: auto;
}
.sidebar-promo h4 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 6px;
}
.sidebar-promo p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}
.promo-btn {
    display: block;
    width: 100%;
    background: var(--accent-green);
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: var(--transition);
}
.promo-btn:hover {
    background: var(--accent-green-hover);
}

/* ===== MAIN WINDOW WRAPPER ===== */
.main-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* TOP NAVBAR */
.top-nav {
    height: 65px;
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}
.nav-left h2 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.metric-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.metric-pill.clickable {
    cursor: pointer;
    transition: var(--transition);
}
.metric-pill.clickable:hover {
    border-color: var(--accent-green);
    background: var(--bg-card-hover);
}
.metric-value {
    color: var(--accent-gold);
}
.metric-pill .metric-value#global-credits {
    color: var(--accent-green);
}

/* XP Tracker */
.xp-container {
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.xp-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.xp-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: 3px;
}

/* VIEW PANELS */
.view-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-primary);
}
.view-panel {
    display: none;
    height: 100%;
    padding: 32px;
    animation: fadeTransition 0.25s ease-out;
}
.view-panel.active {
    display: block;
}
.view-panel.active.flex-panel {
    display: flex !important;
}

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

.hidden {
    display: none !important;
}

.section-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    margin-bottom: 16px;
    margin-top: 24px;
}

/* ===== VIEW 1: DASHBOARD LAYOUT ===== */
.dashboard-hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius);
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.hero-text h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #fff;
}
.hero-text p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 500px;
}
.hero-stats {
    display: flex;
    gap: 16px;
}
.hero-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 120px;
}
.hero-stat-num {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--accent-green);
    display: block;
}
.hero-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

/* Daily Quests */
.quests-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.quest-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.quest-card.completed {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.03);
}
.quest-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-secondary);
}
.quest-card.completed .quest-status {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}
.quest-status.action-trigger {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    cursor: pointer;
    transition: var(--transition);
}
.quest-status.action-trigger:hover {
    background: var(--accent-gold);
    color: #000;
}
.quest-details h4 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 2px;
}
.quest-details p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Coverage Grid */
.progress-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.progress-card.clickable {
    cursor: pointer;
    transition: var(--transition);
}
.progress-card.clickable:hover {
    border-color: var(--accent-green);
    background: var(--bg-card-hover);
}
.progress-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.progress-card-header h4 {
    font-size: 14px;
    color: #fff;
}
.progress-pct {
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--accent-green);
}
.progress-track {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
}

/* ===== VIEW 2: MCQ MODULE ===== */
.level-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    max-width: 400px;
}
.level-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: var(--transition);
}
.level-tab.active {
    background: var(--accent-green);
    color: #fff;
}

.essay-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.filter-pill:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.filter-pill.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.chapter-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.chapter-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.chapter-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}
.chapter-count {
    font-size: 12px;
    color: var(--text-secondary);
}
.chapter-count strong {
    color: var(--accent-gold);
}
.chapter-progress {
    margin-top: 12px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}
/* Redesigned Chapter Cards (v2) */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.chapter-card-v2 {
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(26, 32, 44, 0.9) 100%);
    border: 1px solid var(--border);
    border-top: 2px solid var(--ch-color);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.chapter-card-v2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 10% 20%, var(--ch-color) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}
.chapter-card-v2:hover {
    transform: translateY(-4px);
    border-color: var(--ch-color);
    box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.4), 0 0 15px -2px var(--ch-color) 25;
}
.chapter-card-v2:hover::before {
    opacity: 0.05;
}
.ch-card-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}
.ch-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}
.ch-header-text {
    flex: 1;
}
.chapter-card-v2 .chapter-num {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.chapter-card-v2 .chapter-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 0;
}
.ch-subtopics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}
.ch-subtopic-chip {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 140px;
    overflow: hidden;
    transition: all 0.2s ease;
}
.ch-more-chip {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-weight: 600;
}
.ch-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}
.ch-progress-label {
    color: var(--text-secondary);
    font-weight: 600;
}
.chapter-card-v2 .chapter-progress {
    margin-top: 0;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    position: relative;
    z-index: 2;
}

.back-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.back-btn:hover {
    border-color: var(--accent-blue);
    color: #fff;
    background: rgba(59, 130, 246, 0.05);
}

.subtopic-grid {
    display: grid;
    gap: 14px;
}
.subtopic-card-v2 {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 32, 44, 0.6) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.subtopic-card-v2:hover {
    transform: translateX(4px);
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
}
.subtopic-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.subtopic-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.subtopic-count {
    font-size: 12px;
    color: var(--text-secondary);
}
.subtopic-perf-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    text-align: right;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Quiz view specific metrics */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
}
.quiz-progress {
    flex: 1;
}
#quiz-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.question-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.question-meta span {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.question-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.options-grid {
    display: grid;
    gap: 10px;
}
.option-btn {
    width: 100%;
    text-align: left;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}
.option-btn:hover:not(.disabled) {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.04);
}
.option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    background: var(--bg-primary);
}
.option-btn.correct {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.08) !important;
}
.option-btn.correct .option-letter {
    background: var(--accent-green);
    color: #fff;
    border-color: var(--accent-green);
}
.option-btn.wrong {
    border-color: var(--accent-red) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}
.option-btn.wrong .option-letter {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}
.option-btn.disabled {
    opacity: 0.6;
    cursor: default;
}

.explanation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
}
.explanation-header {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}
.explanation-header.correct-header { color: var(--accent-green); }
.explanation-header.wrong-header { color: var(--accent-red); }
.explanation-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-wrap;
}
.next-btn {
    width: 100%;
    background: var(--accent-green);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.next-btn:hover {
    background: var(--accent-green-hover);
}

/* Results view */
.results-card {
    max-width: 480px;
    margin: 40px auto;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
}
.results-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.results-score {
    font-size: 40px;
    font-weight: 800;
    color: var(--accent-gold);
    margin: 12px 0;
}
.results-breakdown {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}
.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.btn-primary {
    background-color: var(--accent-green);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary:hover { background-color: var(--accent-green-hover); }
.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--accent-green); color: #fff; }

/* ===== VIEW 3: ESSAY ARENA (SPLIT CANVAS) ===== */
.canvas-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: 100%;
    margin: -32px;
}
.chat-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.chat-bubble {
    display: flex;
    gap: 12px;
    max-width: 85%;
}
.chat-bubble.assistant { align-self: flex-start; }
.chat-bubble.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.avatar.user-avatar { background: var(--border-hover); }
.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
}
.chat-bubble.user .message-content {
    background: var(--accent-green-glow);
    border-color: rgba(16, 185, 129, 0.2);
}
.chat-input-container {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 16px;
}
.token-usage-bar {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}
.token-count {
    color: var(--accent-gold);
    font-weight: 700;
}
.chat-input-wrapper {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px 12px 6px 16px;
    align-items: center;
}
.chat-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
}
.send-btn {
    background: var(--accent-green);
    border: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 10px;
}

.writing-canvas {
    background: var(--bg-primary);
    padding: 32px 48px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow-y: auto;
}
.canvas-inner {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.editor-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}
.editor-textarea {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.8;
    padding-bottom: 80px;
}

/* Floating Toolbar */
.canvas-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(21, 28, 46, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 6px 12px;
    display: flex;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toolbar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}
.toolbar-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}
.toolbar-btn.primary {
    background: var(--accent-green);
    color: #fff;
}
.toolbar-btn.primary:hover {
    background: var(--accent-green-hover);
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.checklist-bullet {
    width: 5px; height: 5px;
    background: var(--accent-gold);
    border-radius: 50%;
}

/* ===== VIEW 4: TUTOR GRADING WORKSPACE ===== */
.tutor-layout {
    display: grid;
    grid-template-columns: 280px 1.2fr 0.8fr;
    gap: 24px;
    height: 100%;
}
.grading-essay-pane {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.pane-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pane-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}
.submission-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    flex: 1;
    overflow-y: auto;
}
.submission-content::selection {
    background: rgba(245, 158, 11, 0.35);
}
.highlighted-comment {
    background: rgba(245, 158, 11, 0.2);
    border-bottom: 2px solid var(--accent-gold);
    cursor: pointer;
}

.grading-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.score-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.score-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.score-box label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.score-box input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #fff;
    padding: 6px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    outline: none;
}
.score-box input:focus {
    border-color: var(--accent-gold);
}

.feedback-editor {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
    min-height: 120px;
}
.feedback-editor:focus {
    border-color: var(--accent-gold);
}

.btn-release {
    background: var(--accent-gold);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    transition: var(--transition);
}
.btn-release:hover {
    background: #d97706;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comment-item {
    background: rgba(245, 158, 11, 0.04);
    border-left: 3px solid var(--accent-gold);
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.comment-item-quote {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

/* POPOVER STYLE */
.comment-popover {
    position: absolute;
    background: #1e293b;
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-sm);
    padding: 12px;
    width: 260px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
}
.comment-popover textarea {
    width: 100%;
    height: 60px;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #fff;
    padding: 8px;
    font-size: 12px;
    resize: none;
    outline: none;
    margin-bottom: 8px;
    font-family: inherit;
}
.comment-popover button {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* Widget Upsell inside Blog embeds */
.widget-upsell {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}
.widget-upsell p {
    font-size: 13px;
    margin-bottom: 8px;
}
.upsell-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}
.upsell-desc {
    font-weight: 600;
    color: var(--accent-gold);
}
.upsell-btn {
    display: block;
    width: 100%;
    background: var(--accent-green);
    color: #fff;
    text-decoration: none;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    transition: var(--transition);
}
.upsell-btn:hover {
    background: var(--accent-green-hover);
}

/* ===== MODAL OVERLAYS ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(8, 13, 25, 0.85);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
}
.modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.25s ease-out;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    position: relative;
}
@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #fff;
}
.modal-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}
.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.modal-close:hover {
    color: #fff;
}
.modal-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 12px;
    font-size: 14px;
    outline: none;
    margin-bottom: 20px;
}
.modal-select:focus {
    border-color: var(--accent-green);
}
.modal-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 12px;
    font-size: 14px;
    outline: none;
    margin-bottom: 20px;
}
.modal-input:focus {
    border-color: var(--accent-green);
}

/* Radio Pill Group */
.radio-pill-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.radio-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
}
.radio-pill:hover {
    border-color: var(--accent-green);
}
.radio-pill input {
    accent-color: var(--accent-green);
}
.radio-pill span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Day tracker dots */
.streak-tracker-grid {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
}
.day-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}
.day-dot.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

/* ===== TOAST LOGS LOGGER ===== */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3000;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    min-width: 250px;
    max-width: 350px;
    animation: slideInToast 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.success { border-left-color: var(--accent-green); }
.toast.warning { border-left-color: var(--accent-gold); }
.toast.error { border-left-color: var(--accent-red); }

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* RESPONSIVE VIEWS */
@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .tutor-layout { grid-template-columns: 1fr; }
    .canvas-layout { grid-template-columns: 1fr; }
    .chat-sidebar { display: none; }
    .dashboard-three-column { grid-template-columns: 1fr; }
    .dashboard-two-column { grid-template-columns: 1fr; height: auto !important; }
}

/* ===== THREE-COLUMN DASHBOARD GRID ===== */
.dashboard-three-column {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr 1fr;
    gap: 24px;
    margin-top: 16px;
    align-items: start;
}

/* ===== TWO-COLUMN DASHBOARD GRID ===== */
.dashboard-two-column {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    margin-top: 16px;
    height: calc(100vh - 275px);
    align-items: stretch;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== PERSISTED RECENT STUDY ACTIVITY ===== */
.activity-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
}

.activity-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.activity-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.activity-item:hover {
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.02);
}

.activity-info h4 {
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}

.activity-info span {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
}

.activity-score {
    text-align: right;
}

.activity-score-val {
    font-size: 15px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--accent-gold);
    display: block;
}

.activity-score-pct {
    font-size: 10px;
    color: var(--text-secondary);
}

/* ===== ACHIEVEMENTS & BADGES SHELF ===== */
.achievements-shelf {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 30px;
    width: fit-content;
}

.shelf-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-item {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0.3;
    filter: grayscale(100%);
    cursor: help;
    transition: var(--transition);
}

.badge-item.active {
    opacity: 1;
    filter: none;
    background: linear-gradient(135deg, var(--bg-card), rgba(245, 158, 11, 0.1));
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold-glow);
}

.badge-item.active:hover {
    transform: scale(1.15) rotate(5deg);
}

/* ===== CIRCULAR PROGRESS ringS ===== */
.circle-chart {
    position: relative;
    width: 65px;
    height: 65px;
}

.circular-chart-svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 3.2;
}

.circle {
    fill: none;
    stroke-width: 3.2;
    stroke-linecap: round;
    animation: progressRing 1.2s ease-out forwards;
}

@keyframes progressRing {
    0% { stroke-dasharray: 0 100; }
}

.circular-chart-svg.green .circle {
    stroke: var(--accent-green);
}

.circle-val {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 13px;
    color: #fff;
}

/* ===== GRADE PREDICTOR ===== */
.grade-predictor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.grade-meter {
    height: 10px;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-gold), var(--accent-green));
    border-radius: 5px;
    position: relative;
}

.grade-meter-pointer {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 3px solid var(--bg-primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
    transition: left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.grade-ranges {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.grade-ranges span.active-grade {
    color: var(--accent-green);
    font-size: 12px;
    font-weight: 800;
    text-shadow: 0 0 6px var(--accent-green-glow);
}

.grade-help-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===== WEEKLY LEADERBOARD ===== */
.leaderboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.01);
    border: 1px solid transparent;
    transition: var(--transition);
}

.leaderboard-item.active-user {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.2);
}

.rank-num {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 14px;
    color: var(--text-secondary);
    width: 16px;
    text-align: center;
}

.leaderboard-item:nth-child(1) .rank-num { color: var(--accent-gold); }
.leaderboard-item:nth-child(2) .rank-num { color: #cbd5e1; }
.leaderboard-item:nth-child(3) .rank-num { color: #b45309; }

.leader-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.leader-avatar.user-avatar-lb {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
}

.leader-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.leader-xp {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12px;
    color: var(--accent-green);
}

/* ===== DIAGRAM WARNING NOTICE BANNER ===== */
.diagram-notice {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    animation: slideDownNotice 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

@keyframes slideDownNotice {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notice-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notice-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notice-content strong {
    color: var(--accent-gold);
    font-size: 13px;
}

.notice-content span {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notice-link-btn {
    background: var(--accent-gold);
    color: #000;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    transition: var(--transition);
}

/* ===== WEAKNESS TARGETING WIDGET ===== */
.weakness-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weakness-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.weakness-item:hover {
    border-color: rgba(239, 68, 68, 0.4);
}

.weakness-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.weakness-info h4 {
    font-size: 12px;
    color: #fff;
    font-weight: 700;
}

.weakness-info span {
    font-size: 10px;
    color: var(--text-secondary);
}

.weakness-score-badge {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(239,68,68,0.3);
    margin-right: 12px;
}

.booster-quiz-btn {
    background: var(--accent-red);
    color: #fff;
    border: none;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

/* ===== INTERACTIVE SITE TOUR ===== */
.nav-tour-btn {
    background: transparent;
    border: 1px dashed var(--accent-gold);
    color: var(--accent-gold);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-left: 8px;
    box-shadow: 0 0 8px var(--accent-gold-glow);
}

.nav-tour-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    border-style: solid;
    transform: translateY(-1px);
}

.tour-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: transparent;
    backdrop-filter: none;
    z-index: 9999;
    display: none;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.tour-overlay.active {
    display: block;
}

.tour-highlight-box {
    position: absolute;
    border: 3.5px solid var(--accent-gold);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 9999px rgba(10, 15, 30, 0.65), 0 0 20px var(--accent-gold);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 10000;
}

.tour-popover {
    position: absolute;
    width: 320px;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    animation: tourPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

@keyframes tourPop {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-popover-header h3 {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

#tour-step-indicator {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.tour-popover-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.tour-btn-skip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.tour-btn-skip:hover {
    color: var(--accent-red);
}

.tour-nav-btns {
    display: flex;
    gap: 8px;
}

.tour-btn-nav {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tour-btn-nav:hover {
    border-color: var(--border-hover);
}

.tour-btn-primary {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 800;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

/* ===== COMPACT WIDGET MODE (FOR INLINE WIX EMBEDS) ===== */
body.widget-mode {
    background: transparent !important;
}

body.widget-mode .sidebar {
    display: none !important;
}

body.widget-mode .top-nav {
    display: none !important;
}

body.widget-mode .app-layout {
    display: block !important;
    width: 100% !important;
    height: auto !important;
}

body.widget-mode .main-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    background: transparent !important;
    width: 100% !important;
}

body.widget-mode .view-content {
    padding: 0 !important;
    width: 100% !important;
}

body.widget-mode .view-panel {
    padding: 0 !important;
    background: transparent !important;
    width: 100% !important;
}

body.widget-mode #mcq-quit-quiz {
    display: none !important;
}

body.widget-mode #mcq-back-chapters {
    display: none !important;
}

body.widget-mode .quiz-header {
    border-bottom: none !important;
    margin-bottom: 12px !important;
    padding-bottom: 0 !important;
}

/* ===== STUDY HUB VIEW PANELS & GRIDS ===== */
#panel-study-hub {
    padding: 32px;
}
.study-hub-header {
    margin-bottom: 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius);
}
.topic-select-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topic-select-wrapper label {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #fff;
    font-size: 15px;
}
.premium-select {
    flex: 1;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}
.premium-select:hover, .premium-select:focus {
    border-color: var(--accent-green);
    outline: none;
}
.study-hub-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}
.study-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition);
}
.study-card:hover {
    border-color: var(--border-hover);
}
.card-header-with-badge {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.card-badge {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px;
    border-radius: 4px;
}
.video-badge { background-color: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.audio-badge { background-color: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.info-badge { background-color: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.study-card h3 {
    font-size: 16px;
    color: #fff;
}
.video-player-wrapper {
    flex: 1;
    min-height: 380px;
    background-color: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}
.mock-video-player {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.player-overlay {
    text-align: center;
    padding: 32px;
    max-width: 500px;
}
.player-play-icon {
    font-size: 48px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 12px;
}
.player-placeholder-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
    display: block;
}
.study-hub-side-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.podcast-player-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.podcast-mock-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.podcast-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.audio-element-container {
    width: 100%;
}
.player-empty-state {
    color: var(--text-muted);
    font-size: 12px;
}
.infographic-viewer {
    flex: 1;
    min-height: 180px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.concept-map-placeholder {
    text-align: center;
    padding: 16px;
}
.concept-map-placeholder p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0 16px 0;
}
.btn-primary-sm {
    background-color: var(--accent-green);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary-sm:hover {
    background-color: var(--accent-green-hover);
}


/* ===== PERFORMANCE ANALYTICS PANEL ===== */

.analytics-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.analytics-panel-header h2 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.analytics-panel-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Summary Stats Strip */
.analytics-summary-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.analytics-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 100px;
}
.analytics-big-num {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.1;
}
.analytics-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 2px;
}
.analytics-drill-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: 10px 20px;
    font-size: 13px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    animation: pulse-glow 2s infinite;
}
.analytics-drill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Section */
.analytics-section {
    margin-bottom: 28px;
}
.analytics-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Table */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.analytics-table thead tr {
    background: rgba(255,255,255,0.04);
}
.analytics-table th {
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.analytics-row {
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.analytics-row:last-child { border-bottom: none; }
.analytics-row:hover {
    background: rgba(255,255,255,0.04);
}
.analytics-subtopic-cell {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 40%;
}
.analytics-status-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.analytics-subtopic-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.analytics-chapter-tag {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 500;
}
.analytics-bar-cell {
    padding: 12px 16px;
    width: 35%;
}
.analytics-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.analytics-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.analytics-acc-cell {
    padding: 12px 8px;
    font-size: 14px;
    font-weight: 800;
    width: 10%;
    font-family: var(--font-heading);
}
.analytics-attempted-cell {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    width: 15%;
    font-weight: 500;
}

/* Empty state */
.analytics-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
}
.analytics-empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
}
.analytics-empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 320px;
}

.analytics-footnote {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
    padding-bottom: 24px;
}

/* ===== WEAKNESS RADAR IMPROVEMENTS ===== */
.weakness-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}
.weak-areas-drill-btn {
    width: 100%;
    padding: 10px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    margin-bottom: 8px;
    transition: var(--transition);
}
.weak-areas-drill-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

/* ===== ESSAY PRACTICE HUB SELECTOR ===== */
.essay-selection-container {
    padding: 32px;
}

.essay-chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.essay-chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    cursor: pointer;
}

.essay-chapter-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    background: rgba(255,255,255,0.01);
}

/* Prompt selector tabs inside essay cards */
.essay-prompt-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.prompt-tab {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-tab:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.08);
}

.prompt-tab.active {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

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

.card-header h3 {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
}

.status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-not-started {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
}

.status-draft {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

.status-graded {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.card-body {
    flex: 1;
    margin-bottom: 16px;
}

.prompt-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    font-style: italic;
}

.criteria-preview {
    font-size: 11px;
    color: var(--text-muted);
}

.criteria-preview strong {
    display: block;
    margin-bottom: 4px;
}

.criteria-preview ul {
    padding-left: 12px;
    margin: 0;
}

.criteria-preview li {
    margin-bottom: 2px;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
}

.btn-write-essay {
    width: 100%;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
}

.ib-notes-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ib-notes-btn:hover {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.05);
    transform: translateY(-1px);
}

.ib-notes-btn span.arrow {
    color: var(--accent-green);
    font-weight: 800;
}


