/* ================================================================
   ACADEMIC EVALUATOR — WEB PORTAL STYLES
   Theme: #111111 · #343434 · #D9D9D9 · #FFFFFF (Grey Only)
   Font: Roboto
   ================================================================ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --primary: #111111;
    --secondary: #343434;
    --accent: #343434;
    --accent-hover: #111111;
    --neutral: #D9D9D9;
    --white: #FFFFFF;
    --bg: #F5F5F5;
    --surface: #FFFFFF;
    --surface-alt: #FAFAFA;
    --border: #E5E5E5;
    --text-primary: #111111;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --error: #343434;
    --error-bg: #F0F0F0;
    --warning: #343434;
    --warning-bg: #F0F0F0;
    --success: #343434;
    --success-bg: #F0F0F0;
    --info: #343434;
    --info-bg: #F0F0F0;

    --sidebar-w: 260px;
    --header-h: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    --transition: 0.2s ease;

    --font: 'Inter', 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    background: none;
}

input,
select,
textarea {
    font-family: var(--font);
    outline: none;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

/* ── Utility ───────────────────────────────────────────────────── */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-xs {
    gap: 4px;
}

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

.gap-xl {
    gap: 32px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-accent {
    color: var(--accent);
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-error {
    color: var(--error);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Auth Layout (Login / Register) ────────────────────────────── */
.auth-layout {
    display: flex;
    min-height: 100vh;
    background: var(--white);
}

.auth-decoration {
    position: relative;
    flex: 1;
    background: var(--primary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-decoration::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -20%;
    width: 120%;
    height: 120%;
    background: var(--secondary);
    border-radius: 50% 0 50% 50%;
    transform: rotate(-15deg);
}

.auth-decoration::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 80%;
    height: 80%;
    background: var(--neutral);
    border-radius: 50%;
    opacity: 0.5;
}

.auth-decoration-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    padding: 60px;
    max-width: 480px;
}

.auth-decoration-content h1 {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
}

.auth-decoration-content p {
    font-size: 16px;
    opacity: 0.8;
    line-height: 1.7;
}

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 22px;
    font-weight: 800;
    overflow: hidden;
}

.auth-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-footer a {
    color: var(--accent);
    font-weight: 600;
    transition: color var(--transition);
}

.auth-footer a:hover {
    color: var(--accent-hover);
}

/* ── Form Elements ─────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--white);
    transition: all var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.error {
    border-color: var(--error);
}

.form-error {
    color: var(--error);
    font-size: 12px;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--white);
    transition: all var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
    line-height: 1.4;
}

.form-select option {
    padding: 10px 16px;
    font-size: 15px;
    background: var(--white);
    color: var(--text-primary);
}

.form-select:hover {
    border-color: #9CA3AF;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--white);
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition);
}

.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-left: 44px;
}

.input-with-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── App Layout ────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    overflow: hidden;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.sidebar-role {
    padding: 12px 24px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
}

.sidebar-user-email {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main Content Area ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────── */
.header {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.header-breadcrumb span {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

.header-icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 18px;
}

/* ── Page Content ──────────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 28px 32px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.page-header-left p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-padded {
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

/* ── Stat Cards ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.green {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-icon.blue {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-icon.yellow {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-icon.red {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-icon.accent {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-icon.dark {
    background: rgba(17, 17, 17, 0.06);
    color: var(--primary);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.stat-change.up {
    background: var(--success-bg);
    color: var(--success);
}

.stat-change.down {
    background: var(--error-bg);
    color: var(--error);
}

/* ── Tables ────────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 14px 16px;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr {
    transition: background var(--transition);
}

table tbody tr:hover {
    background: var(--surface-alt);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges / Tags ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(17, 17, 17, 0.08);
    color: var(--primary);
}

.badge-accent {
    background: rgba(17, 17, 17, 0.08);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-neutral {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
}

.tab-item {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-item:hover {
    color: var(--primary);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ── Period Chips ──────────────────────────────────────────────── */
.chip-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    background: var(--white);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chip.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ── Leaderboard ───────────────────────────────────────────────── */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px 24px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.podium-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--white);
    margin-bottom: 8px;
    position: relative;
}

.podium-avatar.gold {
    background: var(--primary);
}

