/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary:    #0B1120;
    --bg-secondary:  #111827;
    --bg-card:       #1A2540;
    --bg-elevated:   #1F2D4A;
    --primary:       #10B981;
    --primary-hover: #059669;
    --accent:        #3B82F6;
    --accent-hover:  #2563EB;
    --teacher:       #F59E0B;
    --teacher-hover: #D97706;
    --student:       #10B981;
    --student-hover: #059669;
    --success:       #10B981;
    --danger:        #EF4444;
    --warning:       #F59E0B;
    --text-primary:  #F1F5F9;
    --text-secondary:#94A3B8;
    --text-muted:    #FFFFFF;
    --text-white:    #FFFFFF;
    --border:        #1E3050;
    --border-hover:  #2E4570;
    --radius-sm:     6px;
    --radius-md:     12px;
    --radius-lg:     18px;
    --shadow-md:     0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg:     0 8px 40px rgba(0,0,0,0.5);
}

/* ===== RESET & BASE ===== */
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

* { box-sizing: border-box; }

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Heebo', 'Arial Hebrew', 'David', Arial, system-ui, sans-serif;
    min-height: 100vh;
    margin: 0;
}

.text-muted { color: #fff !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ===== NAVBAR ===== */
.navbar {
    background: rgba(17, 24, 39, 0.97) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    color: var(--primary) !important;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.3px;
}
.navbar-brand:hover { color: var(--primary-hover) !important; }

.nav-link {
    color: var(--text-secondary) !important;
    padding: 0.45rem 0.75rem !important;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-link:hover, .nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(16, 185, 129, 0.1);
}

/* ===== CLASSROOM TABS ===== */
.cc-tabs { border-bottom-color: var(--border) !important; }
.cc-tabs .nav-link {
    color: var(--text-secondary) !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    border-bottom: none !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    margin-left: 0.25rem;
}
.cc-tabs .nav-link:hover {
    color: #fff !important;
    background: rgba(16,185,129,0.12) !important;
    border-color: var(--border-hover) !important;
}
.cc-tabs .nav-link.active {
    color: #fff !important;
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    border-bottom-color: var(--bg-card) !important;
}
.tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px;
    background: rgba(16,185,129,0.15);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.72rem; font-weight: 700;
    padding: 0 5px;
    margin-right: 0.35rem;
}
.cc-tabs .nav-link.active .tab-count { background: rgba(16,185,129,0.25); }

.nav-user-info {
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-role-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}
.badge-teacher { background: rgba(245,158,11,0.15); color: var(--teacher); border: 1px solid rgba(245,158,11,0.3); }
.badge-student { background: rgba(16,185,129,0.15); color: var(--primary); border: 1px solid rgba(16,185,129,0.3); }

.nav-logout { color: var(--text-muted) !important; }
.nav-logout:hover { color: var(--danger) !important; background: rgba(239,68,68,0.08) !important; }

.btn-nav-register {
    color: var(--primary) !important;
    border: 1px solid rgba(16,185,129,0.4);
    border-radius: var(--radius-sm) !important;
    margin-inline-start: 0.5rem;
}
.btn-nav-register:hover { background: rgba(16,185,129,0.1) !important; }

.navbar-toggler { border-color: var(--border); }
.navbar-toggler-icon { filter: invert(0.7); }

/* ===== BUTTONS ===== */
.btn { border-radius: var(--radius-sm); font-weight: 600; transition: all 0.2s; }

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

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

