/**
 * Psychology Vi-Lab UNESA — Design System
 * Palette: UNESA Purple (#702082, #581c87) & Gold/Emas (#c59b27, #d4af37)
 */
:root {
    --purple: #702082;
    --purple-dark: #4a1257;
    --purple-light: #9333ea;
    --purple-50: #fbf5fd;
    --purple-100: #f5e9fa;
    --gold: #c59b27;
    --gold-light: #e5b93d;
    --gold-dark: #9e7917;
    --gold-50: #fefdf6;
    --gold-100: #fdf9e2;
    --navy: #1f1235;
    --blue: #702082; /* Mapped to UNESA purple for global theme coherence */
    --teal: #0d9488;
    --bg: #f8fafc;
    --muted: #64748b;
    --line: #e2e8f0;
    --white: #ffffff;
    --danger: #dc2626;
    --warn: #c59b27;
    --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--navy);
    background: var(--bg);
    font: 14px/1.55 'Plus Jakarta Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* Institutional Layout & Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    position: sticky;
    top: 0;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--line);
    flex-shrink: 0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    padding: 4px 8px 24px;
}
.brand small {
    display: block;
    font-size: 10px;
    line-height: 1.3;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0;
}
.mark {
    height: 38px;
    width: 38px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', serif;
    font-weight: 800;
    font-size: 22px;
    background: linear-gradient(135deg, #702082 0%, #4a1257 60%, #c59b27 100%);
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(112, 32, 130, 0.25);
}

.nav { display: grid; gap: 6px; }
.nav button, .nav a {
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    color: #4b5563;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
}
.nav button:hover, .nav a:hover {
    background: var(--purple-50);
    color: var(--purple);
}
.nav button.active, .nav a.active {
    background: linear-gradient(135deg, rgba(112, 32, 130, 0.08), rgba(197, 155, 39, 0.08));
    color: var(--purple);
    font-weight: 700;
    border: 1px solid rgba(112, 32, 130, 0.2);
}
.nav .ico { font-size: 16px; width: 20px; text-align: center; }

.side-foot {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding: 16px 10px 0;
    color: var(--muted);
    font-size: 11px;
}

.main { min-width: 0; flex: 1; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: 0 32px;
}
.topbar .right {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--muted);
}
.avatar {
    background: var(--purple-50);
    color: var(--purple);
    height: 36px;
    width: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
    border: 1px solid var(--purple-100);
}
.content {
    max-width: 1540px;
    margin: auto;
    padding: 32px 36px 70px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--purple);
    font-size: 11px;
    font-weight: 800;
}
.heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}
.heading h1 {
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.6px;
    margin: 6px 0;
    font-weight: 800;
    color: var(--navy);
}
.heading p { margin: 0; color: var(--muted); font-size: 13px; }