.podium-avatar.silver {
    background: var(--secondary);
}

.podium-avatar.bronze {
    background: var(--neutral);
    color: var(--primary);
}

.podium-medal {
    position: absolute;
    top: -8px;
    right: -4px;
    font-size: 18px;
}

.podium-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-score {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.podium-bar {
    width: 90px;
    margin-top: 8px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.9);
}

.podium-bar.gold {
    background: linear-gradient(180deg, #111111, #343434);
    height: 120px;
}

.podium-bar.silver {
    background: linear-gradient(180deg, #343434, #6B7280);
    height: 90px;
}

.podium-bar.bronze {
    background: linear-gradient(180deg, #9CA3AF, #D9D9D9);
    height: 70px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    gap: 16px;
}

.leaderboard-row:hover {
    background: var(--surface-alt);
}

.leaderboard-row.current-user {
    background: rgba(17, 17, 17, 0.04);
    border-left: 3px solid var(--primary);
}

.leaderboard-rank {
    width: 40px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.leaderboard-rank.top {
    color: var(--accent);
}

.leaderboard-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.leaderboard-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--neutral);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary);
    flex-shrink: 0;
}

.leaderboard-name {
    font-weight: 500;
}

.leaderboard-batch {
    font-size: 12px;
    color: var(--text-muted);
}

.leaderboard-score {
    font-weight: 700;
    font-size: 16px;
    width: 70px;
    text-align: center;
    flex-shrink: 0;
}

.rank-change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

.rank-change.up {
    color: var(--success);
    background: var(--success-bg);
}

.rank-change.down {
    color: var(--error);
    background: var(--error-bg);
}

.rank-change.same {
    color: var(--text-muted);
}

/* ── My Rank Banner ────────────────────────────────────────────── */
.my-rank-banner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(17, 17, 17, 0.25);
}

.my-rank-section {
    text-align: center;
}

.my-rank-label {
    font-size: 12px;
    opacity: 0.6;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.my-rank-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
}

.my-rank-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Charts ────────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 56px;
    color: var(--neutral);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 360px;
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ── Toast ─────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-size: 14px;
    min-width: 300px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--error);
}

.toast.warning i {
    color: var(--warning);
}

.toast-close {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Notification Dropdown ─────────────────────────────────────── */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    z-index: 150;
    display: none;
}

.notification-dropdown.open {
    display: block;
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.notification-dropdown-header h4 {
    font-weight: 600;
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.notification-item:hover {
    background: var(--surface-alt);
}

.notification-item.unread {
    background: rgba(17, 17, 17, 0.03);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 13px;
    font-weight: 500;
}

.notification-message {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    background: var(--accent);
}

/* ── Skeleton / Loading ────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg) 25%, #ececec 50%, var(--bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Assignment Card ───────────────────────────────────────────── */
.assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.assignment-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all var(--transition);
    cursor: pointer;
}

.assignment-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.assignment-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.assignment-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.assignment-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.assignment-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.assignment-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Alert Cards ───────────────────────────────────────────────── */
.alert-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--warning);
    margin-bottom: 12px;
}

.alert-card.critical {
    border-left-color: var(--error);
}

.alert-card.info {
    border-left-color: var(--info);
}

.alert-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.alert-card-body {
    flex: 1;
}

.alert-card-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-card-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.alert-card-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Submission Detail ─────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-item .value {
    font-size: 15px;
    font-weight: 500;
}

/* ── Rubric Scores ─────────────────────────────────────────────── */
.rubric-score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.rubric-score-item:last-child {
    border-bottom: none;
}

.rubric-score-name {
    font-weight: 500;
}

.rubric-score-bar {
    width: 120px;
    height: 6px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 16px;
}

.rubric-score-val {
    font-weight: 700;
    font-size: 14px;
    min-width: 60px;
    text-align: right;
}

/* ── Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .form-input,
.filter-bar .form-select {
    max-width: 200px;
    padding: 8px 14px;
    font-size: 13px;
}

.search-input {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-input input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.search-input i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
}

.pagination button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.pagination button:hover {
    background: var(--bg);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: var(--white);
}

.pagination button:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ── WebSocket Status ──────────────────────────────────────────── */
.ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neutral);
}

