/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", Tahoma, sans-serif;
}
body {
    background: #f8fafc;
    min-height: 100vh;
}
.hidden {
    display: none !important;
}

/* ===== AUTH ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #132a52, #1d3e73);
    padding: 20px;
}
.auth-box {
    background: #fff;
    border-radius: 22px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(19, 42, 82, 0.35);
}
.auth-box h2 {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
}
.auth-box .sub {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 24px;
}
.auth-box .logo {
    text-align: center;
    font-size: 40px;
    margin-bottom: 12px;
}
.auth-box .link {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: #64748b;
}
.auth-box .link span {
    color: #2563eb;
    font-weight: 700;
    cursor: pointer;
}
.auth-box .error {
    color: #dc2626;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:active {
    transform: scale(0.97);
}
.btn-primary {
    background: #2563eb;
    color: #fff;
}
.btn-primary:hover {
    background: #1d4ed8;
}
.btn-ghost {
    background: #fff;
    color: #334155;
    border: 1.5px solid #e2e8f0;
}
.btn-ghost:hover {
    background: #f8fafc;
}
.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
}
.btn-success {
    background: #16a34a;
    color: #fff;
}
.btn-success:hover {
    background: #15803d;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===== INPUTS ===== */
input,
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s;
}
input:focus,
textarea:focus,
select:focus {
    border-color: #2563eb;
}
textarea {
    resize: vertical;
    min-height: 70px;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #3a4a63;
    margin-bottom: 4px;
}
.field {
    margin-bottom: 14px;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 230px;
    background: #132a52;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 4px;
    color: #aab8d1;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}
.sidebar-item:hover {
    background: #1d3e73;
}
.sidebar-item.active {
    background: #2563eb;
    color: #fff;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    border-bottom: 1px solid #22385f;
    color: #fff;
    font-weight: 800;
    font-size: 17px;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #22385f;
    margin-top: auto;
}
.main-content {
    flex: 1;
    padding: 30px 34px;
    background: #f8fafc;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}
.topbar h1 {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}
.topbar .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.topbar .date {
    font-size: 13px;
    color: #64748b;
    margin-left: 14px;
}

/* ===== CARDS & STATS ===== */
.card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eef1f6;
    padding: 22px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid #eef1f6;
}
.stat-card .number {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
}
.stat-card .label {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    margin-top: 4px;
}

/* ===== EXAM GRID ===== */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}
.exam-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eef1f6;
    padding: 18px;
}
.exam-card .title {
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
}
.exam-card .meta {
    font-size: 12px;
    color: #64748b;
    margin: 6px 0 12px;
}
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}
.badge-green {
    background: #f0fdf4;
    color: #16a34a;
}
.badge-orange {
    background: #fffbeb;
    color: #d97706;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}
.modal-box {
    background: #fff;
    border-radius: 18px;
    padding: 26px;
    width: 100%;
    max-width: 420px;
}
.modal-title {
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-item span,
    .sidebar-header span,
    .sidebar-footer div {
        display: none;
    }
    .sidebar-item {
        justify-content: center;
        padding: 12px;
    }
    .sidebar-header {
        justify-content: center;
        padding: 16px;
    }
    .sidebar-footer {
        padding: 8px;
    }
    .main-content {
        padding: 16px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== TAKE EXAM ===== */
.exam-take-container {
    min-height: 100vh;
    background: #f8fafc;
    padding: 24px;
}
.exam-take-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.exam-take-header .title {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}
.exam-take-body {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.exam-take-main {
    flex: 1 1 480px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eef1f6;
    padding: 24px;
}
.exam-take-side {
    width: 260px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eef1f6;
    padding: 20px;
    flex-shrink: 0;
}
.progress-bar {
    height: 6px;
    background: #eef1f6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 22px;
}
.progress-bar .fill {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    transition: width 0.2s;
}
.question-text {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 22px;
    line-height: 1.7;
}
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 26px;
}
.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.option-item.selected {
    border-color: #2563eb;
    background: #eff6ff;
}
.option-item .letter {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
}
.option-item .text {
    font-size: 14px;
    color: #334155;
}
.question-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.q-dot {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.q-dot.answered {
    background: #16a34a;
    color: #fff;
}
.q-dot.visited {
    background: #f59e0b;
    color: #fff;
}
.q-dot.current {
    background: #2563eb;
    color: #fff;
}
.q-dot.unseen {
    background: #f1f5f9;
    color: #475569;
}
.legend-dot {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #64748b;
}
.legend-dot .dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    display: inline-block;
}

/* ===== RESULTS ===== */
.result-row td {
    padding: 12px 6px;
    border-top: 1px solid #f1f5f9;
    font-size: 14px;
}
.result-row .name {
    font-weight: 700;
    color: #1e293b;
}
.result-row .score {
    font-weight: 800;
}
.result-row .score.pass {
    color: #16a34a;
}
.result-row .score.fail {
    color: #dc2626;
}