/* =========================================================
   Sistem Ujian Online — gaya aplikasi (di atas Bootstrap 5)
   ========================================================= */
:root {
  --brand: #0f6e66;
  --brand-dark: #0a4f4a;
  --brand-soft: #e6f2f0;
  --ink: #1d2733;
  --muted: #6b7785;
  --line: #e3e8ee;
  --bg: #f4f6f8;
  --sidebar: #12302d;
  --sidebar-ink: #c9dbd8;
  --bs-primary: #0f6e66;
  --bs-primary-rgb: 15, 110, 102;
  --bs-link-color: #0f6e66;
  --bs-link-color-rgb: 15, 110, 102;
  --bs-link-hover-color: #0a4f4a;
  --bs-body-color: #1d2733;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { background: var(--bg); color: var(--ink); }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); }
.text-bg-primary { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #5fa9a2; box-shadow: 0 0 0 .2rem rgba(15,110,102,.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }
.active > .page-link { background: var(--brand); border-color: var(--brand); }

/* ---------- Kerangka ---------- */
.topbar { height: 60px; z-index: 1030; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.app-shell { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 248px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-ink); }
@media (min-width: 992px) { .sidebar, .sidebar.offcanvas-lg { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; background-color: var(--sidebar) !important; } }
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--sidebar); --bs-offcanvas-color: var(--sidebar-ink); --bs-offcanvas-width: 260px; }
.sidebar-inner { padding: 1rem 0 2rem; }
.sidebar-inst { color: #8fb3ae; text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; }
.sidebar .nav-heading { padding: 1rem 1.25rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #7fa39e; }
.sidebar .nav-link { color: var(--sidebar-ink); padding: .5rem 1.25rem; display: flex; align-items: center; gap: .7rem; border-left: 3px solid transparent; font-size: .93rem; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar .nav-link.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: #5ec4b6; }
.content { flex: 1; min-width: 0; padding: 1.5rem; }
@media (max-width: 575.98px) { .content { padding: 1rem .75rem; } }
.content-plain { min-height: 100vh; }

/* ---------- Komponen ---------- */
.card { border: 1px solid var(--line); border-radius: .6rem; }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: .6rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.tone-primary { background: var(--brand-soft); color: var(--brand); }
.tone-info { background: #e7f1fb; color: #1d63a8; }
.tone-warning { background: #fdf3e1; color: #a76506; }
.tone-danger { background: #fbe9ea; color: #b42332; }
.tone-success { background: #e8f5ea; color: #217a37; }
.tone-dark { background: #eceff3; color: #3a4552; }
.table > :not(caption) > * > * { padding: .6rem .7rem; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table-card { margin-bottom: 0; }
.table a:not(.btn), .nav-tabs a, .card-header a { text-decoration: none; }
.table a:not(.btn):hover { text-decoration: underline; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: .6rem; padding: .75rem; margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.q-content img { max-width: 100%; height: auto; }
.q-content table { width: auto; max-width: 100%; }
.q-content p:last-child { margin-bottom: 0; }
.key-badge { background: #e8f5ea; color: #217a37; border: 1px solid #b9dfc1; }
.small-muted { font-size: .82rem; color: var(--muted); }

/* ---------- Login ---------- */
.login-bg { background: linear-gradient(135deg, #0a3f3b 0%, #0f6e66 60%, #2a8f84 100%); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 430px; border: 0; border-radius: 1rem; }

/* ---------- Editor teks soal ---------- */
.rte { border: 1px solid #ced4da; border-radius: .45rem; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: .3rem; border-bottom: 1px solid var(--line); background: #fafbfc; border-radius: .45rem .45rem 0 0; }
.rte-toolbar button { border: 0; background: transparent; padding: .25rem .45rem; border-radius: .3rem; color: #3a4552; line-height: 1; }
.rte-toolbar button:hover { background: #e9edf1; }
.rte-toolbar .sep { width: 1px; background: var(--line); margin: 0 .25rem; }
.rte-area { min-height: 140px; padding: .6rem .75rem; outline: none; overflow-x: auto; }
.rte-area:empty::before { content: attr(data-placeholder); color: #9aa5b1; }
.rte-area table { border-collapse: collapse; }
.rte-area td, .rte-area th { border: 1px solid #adb5bd; padding: .25rem .5rem; min-width: 40px; }
.rte-area img { max-width: 100%; }
.rte.rte-sm .rte-area { min-height: 60px; }

/* ---------- Halaman ujian mahasiswa ---------- */
.exam-mode { background: #eef1f4; }
.exam-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.exam-timer { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 700; padding: .25rem .9rem; border-radius: .5rem; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.exam-timer.warn { background: #fdf3e1; color: #a76506; }
.exam-timer.danger { background: #fbe9ea; color: #b42332; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.save-status { font-size: .85rem; white-space: nowrap; }
.save-status.saved { color: #217a37; }
.save-status.saving { color: #a76506; }
.save-status.error { color: #b42332; font-weight: 600; }
.q-card { border-radius: .75rem; }
.q-number { font-weight: 700; color: var(--brand-dark); }
.option-item { display: flex; gap: .75rem; align-items: flex-start; border: 1px solid var(--line); border-radius: .6rem; padding: .75rem .9rem; margin-bottom: .6rem; cursor: pointer; background: #fff; transition: border-color .12s, background .12s; }
.option-item:hover { border-color: #9ccac4; }
.option-item.selected { border-color: var(--brand); background: var(--brand-soft); }
.option-item input { margin-top: .2rem; }
.option-letter { font-weight: 700; min-width: 1.4rem; }
.q-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.q-nav button { height: 40px; border-radius: .45rem; border: 1px solid #cfd6de; background: #fff; font-weight: 600; font-size: .9rem; position: relative; }
.q-nav button.answered { background: var(--brand); color: #fff; border-color: var(--brand); }
.q-nav button.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #f0a30a; }
.q-nav button.current { outline: 2px solid #1d2733; outline-offset: 1px; }
.q-nav button:disabled { opacity: .45; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.essay-box { min-height: 220px; font-size: 1rem; }
.exam-lock { position: fixed; inset: 0; background: rgba(20,30,40,.6); z-index: 2000; display: none; align-items: center; justify-content: center; }
.exam-lock.show { display: flex; }

/* ---------- Cetak ---------- */
.print-only { display: none; }
@media print {
  .no-print, .sidebar, .topbar, .btn, .filter-bar, .pagination, .alert { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; font-size: 11pt; }
  .content { padding: 0; }
  .card { border: 0; }
  .table { font-size: 10pt; }
  .table thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { text-decoration: none; color: #000; }
}