.ws-dot.connected {
    background: var(--success);
}

.ws-dot.connecting {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ── Grading Panel ─────────────────────────────────────────────── */
.grading-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.grading-submission {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

.grading-submission pre {
    background: var(--primary);
    color: #e5e5e5;
    padding: 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.grading-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    position: sticky;
    top: calc(var(--header-h) + 20px);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .auth-decoration {
        display: none;
    }

    .auth-form-side {
        flex: 1;
    }

    .grading-layout {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 20px 16px;
    }

    .header {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .assignment-grid {
        grid-template-columns: 1fr;
    }

    .podium-bar {
        width: 70px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .my-rank-banner {
        flex-direction: column;
        gap: 16px;
    }

    .my-rank-divider {
        width: 100%;
        height: 1px;
    }
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ── Profile Dropdown ──────────────────────────────────────────── */
.profile-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    right: 12px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 110;
}

.profile-dropdown.open {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    transition: all var(--transition);
    cursor: pointer;
}

.profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.profile-dropdown-item.danger {
    color: #D9D9D9;
}

.profile-dropdown-item.danger:hover {
    background: rgba(217, 217, 217, 0.1);
}

/* ── File Upload ───────────────────────────────────────────────── */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(17, 17, 17, 0.02);
}

.file-upload-area i {
    font-size: 40px;
    color: var(--neutral);
    margin-bottom: 12px;
}

.file-upload-area h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

.file-upload-area p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Score Circle ──────────────────────────────────────────────── */
.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    border: 4px solid;
}

.score-circle.high {
    border-color: var(--success);
    color: var(--success);
}

.score-circle.mid {
    border-color: var(--warning);
    color: var(--warning);
}

.score-circle.low {
    border-color: var(--error);
    color: var(--error);
}

/* ── At-Risk Student ───────────────────────────────────────────── */
.risk-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all var(--transition);
}

.risk-card:hover {
    box-shadow: var(--shadow-sm);
}

.risk-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--error-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    font-weight: 600;
    flex-shrink: 0;
}

.risk-info {
    flex: 1;
}

.risk-name {
    font-weight: 600;
    font-size: 14px;
}

.risk-detail {
    font-size: 12px;
    color: var(--text-muted);
}