.btn-teacher { background: var(--teacher); border-color: var(--teacher); color: #1a1a1a; }
.btn-teacher:hover { background: var(--teacher-hover); border-color: var(--teacher-hover); color: #1a1a1a; }

.btn-student { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-student:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

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

.btn:focus { box-shadow: 0 0 0 0.2rem rgba(16,185,129,0.3); }

/* ===== FORM CONTROLS ===== */
.form-control, .form-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}
::placeholder { color: #64748B; opacity: 1; }
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(16,185,129,0.2);
}
.form-control::placeholder, textarea::placeholder { color: #64748B; opacity: 1; }
.form-label { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 0.3rem; font-weight: 500; }

.input-group-text {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-secondary);
}

/* ===== ALERTS ===== */
.alert-danger { background: rgba(239,68,68,0.1); border-color: var(--danger); color: #FCA5A5; }

/* ===== MAIN CONTENT ===== */
.main-content { min-height: calc(100vh - 130px); }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== TOASTS ===== */
.site-toast {
    position: fixed;
    top: 80px;
    inset-inline-start: 20px;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: slideInToast 0.3s ease;
    max-width: 350px;
    font-size: 0.9rem;
    border: 1px solid;
}
.site-toast-success { background: rgba(16,185,129,0.12); border-color: var(--success); color: #6EE7B7; }
.site-toast-error   { background: rgba(239,68,68,0.12); border-color: var(--danger); color: #FCA5A5; }
.toast-fade-out { animation: slideOutToast 0.4s ease forwards; }

@keyframes slideInToast {
    from { transform: translateX(-120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutToast {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-120%); opacity: 0; }
}

/* ===== HERO SECTION ===== */
.hero-section {
    padding: 5rem 0 4rem;
    background: radial-gradient(ellipse at 50% -20%, rgba(16,185,129,0.15) 0%, transparent 65%);
}

.hero-badge {
    display: inline-block;
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.3);
    color: var(--primary);
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 1.25rem 0 1rem;
    color: var(--text-primary);
}
@media (max-width: 768px) { .hero-title { font-size: 2rem; } }

.hero-highlight {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.hero-actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* ===== FEATURES SECTION ===== */
.features-section { padding: 3rem 0; }

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
    height: 100%;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-4px); }

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.5rem;
    color: var(--primary);
}

.feature-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; margin: 0; }

/* ===== ROLES SECTION ===== */
.roles-section { padding: 2rem 0 4rem; }

.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}
.role-card:hover { transform: translateY(-4px); }
.role-teacher:hover { border-color: var(--teacher); }
.role-student:hover { border-color: var(--primary); }

.role-card-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.75rem;
}
.role-teacher .role-card-icon { background: rgba(245,158,11,0.12); color: var(--teacher); border: 1px solid rgba(245,158,11,0.25); }
.role-student .role-card-icon { background: rgba(16,185,129,0.12); color: var(--primary); border: 1px solid rgba(16,185,129,0.25); }

.role-card h3 { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 1.25rem; }

.role-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.role-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.role-features li i { color: var(--primary); font-size: 0.8rem; flex-shrink: 0; }
.role-teacher .role-features li i { color: var(--teacher); }

/* ===== AUTH PAGES ===== */
.auth-container {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 0.75rem; display: block; }
.auth-header h2 { font-weight: 800; font-size: 1.6rem; margin-bottom: 0.25rem; }
.auth-header p { color: var(--text-secondary); margin: 0; }

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.link-muted { color: var(--text-muted); font-size: 0.85rem; }
.link-muted:hover { color: var(--text-secondary); }
.link-primary { color: var(--primary); }
.link-primary:hover { color: var(--primary-hover); }
.fw-600 { font-weight: 600; }

/* ===== ROLE SELECTOR (Register) ===== */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.role-btn i { font-size: 1.5rem; }
.role-btn span { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.role-btn small { font-size: 0.75rem; color: var(--text-muted); }
.role-btn:hover { border-color: var(--primary); background: rgba(16,185,129,0.06); }
.role-btn.active {
    border-color: var(--primary);
    background: rgba(16,185,129,0.1);
    color: var(--primary);
}
.role-btn.active i { color: var(--primary); }

/* ===== DASHBOARD CARDS (used in Phases 2 & 3) ===== */
.dashboard-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.page-title { font-size: 1.75rem; font-weight: 800; margin: 0; }
.page-subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-top: 0.25rem; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-icon { font-size: 1.5rem; color: var(--primary); margin-bottom: 0.5rem; }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h4 { color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ===== BADGES ===== */
.badge { font-weight: 600; }
code { color: var(--primary); background: rgba(16,185,129,0.1); padding: 0.15rem 0.5rem; border-radius: 4px; font-family: 'Courier New', monospace; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.25s ease; }

/* ===== TEACHER THEME ===== */
.text-teacher { color: var(--teacher); }
.btn-outline-teacher { border-color: var(--teacher); color: var(--teacher); background: transparent; }
.btn-outline-teacher:hover { background: var(--teacher); color: #1a1a1a; }

/* ===== CLASSROOM CARDS ===== */
.classroom-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}
.classroom-card:hover { border-color: var(--teacher); transform: translateY(-3px); }

.classroom-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.classroom-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.25);
    display: flex; align-items: center; justify-content: center;
    color: var(--teacher);
    font-size: 1.1rem;
}

