/* ============================================================
   Tema aplikasi CAT
   Warna utama diambil dari CSS variable yang diisi dari
   Pengaturan Aplikasi (--brand, --brand-dark, --accent, --panel)
   ============================================================ */
:root {
    --brand: #0B6E9E;
    --brand-dark: #07527A;
    --accent: #E8762A;
    --panel: #22B3DF;
    --ink: #1F2D3D;
    --ink-soft: #5C6B7A;
    --line: #DDE5EA;
    --bg: #F4F7F9;
    --putih: #FFFFFF;
    --sukses: #1C8C5C;
    --bahaya: #D64545;
    --kuning: #E8A22A;
    --radius: 8px;
    --shadow: 0 6px 18px rgba(14, 45, 66, .10);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; }

/* ---------------------------------------------------------- Header */
.topbar {
    background: var(--putih);
    border-bottom: 1px solid var(--line);
}

.brand {
    max-width: 1220px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-text { min-width: 0; }

.brand-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .2px;
    text-transform: uppercase;
    /* judul panjang (mis. "SISTEM INFORMASI LATIHAN UJIAN KOMPETENSI PENYULUH KB/ PLKB")
       harus tetap rapi: turun baris dengan jarak wajar, tidak meluber */
    line-height: 1.22;
    overflow-wrap: anywhere;
}

.brand-text p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--ink-soft);
}

.topbar-kecil .brand { padding: 10px 20px; }
.topbar-kecil .brand-logo { width: 48px; height: 48px; }
.topbar-kecil .brand-text h1 { font-size: 17px; }
.topbar-kecil .brand-text p { font-size: 12px; }

/* ------------------------------------------------------ Bar waktu */
.timerbar {
    position: sticky;
    top: 0;
    z-index: 35;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 50px;
    transition: background .3s ease;
}

.timerbar .label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .3px;
}

.timerbar .jam {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 1px;
}

.timerbar.peringatan { background: var(--accent); }
.timerbar.kritis { background: var(--bahaya); animation: denyut 1.2s infinite; }

@keyframes denyut {
    0%, 100% { opacity: 1; }
    50% { opacity: .82; }
}

/* -------------------------------------------------------- Halaman ujian */
.exam-page { padding-bottom: 96px; }

.exam-wrap {
    max-width: 1220px;
    margin: 0 auto;
    padding: 18px 24px 0;
}

.exam-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0 12px;
    border-bottom: 2px solid var(--brand);
    margin-bottom: 16px;
}

.exam-head h2 {
    font-size: 19px;
    color: var(--brand);
    letter-spacing: .6px;
    font-weight: 700;
}

.exam-head .kanan { display: flex; align-items: center; gap: 10px; }

.btn-selesai {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 9px 26px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}

.btn-selesai:hover { filter: brightness(1.06); }

.exam-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.soal-panel {
    background: var(--putih);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px 30px;
    min-height: 420px;
}

.soal { display: none; }
.soal.aktif { display: block; }

.soal-teks {
    display: flex;
    gap: 14px;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 22px;
}

.nomor-badge {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.opsi-list { display: flex; flex-direction: column; gap: 6px; }

.opsi {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16.5px;
    line-height: 1.5;
    transition: background .15s ease;
    border: 1px solid transparent;
}

.opsi:hover { background: #F0F8FB; }
.opsi input { position: absolute; opacity: 0; pointer-events: none; }

.opsi .bulat {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #AEBFC9;
    background: #fff;
    margin-top: 2px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.opsi input:checked + .bulat {
    border: 7px solid var(--brand);
}

.opsi.terpilih {
    background: #E7F4FA;
    border-color: #BFE3F1;
    font-weight: 600;
}

.opsi input:focus-visible + .bulat { box-shadow: 0 0 0 3px rgba(34, 179, 223, .35); }


/* ---------------------------------------------------- Panel nomor soal */
.grid-panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 14px;
    color: #fff;
    box-shadow: var(--shadow);
}

.grid-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .4px;
    padding: 0 2px 10px;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
    max-height: 430px;
    overflow-y: auto;
    padding-right: 4px;
}

.grid::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .45); border-radius: 8px; }