.risk-factors {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Gamification ──────────────────────────────────────────────── */
.xp-bar {
    width: 100%;
    height: 12px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    transition: width 1s ease;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.achievement-card {
    text-align: center;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.achievement-card:hover {
    box-shadow: var(--shadow-sm);
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.achievement-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Sidebar overlay for mobile ────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.open {
    display: block;
}

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

/* ── Card body padding ─────────────────────────────────────────── */
.card-body {
    padding: 16px 20px;
}

/* ── Sub-tabs ──────────────────────────────────────────────────── */
.sub-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.sub-tab:hover {
    color: var(--text-primary);
    background: var(--bg);
}

.sub-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Exam Lockdown Mode ────────────────────────────────────────── */
body.exam-lockdown {
    overflow: hidden !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

body.exam-lockdown .sidebar {
    display: none !important;
}

body.exam-lockdown .header {
    display: none !important;
}

body.exam-lockdown .sidebar-overlay {
    display: none !important;
}

body.exam-lockdown .main-content {
    margin-left: 0 !important;
}

body.exam-lockdown .page-content {
    padding: 0 !important;
    height: 100vh;
}

/* Violation Overlay */
.violation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.violation-card {
    background: #FFFFFF;
    border: 2px solid #EF4444;
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 60px rgba(239, 68, 68, 0.2);
    animation: violationPulse 0.4s ease-out;
}

@keyframes violationPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.violation-icon {
    font-size: 56px;
    color: #EF4444;
    margin-bottom: 20px;
    animation: violationShake 0.5s ease-in-out;
}

@keyframes violationShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(10px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

.violation-card h2 {
    color: #111111;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.violation-card p {
    color: #6B7280;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.violation-card strong {
    color: #EF4444;
    font-weight: 700;
}

.violation-terminal {
    color: #EF4444 !important;
    font-weight: 700;
    font-size: 15px !important;
    animation: pulse-timer 1s infinite;
}

.violation-card .btn {
    min-width: 240px;
    padding: 14px 32px;
    font-size: 14px;
    font-weight: 700;
}

/* ── Test Taking Interface ─────────────────────────────────────── */
.test-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: 100vh;
    overflow: hidden;
    border: none;
    border-radius: 0;
    background: var(--surface);
}

body.exam-lockdown .test-container {
    height: 100vh;
}

.test-sidebar {
    background: var(--surface-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.test-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: var(--white);
}

.test-sidebar-header h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.test-sidebar-header .test-timer {
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.test-sidebar-header .test-timer.warning {
    color: #EF4444;
    animation: pulse-timer 1s infinite;
}

@keyframes pulse-timer {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.test-question-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.test-question-nav h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.question-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.question-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.question-btn.answered {
    background: #6B7280;
    color: white;
    border-color: #6B7280;
}

.question-btn.flagged {
    background: #F59E0B;
    color: white;
    border-color: #F59E0B;
}

.test-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.test-sidebar-footer .question-legend {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.test-sidebar-footer .question-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

.legend-dot.current {
    background: var(--primary);
}

.legend-dot.done {
    background: #6B7280;
}

.legend-dot.flagged {
    background: #F59E0B;
}

.legend-dot.empty {
    background: var(--white);
    border: 1px solid var(--border);
}

/* Main test area */
.test-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.test-question-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.question-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.question-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.question-meta .meta-tag {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-secondary);
}

.question-text {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
}

/* Code editor area */
.code-editor-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #383838;
    background: #2E2E2E;
}

.code-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    gap: 12px;
    background: #252525;
    border-bottom: 1px solid #383838;
}

.code-editor-toolbar label {
    font-size: 11px;
    font-weight: 600;
    color: #999 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-editor-toolbar select {
    padding: 5px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
    background: #333;
    color: #E0E0E0;
    cursor: pointer;
    outline: none;
}

.code-editor-toolbar select:focus {
    border-color: #666;
}

.code-editor-toolbar span {
    color: #777 !important;
}

/* CodeMirror overrides */
.code-editor-area .CodeMirror {
    border: none;
    border-radius: 0;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    height: 380px;
    background: #2E2E2E;
}

.code-editor-area .CodeMirror-focused {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.code-editor-area .CodeMirror-gutters {
    background: #262626;
    border-right: 1px solid #383838;
    padding-right: 4px;
}

.code-editor-area .CodeMirror-linenumber {
    color: #555;
    padding: 0 8px 0 6px;
    font-size: 12px;
}

.code-editor-area .CodeMirror-cursor {
    border-left: 2px solid #E0E0E0;
}

.code-editor-area .CodeMirror-scroll {
    padding: 6px 0;
}

.code-editor-area .CodeMirror-selected {
    background: rgba(255, 255, 255, 0.08) !important;
}

.code-editor-area .CodeMirror-activeline-background {
    background: rgba(255, 255, 255, 0.04);
}

/* Fallback raw textarea (when CodeMirror CDN fails) */
.code-editor-area textarea#cmEditor {
    width: 100%;
    height: 380px;
    padding: 16px 16px 16px 56px;
    background: #2E2E2E;
    color: #E0E0E0;
    border: none;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
}

.code-editor-area textarea#cmEditor::placeholder {
    color: #555;
}

.code-editor-area textarea#cmEditor:focus {
    background: #303030;
}

.code-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #1E1E1E;
    color: #D4D4D4;
    tab-size: 4;
    outline: none;
    transition: border-color 0.2s;
}

.code-textarea:focus {
    border-color: var(--primary);
}

.code-textarea::placeholder {
    color: #6A6A6A;
}

/* Sample test cases */
.sample-cases {
    margin-top: 16px;
}

.sample-cases h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.sample-case {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 8px;
    font-size: 13px;
    border: 1px solid var(--border);
}

.sample-case .case-label {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sample-case pre {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    color: var(--text-primary);
}

/* Output panel — split terminal layout */
.output-panel {
    margin-top: 16px;
    border: 1px solid #383838;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #1A1A1A;
}

.output-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #252525;
    border-bottom: 1px solid #383838;
    font-size: 12px;
    font-weight: 700;
    color: #CCC;
}

.tc-badge {
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
}

.tc-badge.pass {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
}

.tc-badge.fail {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.output-split {
    display: grid;
    grid-template-columns: 7fr 3fr;
    min-height: 120px;
    max-height: 280px;
}

.output-terminal {
    border-right: 1px solid #383838;
    overflow-y: auto;
    padding: 0;
    background: #1E1E1E;
}

.terminal-pre {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px 16px;
    margin: 0;
    white-space: pre-wrap;
    color: #D4D4D4;
}

.terminal-pre.error {
    color: #EF4444;
}

.terminal-error {
    padding: 8px 16px 0;
    font-size: 12px;
    font-weight: 700;
    color: #EF4444;
}

.output-results {
    overflow-y: auto;
    background: #1A1A1A;
    padding: 8px;
}

.output-results-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    padding: 4px 8px 8px;
}

.tc-result-card {
    background: #252525;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-left: 3px solid transparent;
}

.tc-result-card.pass {
    border-left-color: #22C55E;
}

.tc-result-card.fail {
    border-left-color: #EF4444;
}

.tc-result-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #DDD;
}

.tc-result-title i.fa-check-circle {
    color: #22C55E;
}

.tc-result-title i.fa-times-circle {
    color: #EF4444;
}

.tc-time {
    margin-left: auto;
    font-size: 10px;
    color: #888;
    font-weight: 500;
}

.tc-compare {
    margin-top: 6px;
}

.tc-compare-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 3px;
}

.tc-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    min-width: 52px;
    padding-top: 2px;
}