.classroom-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

.classroom-code-block {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
}
.classroom-code-block:hover { border-color: var(--teacher); background: rgba(245,158,11,0.05); }
.classroom-code-block.code-copied { border-color: var(--success); background: rgba(16,185,129,0.08); }

.code-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.code-value { font-size: 1.3rem; font-weight: 800; letter-spacing: 4px; color: var(--teacher); font-family: 'Courier New', monospace; }
.code-copy-icon { color: var(--text-muted); font-size: 0.9rem; }

.classroom-meta { display: flex; gap: 1rem; color: var(--text-muted); font-size: 0.85rem; }

/* ===== BIG CODE BLOCK (classroom detail) ===== */
.big-code-block {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0.5rem 0;
}
.big-code-block:hover { border-color: var(--teacher); background: rgba(245,158,11,0.05); }
.big-code-block.code-copied { border-color: var(--success); }
.big-code { display: block; font-size: 2.5rem; font-weight: 900; letter-spacing: 8px; color: var(--teacher); font-family: 'Courier New', monospace; }
.big-code-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ===== BACK BUTTON ===== */
.btn-back {
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

/* ===== DELETE BUTTON ICON ===== */
.btn-icon-danger {
    background: none; border: none; padding: 0.35rem 0.5rem;
    color: var(--text-muted); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.2s;
    font-size: 0.9rem;
}
.btn-icon-danger:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ===== TOPIC LIST ===== */
.topic-list { display: flex; flex-direction: column; gap: 0.5rem; }
.topic-item {
    display: flex; align-items: center; gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}
.topic-order {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(16,185,129,0.12);
    color: var(--primary);
    font-size: 0.8rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.topic-info { flex: 1; }
.topic-title { font-weight: 600; font-size: 0.9rem; color: #fff; }
.topic-due { display: block; font-size: 0.75rem; color: #fff; }
.topic-q-count { font-size: 0.8rem; color: #fff; white-space: nowrap; }

/* ===== CLASSROOM ACCORDION (topics + questions) ===== */
.cc-accordion { display: flex; flex-direction: column; gap: 0.5rem; }

.cc-accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}

.topic-accordion-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.topic-accordion-header:hover { background: rgba(16,185,129,0.08); }

.accordion-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}
.topic-accordion-header[aria-expanded="true"] .accordion-chevron { transform: rotate(180deg); }

.accordion-body { padding: 1rem; background: var(--bg-card); }

/* drag handle */
.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    padding: 0.2rem 0.3rem;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.drag-handle:hover { opacity: 1; }

/* question rows */
.question-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    margin-bottom: 0.4rem;
    transition: border-color 0.2s;
}
.question-item:hover { border-color: var(--border-hover); }

.question-num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(99,102,241,0.15);
    color: #818cf8;
    font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.question-preview { flex: 1; min-width: 0; }
.question-text-preview {
    font-size: 0.875rem; font-weight: 500;
    white-space: pre-wrap; word-break: break-word;
    color: var(--text-primary);
}
.question-actions { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }

/* edit icon button */
.btn-icon-edit {
    background: none; border: none; padding: 0.35rem 0.5rem;
    color: var(--text-muted); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.2s; font-size: 0.9rem;
    text-decoration: none; display: inline-flex; align-items: center;
}
.btn-icon-edit:hover { color: var(--primary); background: rgba(16,185,129,0.1); }

/* question badges */
.q-badge {
    font-size: 0.7rem; padding: 0.15rem 0.5rem;
    border-radius: 999px; font-weight: 500;
}
.q-badge-sub { background: rgba(99,102,241,0.15); color: #818cf8; }
.q-badge-img { background: rgba(245,158,11,0.15); color: var(--teacher); }

/* ===== STUDENT TABLE ===== */
.cc-table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(16,185,129,0.06);
    --bs-table-striped-bg: transparent;
    background: transparent;
}
.cc-table th {
    color: #fff; font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 1px; border-color: var(--border); font-weight: 600;
    background: var(--bg-secondary);
}
.cc-table td { border-color: var(--border); vertical-align: middle; color: #fff; background: transparent; }
.cc-table tbody tr { background: transparent; }
.cc-table tbody tr:hover td { background: rgba(16,185,129,0.06); }
.table-responsive { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }

.student-avatar-name { display: flex; align-items: center; gap: 0.6rem; }
.student-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(16,185,129,0.15);
    color: var(--primary);
    font-size: 0.85rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ===== COMING SOON BADGE ===== */
.coming-soon-badge {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.3);
    color: #818CF8;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

/* ===== STUDENT THEME ===== */
.text-student { color: var(--primary); }

/* ===== STUDENT CLASSROOM CARDS ===== */
.student-classroom-card-link { text-decoration: none; color: inherit; display: block; height: 100%; }
.student-classroom-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}
.student-classroom-card:hover { border-color: var(--primary); transform: translateY(-3px); }

.student-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.student-card-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.25);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
}