.gbtn {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid #BFE0ED;
    background: #D6EFF8;
    color: #0A5477;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform .1s ease;
}

.gbtn:hover { transform: translateY(-1px); }

.gbtn.dijawab {
    background: var(--brand);
    border-color: var(--brand-dark);
    color: #fff;
}

.gbtn.dijawab::before {
    content: "✓";
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 9px;
    line-height: 1;
    opacity: .95;
}

.gbtn.aktif {
    background: #fff;
    color: var(--ink);
    border: 2px solid var(--brand);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .6);
}


.grid-foot {
    margin-top: 12px;
    background: rgba(255, 255, 255, .18);
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.grid-keterangan {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 9px;
    font-size: 11px;
    opacity: .95;
}

.grid-keterangan span { display: inline-flex; align-items: center; gap: 5px; }
.grid-keterangan i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.ket-dijawab { background: var(--brand); border: 1px solid var(--brand-dark); }
.ket-belum { background: #D6EFF8; border: 1px solid #BFE0ED; }
.ket-aktif { background: #fff; border: 2px solid var(--brand); }

/* ------------------------------------------------------------- Footer */
.footerbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--brand-dark);
    color: #fff;
    text-align: center;
    padding: 14px 96px;
    font-size: 13.5px;
    z-index: 40;
}

.footerbar p { margin: 0; }

.footerbar .nav-arrow {
    position: absolute;
    bottom: 8px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--panel);
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .12s ease;
}

.footerbar .nav-arrow:hover { transform: scale(1.05); }
.footerbar .nav-arrow:disabled { opacity: .45; cursor: default; transform: none; }
.footerbar .nav-kiri { left: 20px; }
.footerbar .nav-kanan { right: 20px; }

/* -------------------------------------------------------- Modal */
.modal-latar {
    position: fixed;
    inset: 0;
    background: rgba(16, 34, 48, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 90;
}

.modal-latar.buka { display: flex; }

.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 460px;
    width: 100%;
    padding: 26px 26px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
}

.modal h3 { font-size: 19px; margin-bottom: 10px; color: var(--ink); }
.modal p { margin: 0 0 18px; color: var(--ink-soft); }
.modal-aksi { display: flex; gap: 10px; justify-content: flex-end; }