.tc-value {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 11px;
    color: #BBB;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.tc-value.got {
    color: #EF4444;
}

.tc-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* Bottom action bar */
.test-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.test-action-bar .nav-btns {
    display: flex;
    gap: 8px;
}

.test-action-bar .action-btns {
    display: flex;
    gap: 8px;
}

.btn-run {
    background: #22C55E;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: var(--font);
}

.btn-run:hover {
    background: #16A34A;
}

.btn-run:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-submit-test {
    background: #EF4444;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: var(--font);
}

.btn-submit-test:hover {
    background: #DC2626;
}

/* Test result modal */
.test-result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.test-result-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.test-result-card .score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 6px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    font-weight: 800;
}

@media (max-width: 768px) {
    .test-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .test-sidebar {
        display: none;
    }

    .code-textarea {
        min-height: 200px;
    }
}

/* ══════════════════════════════════════════════════════════════════
   TEST CREATOR — Professional Contest Platform UI
   ══════════════════════════════════════════════════════════════════ */

/* ── Step Wizard ───────────────────────────────────────────────── */
.tc-wizard {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.tc-wizard-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    border-right: 1px solid var(--border);
    position: relative;
    user-select: none;
}

.tc-wizard-step:last-child {
    border-right: none;
}

.tc-wizard-step .step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    border: 2px solid var(--border);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.tc-wizard-step .step-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.25s ease;
}

.tc-wizard-step .step-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.tc-wizard-step.active {
    background: var(--primary);
}