.student-code-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.student-card-teacher {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ===== JOIN CLASSROOM FORM ===== */
.code-input {
    font-size: 1.75rem !important;
    font-weight: 800;
    letter-spacing: 6px;
    text-align: center;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    height: 64px;
}

.code-status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid;
}
.code-status-checking { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.3); color: #93C5FD; }
.code-status-valid    { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.3); color: #6EE7B7; }
.code-status-invalid  { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); color: #FCA5A5; }
.code-status-warn     { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #FCD34D; }

/* ===== INFO BOX ===== */
.info-box {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===== TOPIC STUDENT CARDS ===== */
.topic-card-link { text-decoration: none; color: inherit; display: block; height: 100%; }
.topic-student-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}
.topic-student-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.topic-student-card.topic-complete { border-color: rgba(16,185,129,0.4); }

.topic-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.topic-student-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.25);
    display: flex; align-items: center; justify-content: center;
    color: #818CF8;
    font-size: 1rem;
}
.topic-student-icon.icon-complete {
    background: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.3);
    color: var(--primary);
}

.topic-due-badge {
    font-size: 0.72rem;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.3);
    color: #FCD34D;
    border-radius: 20px;
    padding: 0.15rem 0.5rem;
}

.topic-student-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.topic-progress-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.topic-progress-pct { font-weight: 600; }
.topic-progress-bar { height: 6px; border-radius: 3px; background: var(--bg-secondary); }

/* ===== STUDENT QUESTION LIST (Topic view) ===== */
.question-list-student { display: flex; flex-direction: column; gap: 0.5rem; }

.question-student-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.15s;
}
.question-student-row:hover { border-color: var(--primary); transform: translateX(-3px); color: inherit; }
.question-student-row.status-solved { border-right: 3px solid var(--primary); }
.question-student-row.status-attempted { border-right: 3px solid #F59E0B; }

.question-student-num {
    min-width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.question-student-body { flex: 1; min-width: 0; }
.question-student-text {
    font-weight: 500;
    color: var(--text-primary);
    white-space: pre-line;
}

.question-student-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.question-student-status.status-solved { color: var(--primary); }
.question-student-status.status-attempted { color: #F59E0B; }

/* ===== QUESTION DISPLAY ===== */
.question-display-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.7;
    margin: 0;
    white-space: pre-line;
}

.circuit-display-img {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.img-zoomable {
    cursor: zoom-in;
    transition: opacity 0.15s;
}
.img-zoomable:hover {
    opacity: 0.85;
}

/* ===== LIGHTBOX ===== */
#imgLightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.88);
    align-items: center;
    justify-content: center;
}
#imgLightbox.open {
    display: flex;
}
#imgLightbox img {
    width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    object-fit: contain;
}
#imgLightboxClose {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
#imgLightboxClose:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== SUB ANSWER ROWS ===== */
.sub-answer-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.sub-answer-row.sub-solved {
    background: rgba(16,185,129,0.06);
    border-color: rgba(16,185,129,0.25);
}

