/* Internship Exam Portal styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --mid: #ca8a04;
    --weak: #dc2626;
    --bg: #f8fafc;
    --card-bg: #fff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; font-size: 17px; }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: 14px; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }

.card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 28px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.center-card { max-width: 620px; margin: 20px auto; }

h1 { margin: 0 0 12px 0; font-size: 24px; }
h3 { margin: 22px 0 10px; font-size: 16px; }
.lead { color: var(--muted); }

.instructions ul { padding-left: 20px; }
.instructions li { margin: 4px 0; }

.start-form { display: grid; gap: 14px; margin-top: 18px; }
.start-form label { display: block; font-weight: 600; font-size: 13px; }
.start-form input {
    width: 100%; padding: 10px 12px; margin-top: 4px;
    border: 1px solid var(--border); border-radius: 6px; font-size: 15px;
    font-family: inherit;
}
.start-form input:focus { outline: 2px solid var(--primary); }

.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 18px; border-radius: 6px; border: none; font-weight: 600;
    cursor: pointer; font-size: 14px; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); text-decoration: none; display: inline-block; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.error-banner {
    background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
    padding: 10px 14px; border-radius: 6px; margin: 12px 0;
}

/* Exam layout */
.timer-wrap { display: flex; align-items: center; gap: 16px; }
.timer-label { color: var(--muted); font-size: 12px; }
.timer {
    font-family: "SF Mono", Menlo, monospace; font-size: 22px; font-weight: 700;
    color: var(--danger); background: #fef2f2; padding: 6px 12px; border-radius: 6px;
    min-width: 90px; text-align: center;
}
.timer.warn { background: #fffbeb; color: #b45309; }
.timer.ok { background: #f0fdf4; color: var(--success); }
.tab-switches { font-size: 13px; color: var(--muted); }

.exam-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 900px) { .exam-layout { grid-template-columns: 1fr; } }

.sidebar {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 16px; height: fit-content; position: sticky; top: 76px;
}
.candidate-mini { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.cand-name { font-weight: 700; }
.cand-mob { color: var(--muted); font-size: 13px; }

.qgrid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px;
}
.qcell {
    aspect-ratio: 1; border: 1px solid var(--border); background: #fff; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.qcell:hover { border-color: var(--primary); }
.qcell.answered { background: #dcfce7; border-color: #86efac; color: #166534; }
.qcell.review { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.qcell.current { outline: 2px solid var(--primary); background: #dbeafe; }

.legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.dot-unseen { background: #fff; border: 1px solid var(--border); }
.dot-answered { background: #dcfce7; border: 1px solid #86efac; }
.dot-review { background: #fef3c7; border: 1px solid #fcd34d; }
.dot-current { background: #dbeafe; border: 1px solid var(--primary); }

.qpanel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 24px; min-height: 500px; }
.question .qhead {
    display: flex; gap: 12px; align-items: center; margin-bottom: 16px;
    font-size: 12px; color: var(--muted);
}
.qmodule { background: #eff6ff; color: #1e40af; padding: 3px 8px; border-radius: 4px; font-weight: 600; }
.qdiff { padding: 3px 8px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.qdiff-easy { background: #f0fdf4; color: #15803d; }
.qdiff-medium { background: #fffbeb; color: #b45309; }
.qdiff-hard { background: #fef2f2; color: #b91c1c; }
.qidx { margin-left: auto; }

.qprompt { font-size: 16px; margin-bottom: 20px; white-space: pre-wrap; }
.options { display: grid; gap: 10px; margin-bottom: 20px; }
.option {
    display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; align-items: flex-start;
}
.option:hover { border-color: var(--primary); background: #f8fafc; }
.option input { margin-top: 3px; }
.okey { font-weight: 700; min-width: 22px; }

.short-input { width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 20px; }

.coding-help { padding: 10px 14px; background: #f8fafc; border-left: 3px solid var(--primary); font-size: 14px; margin-bottom: 12px; }
.coding-help code { background: #e2e8f0; padding: 1px 6px; border-radius: 3px; }
.code-editor { display: none; }
.code-actions { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.code-status { font-size: 13px; color: var(--muted); }
.code-output { background: #0f172a; color: #cbd5e1; padding: 12px; border-radius: 6px; font-size: 13px; max-height: 200px; overflow: auto; margin-bottom: 12px; white-space: pre-wrap; }
.code-output:empty { display: none; }

.qactions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 16px; }
.markrev { font-size: 13px; color: var(--muted); }
.navbtns { display: flex; gap: 8px; }

/* Result page */
.score-hero { display: flex; align-items: baseline; gap: 24px; margin: 20px 0; padding: 20px; background: #f8fafc; border-radius: 8px; }
.score-big { font-size: 44px; font-weight: 800; color: var(--primary); }
.score-big span { color: var(--muted); font-size: 26px; font-weight: 500; }
.score-pct { font-size: 30px; font-weight: 700; color: var(--text); }

.mod-chart { display: grid; gap: 10px; margin-bottom: 20px; }
.mod-row { display: grid; grid-template-columns: 200px 1fr 140px; gap: 12px; align-items: center; }
.mod-name { font-weight: 600; font-size: 14px; }
.mod-bar-wrap { background: #f1f5f9; height: 16px; border-radius: 8px; overflow: hidden; }
.mod-bar { height: 100%; transition: width 0.3s ease; border-radius: 8px; }
.bar-strong { background: var(--success); }
.bar-mid { background: var(--mid); }
.bar-weak { background: var(--weak); }
.mod-score { font-size: 13px; color: var(--muted); text-align: right; font-family: "SF Mono", Menlo, monospace; }
.pct { font-weight: 600; }

.gap-analysis { background: #f8fafc; padding: 16px; border-left: 4px solid var(--primary); border-radius: 4px; margin-bottom: 20px; }
.thanks { color: var(--muted); margin-top: 24px; }
.notice { background: #fffbeb; border: 1px solid #fcd34d; padding: 10px 14px; border-radius: 6px; margin: 12px 0; font-size: 13px; color: #92400e; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.admin-table th { background: #f8fafc; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.admin-table tbody tr:hover { background: #f8fafc; }
.pct-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.pct-strong { background: #dcfce7; color: #166534; }
.pct-mid { background: #fef3c7; color: #92400e; }
.pct-weak { background: #fee2e2; color: #991b1b; }

.qq-table .qcell { max-width: 400px; font-size: 13px; }
.qq-table .acell { font-family: "SF Mono", Menlo, monospace; font-size: 12px; max-width: 200px; word-break: break-all; }
.cand-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 20; display: flex; align-items: center; justify-content: center; }
.modal-card { background: #fff; padding: 24px; border-radius: 10px; max-width: 440px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