.tc-wizard-step.active .step-num {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.tc-wizard-step.active .step-info h4 {
    color: #fff;
}

.tc-wizard-step.active .step-info p {
    color: rgba(255, 255, 255, 0.6);
}

.tc-wizard-step.completed .step-num {
    background: #22C55E;
    border-color: #22C55E;
    color: #fff;
}

.tc-wizard-step.completed .step-info h4 {
    color: var(--text-primary);
}

.tc-wizard-step:hover:not(.active) {
    background: var(--surface-alt);
}

/* ── Step Panels ───────────────────────────────────────────────── */
.tc-step-panel {
    display: none;
    animation: tcFadeIn 0.3s ease;
}

.tc-step-panel.active {
    display: block;
}

@keyframes tcFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Stepper Navigation ───────────────────────────────────────── */
.tc-stepper-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── Section Card ─────────────────────────────────────────────── */
.tc-section-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tc-section-card:hover {
    border-color: #9CA3AF;
}

.tc-section-card.expanded {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.tc-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    cursor: pointer;
    background: var(--surface-alt);
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
}

.tc-section-card.expanded .tc-section-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.tc-section-header .sec-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.sec-icon.coding {
    background: #DBEAFE;
    color: #2563EB;
}

.sec-icon.aptitude {
    background: #FEF3C7;
    color: #D97706;
}

.sec-icon.verbal {
    background: #F3E8FF;
    color: #7C3AED;
}

.sec-icon.sql {
    background: #D1FAE5;
    color: #059669;
}

.sec-icon.mcq {
    background: #FCE7F3;
    color: #DB2777;
}

.sec-icon.theory {
    background: #E0E7FF;
    color: #4338CA;
}

.tc-section-header .sec-info {
    flex: 1;
    min-width: 0;
}

.tc-section-header .sec-info h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.tc-section-header .sec-info .sec-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.tc-section-header .sec-info .sec-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tc-section-header .sec-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tc-section-header .chevron-icon {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.tc-section-card.expanded .chevron-icon {
    transform: rotate(180deg);
}

.tc-section-body {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.2s ease;
}

.tc-section-card.expanded .tc-section-body {
    padding: 22px;
    max-height: 50000px;
}

/* ── Section Config Row ───────────────────────────────────────── */
.tc-sec-config {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px 20px;
    background: #FAFAFA;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    border-radius: 10px;
}

.tc-sec-config .config-item label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.tc-sec-config .config-item input,
.tc-sec-config .config-item select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color 0.2s;
}

.tc-sec-config .config-item input:focus,
.tc-sec-config .config-item select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

/* ── Question Card (Professional) ─────────────────────────────── */
.tc-question-card {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    margin-bottom: 16px;
    background: #fff;
    transition: all 0.2s ease;
    overflow: hidden;
}

.tc-question-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.tc-q-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #FAFAFA;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.tc-q-header .q-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-q-header .q-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.tc-q-header .q-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.tc-q-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tc-q-controls .q-field-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-q-controls .q-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.tc-q-controls input[type="number"] {
    width: 64px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background: #fff;
    transition: border 0.2s;
}

.tc-q-controls input[type="number"]:focus {
    border-color: var(--primary);
}

.tc-q-controls select {
    padding: 6px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
}

.tc-q-body {
    padding: 18px;
}

/* ── Problem Statement Tabs ───────────────────────────────────── */
.tc-problem-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tc-problem-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tc-problem-tab:hover {
    color: var(--text-primary);
}

.tc-problem-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tc-tab-content {
    display: none;
}

.tc-tab-content.active {
    display: block;
    animation: tcFadeIn 0.2s ease;
}

/* ── Test Case Builder ────────────────────────────────────────── */
.tc-cases-builder {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.tc-cases-tabs {
    display: flex;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
}

.tc-cases-tab {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    user-select: none;
}

.tc-cases-tab:hover {
    color: var(--text-primary);
}

.tc-cases-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #fff;
}

.tc-cases-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--border);
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    padding: 0 6px;
}

.tc-cases-tab.active .tab-count {
    background: var(--primary);
    color: #fff;
}

.tc-cases-body {
    padding: 14px;
}

.tc-case-row {
    display: grid;
    grid-template-columns: 1fr 1fr 80px 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: start;
}

.tc-case-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 13px;
    color: var(--text-primary);
    background: #FAFAFA;
    resize: vertical;
    min-height: 48px;
    transition: border 0.2s, background 0.2s;
}

.tc-case-row textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.04);
}

.tc-case-row .case-weight {
    padding: 10px 8px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    background: #FAFAFA;
    color: var(--text-primary);
}

.tc-case-row .case-weight:focus {
    border-color: var(--primary);
    background: #fff;
}

.tc-case-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 80px 40px;
    gap: 10px;
    margin-bottom: 8px;
    padding: 0 2px;
}

.tc-case-labels span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tc-case-remove {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #FEF2F2;
    color: #EF4444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-top: 8px;
}

.tc-case-remove:hover {
    background: #FEE2E2;
    transform: scale(1.05);
}

.tc-add-case-btn {
    width: 100%;
    padding: 10px;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.tc-add-case-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #FAFAFA;
}

/* ── MCQ Option Builder ───────────────────────────────────────── */
.tc-option-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #FAFAFA;
    transition: all 0.2s;
}

.tc-option-row:hover {
    border-color: #9CA3AF;
}

.tc-option-row.correct {
    border-color: #22C55E;
    background: #F0FDF4;
}