/* Buttons with UNESA Purple & Gold Accents */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn:hover {
    filter: brightness(0.97);
    border-color: #9ca3af;
}
.btn.primary {
    background: linear-gradient(135deg, #702082 0%, #581c87 100%);
    color: #ffffff;
    border-color: #581c87;
    box-shadow: 0 2px 8px rgba(112, 32, 130, 0.25);
}
.btn.primary:hover {
    background: linear-gradient(135deg, #581c87 0%, #4a1257 100%);
    box-shadow: 0 4px 12px rgba(112, 32, 130, 0.35);
}
.btn.gold {
    background: linear-gradient(135deg, #d4af37 0%, #c59b27 100%);
    color: #ffffff;
    border-color: #b3841a;
    box-shadow: 0 2px 8px rgba(197, 155, 39, 0.25);
}
.btn.gold:hover {
    background: linear-gradient(135deg, #c59b27 0%, #a17812 100%);
}
.btn.danger {
    border-color: #fecaca;
    color: var(--danger);
    background: #ffffff;
}
.btn.danger:hover {
    background: #fef2f2;
}
.btn.small {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 8px;
}
.btn.ghost {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

/* Cards & Dashboard Panels */
.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card, .panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(31, 18, 53, 0.03);
}
.card { padding: 22px; }
.metric { display: flex; align-items: center; gap: 14px; }
.metric-ico {
    height: 48px;
    width: 48px;
    background: var(--purple-50);
    color: var(--purple);
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 20px;
    border: 1px solid var(--purple-100);
}
.metric-ico.green {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}
.metric-ico.amber {
    background: var(--gold-50);
    color: var(--gold);
    border-color: var(--gold-100);
}
.metric-ico.red {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.metric small { color: var(--muted); font-size: 12px; }
.metric strong {
    display: block;
    font-size: 28px;
    letter-spacing: -1px;
    line-height: 1.25;
    color: var(--navy);
}

.grid2 {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(285px, 1fr);
    gap: 20px;
}
.panel { padding: 22px; }
.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.panel-title h2, .panel-title h3 {
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.3px;
    font-weight: 700;
}
.sub { color: var(--muted); font-size: 12px; }

/* Charts & Legends */
.chart {
    height: 240px;
    display: flex;
    align-items: flex-end;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding: 20px 12px 0;
}
.bar-group {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 100%;
    position: relative;
}
.bar {
    width: 16px;
    background: var(--purple);
    border-radius: 4px 4px 0 0;
}
.bar.teal { background: var(--gold); }
.bar-group small {
    position: absolute;
    bottom: -24px;
    color: var(--muted);
    font-size: 10px;
}
.legend {
    display: flex;
    justify-content: center;
    gap: 22px;
    color: var(--muted);
    font-size: 12px;
    margin: 36px 0 8px;
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    margin-right: 6px;
}
.dot.teal { background: var(--gold); }
.dot.green { background: #10b981; }
.dot.red { background: #ef4444; }
.dot.gray { background: #94a3b8; }

/* Tables & Data */
.tablewrap { overflow-x: auto; }
.data {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    font-size: 13px;
}
.data th {
    background: #f8fafc;
    color: #475569;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data td {
    padding: 13px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.data tr:hover td { background: #fdfafc; }

/* Status Badges / Pills */
.pill {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    display: inline-block;
    background: var(--purple-50);
    color: var(--purple);
    white-space: nowrap;
    border: 1px solid var(--purple-100);
}
.pill.green {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.pill.red {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.pill.amber {
    background: var(--gold-50);
    color: var(--gold-dark);
    border-color: var(--gold-100);
}
.pill.gray {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

/* Form Controls */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0;
}
.field {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 10px;
    min-width: 130px;
    color: var(--navy);
    outline: none;
    transition: all 0.15s ease;
}
.field:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(112, 32, 130, 0.12);
}
.search { min-width: 280px; flex: 1; }

.progress {
    height: 8px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    min-width: 60px;
}
.progress i {
    display: block;
    background: linear-gradient(90deg, #702082, #c59b27);
    height: 100%;
    border-radius: 10px;
}
.progress.teal i { background: var(--gold); }

.notice {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--purple-50);
    color: var(--purple-dark);
    font-size: 13px;
    border: 1px solid var(--purple-100);
}
.notice.warn {
    background: #fffbeb;
    border-color: #fef3c7;
    color: #92400e;
}
.notice.good {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

/* Candidate Exam Experience */
.exam-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 0;
    min-height: 100vh;
}
.exam-aside {
    background: #ffffff;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    padding: 24px 18px;
}
.exam-top {
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.exam-top .brand { padding: 0; font-size: 16px; }

.timer {
    padding: 8px 18px;
    background: var(--purple-50);
    border: 1px solid var(--purple-100);
    border-radius: 12px;
    min-width: 130px;
    text-align: center;
    line-height: 1.2;
}
.timer small {
    display: block;
    color: var(--purple);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.timer strong {
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    color: var(--purple-dark);
}
.timer.over {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}
.timer.over strong { color: var(--danger); }

.exam-main { min-width: 0; }
.exam-scroll {
    padding: 28px 32px 115px;
    max-width: 1140px;
    margin: auto;
}
.exam-intro { margin-bottom: 22px; }
.exam-intro h1 {
    margin: 6px 0 4px;
    font-size: 24px;
    font-weight: 800;
    color: var(--navy);
}
.exam-intro p { margin: 0; color: var(--muted); font-size: 13px; }

.exam-item {
    scroll-margin-top: 90px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: border-color 0.15s ease;
}
.exam-item:focus-within {
    border-color: rgba(112, 32, 130, 0.4);
}

.question-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}
.qnum {
    height: 38px;
    width: 38px;
    flex: none;
    background: var(--purple-50);
    color: var(--purple);
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    border: 1px solid var(--purple-100);
}
.qtitle { font-weight: 800; font-size: 15px; color: var(--navy); }
.qbody { padding-left: 52px; }

.options { display: grid; gap: 8px; margin-top: 16px; }
.option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    cursor: pointer;
    background: #ffffff;
    transition: all 0.15s ease;
}
.option:hover {
    background: #faf7fd;
    border-color: #d8b4e2;
}
.option:has(input:checked) {
    background: linear-gradient(135deg, #fbf5fd 0%, #fdf9e2 100%);
    border-color: var(--purple);
    box-shadow: 0 0 0 1px var(--purple);
}
.option input {
    accent-color: var(--purple);
    margin-top: 3px;
}

.numgrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 14px 0;
}
.numgrid button {
    height: 38px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #4b5563;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.12s ease;
}
.numgrid button:hover {
    background: var(--purple-50);
    border-color: var(--purple);
    color: var(--purple);
}
.numgrid button.answered {
    background: #ecfdf5;
    color: #065f46;
    border-color: #6ee7b7;
    font-weight: 800;
}
.numgrid button.current {
    background: var(--purple);
    color: #ffffff;
    border-color: var(--purple);
    box-shadow: 0 2px 6px rgba(112, 32, 130, 0.3);
}

.bottom {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 270px;
    z-index: 25;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    gap: 16px;
    box-shadow: 0 -4px 16px rgba(31, 18, 53, 0.04);
}

/* Responsive adjustments */
@media(max-width: 1120px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid2 { grid-template-columns: 1fr; }
}
@media(max-width: 800px) {
    .exam-layout { grid-template-columns: 1fr; }
    .exam-aside { display: none; }
    .bottom { left: 0; }
    .exam-top { padding: 0 16px; }
    .exam-scroll { padding: 18px 16px 110px; }
}