/* ===== SUBMITTED ANSWER DISPLAY ===== */
.submitted-answer-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    direction: rtl;
}

/* ===== ALERT WRONG ANSWER ===== */
.alert-answer-wrong {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    color: #FCA5A5;
    font-size: 0.875rem;
}

/* ===== SOLVED STATE ===== */
.solved-check-circle {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(16,185,129,0.15);
    border: 2px solid rgba(16,185,129,0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    color: var(--primary);
}

/* ===== ATTEMPT HISTORY ===== */
.attempt-history { display: flex; flex-direction: column; gap: 0.4rem; }
.attempt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}
.attempt-row.attempt-correct { background: rgba(16,185,129,0.08); }
.attempt-row.attempt-wrong   { background: rgba(239,68,68,0.06); }
.attempt-answer { color: var(--text-secondary); font-family: monospace; }

/* ===== SYMBOL PICKER ===== */
.symbol-picker {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.symbol-picker-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.symbol-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.symbol-group {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
}

.symbol-group-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
    margin-right: 0.1rem;
    white-space: nowrap;
}

.sym-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: 'Courier New', monospace;
    padding: 0;
    line-height: 1;
}
.sym-btn:hover {
    background: rgba(16,185,129,0.12);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== TOPIC COPY PICKER ===== */
.topic-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 340px;
    overflow-y: auto;
    padding-left: 0.25rem;
}

.topic-option-group-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0 0.2rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}
.topic-option-group-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.topic-option-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.topic-option-row:hover { border-color: var(--primary); background: rgba(16,185,129,0.05); }
.topic-option-row input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.topic-option-row:has(input:checked) {
    border-color: var(--primary);
    background: rgba(16,185,129,0.08);
}

.topic-option-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.topic-option-title { font-weight: 600; color: var(--text-primary); }
.topic-option-count { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

/* ===== DRAWING CANVAS ===== */
.cc-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    margin-bottom: 1rem;
    direction: ltr;
}

/* Toolbar */
.cc-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.cc-tool-group { display: flex; align-items: center; gap: 0.2rem; }
.cc-tb-divider { width: 1px; height: 26px; background: var(--border); margin: 0 0.3rem; }