.tc-option-letter {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.2s;
}

.tc-option-row.correct .tc-option-letter {
    background: #22C55E;
    color: #fff;
}

.tc-option-input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.tc-option-correct-btn {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tc-option-correct-btn:hover {
    border-color: #22C55E;
    color: #22C55E;
}

.tc-option-correct-btn.is-correct {
    background: #22C55E;
    border-color: #22C55E;
    color: #fff;
}

/* ── SQL Schema Editor ────────────────────────────────────────── */
.tc-sql-editor {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.tc-sql-editor-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tc-sql-editor textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    border: none;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    background: #fff;
    resize: vertical;
    outline: none;
}

/* ── Add Question Button ──────────────────────────────────────── */
.tc-add-q-btn {
    width: 100%;
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tc-add-q-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #FAFAFA;
}

/* ── Delete Button ────────────────────────────────────────────── */
.tc-delete-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid #FECACA;
    background: #FEF2F2;
    color: #EF4444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tc-delete-btn:hover {
    background: #FEE2E2;
    border-color: #EF4444;
    transform: scale(1.05);
}

/* ── Form Sections with Icons ─────────────────────────────────── */
.tc-form-section {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 24px;
    background: var(--surface);
}

.tc-form-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 18px;
}

.tc-form-section-title i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ── Checkbox Grid ────────────────────────────────────────────── */
.tc-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.tc-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

.tc-checkbox-item:hover {
    border-color: #9CA3AF;
    background: #FAFAFA;
}

.tc-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.tc-checkbox-item.checked {
    border-color: var(--primary);
    background: #F5F5F5;
}

/* ── Summary Preview ──────────────────────────────────────────── */
.tc-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.tc-summary-item {
    padding: 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #FAFAFA;
}

.tc-summary-item .summary-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.tc-summary-item .summary-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.tc-summary-item .summary-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Toggle Switch ────────────────────────────────────────────── */
.tc-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.tc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 12px;
    transition: 0.2s;
}

.tc-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    left: 3px;
    top: 3px;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.tc-toggle input:checked+.tc-toggle-slider {
    background: var(--primary);
}

.tc-toggle input:checked+.tc-toggle-slider::before {
    transform: translateX(20px);
}

/* ── Toggle Row ───────────────────────────────────────────────── */
.tc-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

.tc-toggle-row:last-child {
    border-bottom: none;
}

.tc-toggle-row .toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.tc-toggle-row .toggle-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Category Cards ───────────────────────────────────────────── */
.tc-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.tc-category-card {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.tc-category-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tc-category-card .cat-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: #fff;
    transition: all 0.2s ease;
    text-align: center;
}

.tc-category-card .cat-inner i {
    font-size: 24px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.tc-category-card .cat-inner span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.tc-category-card input:checked+.cat-inner {
    border-color: var(--primary);
    background: #F5F5F5;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.tc-category-card input:checked+.cat-inner i {
    color: var(--primary);
}

.tc-category-card .cat-inner:hover {
    border-color: #9CA3AF;
}

/* ── Scope Radio ──────────────────────────────────────────────── */
.tc-scope-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.tc-scope-radio {
    flex: 1;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.tc-scope-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tc-scope-radio .scope-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
}

.tc-scope-radio .scope-inner i {
    font-size: 16px;
    color: var(--text-muted);
}

.tc-scope-radio .scope-inner span {
    font-size: 14px;
    font-weight: 600;
}

.tc-scope-radio input:checked+.scope-inner {
    border-color: var(--primary);
    background: #F5F5F5;
}

.tc-scope-radio input:checked+.scope-inner i {
    color: var(--primary);
}

/* ── Add Section Button ──────────────────────────────────────── */
.tc-add-section-btn {
    width: 100%;
    padding: 18px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tc-add-section-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #FAFAFA;
}

/* ── Form Row ─────────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .tc-wizard {
        flex-direction: column;
    }

    .tc-wizard-step {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .tc-wizard-step:last-child {
        border-bottom: none;
    }

    .tc-case-row {
        grid-template-columns: 1fr 1fr;
    }

    .tc-case-labels {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .tc-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tc-scope-group {
        flex-direction: column;
    }
}