/* ------------------------------------------------------- Tombol/umum */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn-aksen { background: var(--accent); }
.btn-abu { background: #EEF2F5; color: var(--ink); border-color: var(--line); }
.btn-bahaya { background: var(--bahaya); }
.btn-kecil { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.alert {
    border-radius: 8px;
    padding: 11px 15px;
    font-size: 14px;
    margin: 0 0 16px;
    border: 1px solid transparent;
}

.alert-info { background: #EAF6FB; border-color: #C4E5F2; color: #0A5477; }
.alert-sukses { background: #E9F7F0; border-color: #BFE6D3; color: #146B47; }
.alert-bahaya { background: #FDECEC; border-color: #F5C6C6; color: #9B2C2C; }
.alert-warning { background: #FFF6E5; border-color: #F3DDAE; color: #8A5A00; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.badge-biru { background: #E4F1F8; color: var(--brand); }
.badge-hijau { background: #E5F5EC; color: var(--sukses); }
.badge-merah { background: #FBEAEA; color: var(--bahaya); }
.badge-kuning { background: #FDF2DC; color: #8A5A00; }

/* --------------------------------------------------- Halaman login */
.halaman-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
    background:
        radial-gradient(1000px 460px at 12% -10%, #DCEFF8 0%, transparent 60%),
        radial-gradient(900px 460px at 92% 108%, #E4F6FB 0%, transparent 58%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 14px;
    padding: 30px 30px 22px;
    box-shadow: 0 18px 44px rgba(16, 48, 70, .12);
    border: 1px solid #E8EFF3;
}

.login-head { text-align: center; margin-bottom: 22px; }
/* Logo instansi di halaman login: mendukung lambang persegi maupun logo lebar */
.login-logo {
    height: 96px;
    width: auto;
    max-width: min(280px, 100%);
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}
.login-head h1 {
    font-size: 19px;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.32;
    overflow-wrap: anywhere;
}
.login-head p { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }

.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CFDBE3;
    border-radius: 7px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--panel);
    box-shadow: 0 0 0 3px rgba(34, 179, 223, .18);
}

.login-aksi { margin-top: 20px; }
.login-aksi .btn { width: 100%; padding: 11px; font-size: 15px; }
.login-foot { text-align: center; font-size: 11.5px; color: #93A3AF; margin: 20px 0 0; }
.login-link { display: block; text-align: center; font-size: 13px; margin-top: 14px; }

/* --------------------------------------------------- Halaman hasil */
.hasil-wrap { max-width: 780px; margin: 26px auto 40px; padding: 0 20px; }

.hasil-kartu {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hasil-atas { padding: 26px 28px; text-align: center; border-bottom: 1px solid var(--line); }
.hasil-atas h2 { font-size: 18px; color: var(--ink); }
.hasil-atas .sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }

.skor-bulat {
    width: 138px;
    height: 138px;
    border-radius: 50%;
    margin: 18px auto 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--brand);
    box-shadow: 0 10px 26px rgba(11, 110, 158, .3);
}

.skor-bulat.lulus { background: var(--sukses); box-shadow: 0 10px 26px rgba(28, 140, 92, .28); }
.skor-bulat.gagal { background: var(--bahaya); box-shadow: 0 10px 26px rgba(214, 69, 69, .26); }
.skor-bulat b { font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.skor-bulat small { font-size: 12px; opacity: .9; margin-top: 4px; }

.hasil-rinci {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
}

.hasil-rinci div { background: #fff; padding: 14px 10px; text-align: center; }
.hasil-rinci span { display: block; font-size: 12px; color: var(--ink-soft); }
.hasil-rinci b { font-size: 19px; color: var(--ink); }

.hasil-aksi { display: flex; gap: 10px; justify-content: center; padding: 20px; }

@media (max-width: 780px) {
    .hasil-rinci { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------- Responsif */
.hamburger-grid {
    display: none;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
}

@media (max-width: 980px) {
    .exam-body { grid-template-columns: 1fr; }
    .brand-text h1 { font-size: 17px; line-height: 1.24; }
    .grid-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 320px;
        max-width: 88vw;
        border-radius: 0;
        z-index: 70;
        transform: translateX(105%);
        transition: transform .25s ease;
        overflow-y: auto;
        padding-top: 18px;
    }
    .grid-panel.buka { transform: translateX(0); }
    .grid { max-height: none; }
    .hamburger-grid { display: inline-flex; }
    .exam-wrap { padding: 14px 14px 0; }
    .soal-panel { padding: 20px 18px 24px; }
    .soal-teks { font-size: 16.5px; }
    .opsi { font-size: 15.5px; padding: 11px 10px; }
    .brand { padding: 12px 16px; gap: 12px; }
    .brand-logo { width: 56px; height: 56px; }
    .brand-text h1 { font-size: 16px; }
    .brand-text p { font-size: 11.5px; }
    .footerbar { padding: 13px 80px; font-size: 11.5px; }
    .footerbar .nav-arrow { width: 50px; height: 50px; font-size: 22px; bottom: 10px; }
    .exam-page { padding-bottom: 88px; }
    .grid-tutup { display: inline-flex; }
}

.grid-tutup {
    display: none;
    background: rgba(255, 255, 255, .25);
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

/* ------------------------------------------------- Judul panjang di layar kecil */
@media (max-width: 480px) {
    .brand-text h1 { font-size: 14.5px; line-height: 1.25; }
    .brand-text p { font-size: 11px; }
    .login-head h1 { font-size: 16px; line-height: 1.35; }
    .login-head p { font-size: 12px; }
}