.cc-tool-btn, .cc-action-btn, .cc-size-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0;
}
.cc-tool-btn:hover, .cc-action-btn:hover, .cc-size-btn:hover {
    background: rgba(16,185,129,0.1); border-color: var(--primary); color: var(--primary);
}
.cc-tool-btn.active, .cc-size-btn.active {
    background: var(--primary); border-color: var(--primary); color: #fff;
}
.cc-action-btn { width: auto; padding: 0 0.5rem; }
.cc-action-danger { color: #EF4444; }
.cc-action-danger:hover { background: rgba(239,68,68,0.1); border-color: #EF4444; color: #EF4444; }

.cc-color-swatch {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}
.cc-color-swatch.active, .cc-color-swatch:hover { border-color: #fff; transform: scale(1.15); }
.cc-color-picker {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); cursor: pointer;
    padding: 2px; background: var(--bg-card);
}

/* Body */
.cc-body {
    display: flex;
    gap: 0;
}
.cc-canvas-area {
    flex: 1;
    min-width: 0;
    position: relative;
    background: #fff;
}
.cc-canvas-area canvas { display: block; }
.cc-empty-hint {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #94A3B8; font-size: 0.9rem; pointer-events: none;
    opacity: 1; transition: opacity 0.2s;
}

/* Symbol panel */
.cc-sym-panel {
    width: 130px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 0.5rem;
    overflow-y: auto;
    max-height: 320px;
}
.cc-sym-section { margin-bottom: 0.5rem; }
.cc-sym-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
}
.cc-sym-btn {
    display: block;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    font-size: 0.72rem;
    text-align: right;
    cursor: pointer;
    margin-bottom: 0.2rem;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-sym-btn:hover, .cc-sym-btn.active {
    background: rgba(16,185,129,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Drawing canvas responsive — sub-questions have less space, so switch earlier */
@media (max-width: 767px) {
    .sub-answer-row .cc-body { flex-direction: column; }
    .sub-answer-row .cc-sym-panel {
        width: 100%;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.4rem;
    }
    .sub-answer-row .cc-sym-section {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.2rem;
        margin-bottom: 0.2rem;
    }
    .sub-answer-row .cc-sym-label {
        width: 100%;
        margin-bottom: 0.1rem;
        padding-bottom: 0;
        border-bottom: none;
    }
    .sub-answer-row .cc-sym-btn { width: auto; display: inline-block; }
    .sub-answer-row .cc-toolbar { gap: 0.2rem; padding: 0.35rem 0.5rem; }
    .sub-answer-row .cc-tb-divider { display: none; }
    .sub-answer-row .cc-tool-btn,
    .sub-answer-row .cc-action-btn,
    .sub-answer-row .cc-size-btn { width: 28px; height: 28px; font-size: 0.78rem; }
    .sub-answer-row .cc-color-swatch { width: 22px; height: 22px; }
    .sub-answer-row .cc-color-picker { width: 28px; height: 28px; }
}

/* Drawing canvas responsive */
@media (max-width: 575px) {
    .cc-body { flex-direction: column; }
    .cc-sym-panel {
        width: 100%;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.4rem;
    }
    .cc-sym-section {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.2rem;
        margin-bottom: 0.2rem;
    }
    .cc-sym-label {
        width: 100%;
        margin-bottom: 0.1rem;
        padding-bottom: 0;
        border-bottom: none;
    }
    .cc-sym-btn { width: auto; display: inline-block; }
    .cc-toolbar { gap: 0.2rem; padding: 0.35rem 0.5rem; }
    .cc-tb-divider { display: none; }
    .cc-tool-btn, .cc-action-btn, .cc-size-btn { width: 28px; height: 28px; font-size: 0.78rem; }
    .cc-color-swatch { width: 22px; height: 22px; }
    .cc-color-picker { width: 28px; height: 28px; }
}

/* ===== DRAWING TOGGLE ===== */
.cc-drawing-toggle { border: none; }
.cc-drawing-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    list-style: none;
    user-select: none;
    transition: color 0.15s, border-color 0.15s;
}
.cc-drawing-toggle-btn:hover { color: var(--primary); border-color: var(--primary); }
.cc-drawing-toggle[open] .cc-drawing-toggle-btn { color: var(--primary); border-color: var(--primary); }

/* ===== PROGRESS TABLE ===== */

/* Collapsible topic sections */
.topic-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.topic-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    text-align: right;
    gap: 0.75rem;
    transition: background 0.15s;
}
.topic-section-header:hover { background: rgba(16,185,129,0.1); }
.topic-section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}
.topic-section-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.1rem 0.5rem;
}
.topic-section-chevron {
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.topic-section.collapsed .topic-section-chevron {
    transform: rotate(-90deg);
}
.topic-section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.25s ease;
}
.topic-section.collapsed .topic-section-body {
    max-height: 0;
}

.progress-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.topic-section-body .progress-table-wrap {
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
}
.progress-table {
    border-collapse: collapse;
    min-width: 100%;
    font-size: 0.82rem;
    background: var(--bg-card);
}
.progress-table th, .progress-table td {
    border: 1px solid var(--border);
    padding: 0;
    text-align: center;
    white-space: nowrap;
}
.prog-topic-row th { background: var(--bg-secondary); }
.prog-topic-header {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--primary) !important;
}
.prog-q-row th { background: var(--bg-secondary); }
.prog-q-header {
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 52px;
}
.prog-solve-rate {
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 1px;
    border-radius: 3px;
    padding: 0 2px;
}
.rate-good  { color: #10B981; }
.rate-mid   { color: #F59E0B; }
.rate-low   { color: #EF4444; }

.prog-name-col  { min-width: 160px; text-align: right !important; padding: 0.4rem 0.75rem !important; background: var(--bg-secondary); }
.prog-name-cell { text-align: right !important; padding: 0.35rem 0.6rem !important; }
.prog-student-name { font-size: 0.82rem; font-weight: 600; }
.prog-summary-col  { min-width: 90px; background: var(--bg-secondary); }
.prog-summary-cell { padding: 0.35rem 0.5rem !important; }
.prog-summary-text { font-size: 0.8rem; font-weight: 700; margin-bottom: 3px; }
.prog-mini-bar { height: 4px; border-radius: 2px; }

.prog-cell { padding: 0.25rem !important; }
.prog-cell-link { display: flex; align-items: center; justify-content: center; padding: 0.25rem; text-decoration: none; }
.prog-cell-link:hover .prog-cell-dot { filter: brightness(1.3); transform: scale(1.15); }
.prog-cell-dot { transition: transform 0.1s, filter 0.1s; }
.prog-cell-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    font-size: 0.7rem;
}
.prog-solved   { background: rgba(16,185,129,0.15); color: #10B981; }
.prog-pending  { background: rgba(245,158,11,0.15); color: #F59E0B; }
.prog-attempted{ background: rgba(239,68,68,0.12);  color: #EF4444; }
.prog-none     { background: var(--bg-secondary);    color: #CBD5E1; }

.progress-legend-item {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.78rem; color: var(--text-secondary);
}
.prog-dot {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}

/* ===== STUDENT QUESTION DETAIL ===== */
.attempt-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.6rem;
}
.attempt-correct { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.05); }
.attempt-pending { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.05); }
.attempt-wrong   { border-color: rgba(239,68,68,0.3);  background: rgba(239,68,68,0.04); }
.attempt-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.attempt-try  { font-weight: 700; font-size: 0.82rem; }
.attempt-status { font-size: 0.8rem; }
.attempt-time { font-size: 0.75rem; margin-right: auto; }
.attempt-answer {
    font-size: 0.9rem; font-weight: 600;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 0.3rem 0.6rem;
    display: inline-block;
}
.worktext-pre {
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* ===== PHASE 7 — POLISH ===== */

/* Pending review badge */
.pending-badge {
    position: absolute;
    top: -7px; right: -7px;
    background: #EF4444; color: #fff;
    font-size: 0.65rem; font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    pointer-events: none;
}

/* Drag handles */
.drag-handle {
    color: #CBD5E1; cursor: grab; padding: 0 4px;
    display: inline-flex; align-items: center;
    font-size: 0.8rem; flex-shrink: 0;
    transition: color 0.15s;
}
.drag-handle:hover { color: var(--primary); }
.drag-handle:active { cursor: grabbing; }

/* Due date urgency */
.topic-student-card.topic-overdue {
    border-color: #FCA5A5;
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(239,68,68,0.06));
}
.topic-student-card.topic-urgent {
    border-color: #FCD34D;
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(245,158,11,0.06));
}
.topic-due-badge.due-overdue {
    background: rgba(239,68,68,0.12); color: #EF4444;
    border: 1px solid rgba(239,68,68,0.25);
}
.topic-due-badge.due-urgent {
    background: rgba(245,158,11,0.12); color: #D97706;
    border: 1px solid rgba(245,158,11,0.25);
}

/* ===== TEACHER REVIEW ===== */
.review-card { border: 1px solid var(--border); }
.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.review-drawing { text-align: center; }
.review-drawing-img {
    max-width: 100%;
    max-height: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

/* ===== EXPANDED DRAWING MODAL ===== */
.cc-exp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cc-exp-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: min(1100px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.cc-exp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== IMAGE PREVIEW (AddQuestion / EditQuestion) ===== */
.img-preview-box {
    position: relative;
    display: block;
    max-width: 100%;
}
.img-preview {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: block;
}
.btn-remove-img {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.btn-remove-img:hover { background: var(--danger); }
