/* ============================================================
   SUARA T12 — Stylesheet Utama
   Sistem E-Voting MPK & OSIS SMKN 1 Kedawung
   ============================================================ */

/* ---------- 0. RESET & BASE ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: #f4f6fa;
    color: #1e293b;
    line-height: 1.5;
    font-size: 15px;
    min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: #2563eb; text-decoration: none; transition: color .15s; }
a:hover { color: #1d4ed8; }

code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "SF Mono", Consolas, Monaco, monospace;
    color: #334155;
}

/* ---------- 1. UTILITIES ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.muted       { color: #64748b; }
.hidden      { display: none !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ---------- 2. NAVBAR ---------- */
.navbar {
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
}

.nav-menu a {
    color: #cbd5e1;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    transition: all .15s;
}
.nav-menu a:hover { background: #1e293b; color: #fff; }
.nav-menu a.active { background: #2563eb; color: #fff !important; font-weight: 600; }

.nav-user {
    color: #cbd5e1;
    font-size: 13px;
    padding: 8px 12px;
    border-right: 1px solid #334155;
    margin-right: 4px;
    white-space: nowrap;
}

.btn-logout { background: #dc2626 !important; color: #fff !important; font-weight: 600; }
.btn-logout:hover { background: #b91c1c !important; }

/* ---------- 3. BUTTONS ---------- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-align: center;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
    user-select: none;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; color: #fff; }

.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }

.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-outline:hover { background: rgba(255,255,255,.1); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-xl {
    padding: 18px 32px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 12px;
    margin: 8px;
}

.btn-block { width: 100%; display: block; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- 4. FORMS ---------- */
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

input[type="checkbox"], input[type="radio"] {
    width: auto;
    margin-right: 6px;
    cursor: pointer;
}

input[type="file"] { padding: 8px; }

textarea { resize: vertical; min-height: 80px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 4px;
    color: #334155;
}
label input[type="checkbox"] { margin-right: 6px; }

.form-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.form-card h2 { margin-bottom: 12px; font-size: 18px; }

details.form-card > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    padding: 4px 0;
    list-style: none;
}
details.form-card > summary::-webkit-details-marker { display: none; }
details.form-card > summary::before { content: "▸ "; }
details.form-card[open] > summary::before { content: "▾ "; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 5. ALERTS ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-ok      { background: #dcfce7; color: #166534; border-color: #86efac; }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* ---------- 6. TABLE ---------- */
.table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    margin-bottom: 20px;
}
.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    vertical-align: middle;
}
.table th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: .5px;
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* ---------- 7. STATS CARDS ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    border-left: 4px solid #cbd5e1;
}
.stat-card.ok    { border-left-color: #16a34a; }
.stat-card.warn  { border-left-color: #f59e0b; }
.stat-card.info  { border-left-color: #2563eb; }
.stat-card.error { border-left-color: #dc2626; }

.stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}
.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-top: 6px;
    color: #0f172a;
}

/* ---------- 8. PROGRESS BAR ---------- */
.progress-bar {
    background: #e2e8f0;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
    width: 100%;
}
.progress-bar.small { height: 6px; margin: 4px 0; }
.progress-fill {
    background: linear-gradient(90deg, #2563eb, #16a34a);
    height: 100%;
    transition: width .4s ease;
    border-radius: 999px;
}

/* ---------- 9. BADGE ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.badge-persiapan { background: #fef3c7; color: #92400e; }
.badge-aktif     { background: #dcfce7; color: #166534; }
.badge-selesai   { background: #fee2e2; color: #991b1b; }

/* ---------- 10. LOGIN PAGE ---------- */
.login-body {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .brand { text-align: center; margin-bottom: 24px; }
.login-card .brand h1 { font-size: 24px; margin-bottom: 8px; color: #0f172a; }
.login-card .brand p { color: #64748b; font-size: 13px; line-height: 1.5; }
.login-card button { margin-top: 20px; }

/* ---------- 11. KIOSK ---------- */
.kiosk-body {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
}
.kiosk-header { text-align: center; padding: 20px 0; }
.kiosk-header h1 { font-size: 32px; margin-bottom: 6px; }
.kiosk-header p { color: #cbd5e1; font-size: 14px; }
.kiosk-header.small p { font-size: 18px; margin-bottom: 10px; color: #fff; }

.steps {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.steps span {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    font-size: 13px;
    color: #cbd5e1;
    transition: all .2s;
}
.steps span.active { background: #2563eb; color: #fff; font-weight: bold; }

.kiosk-pin-card {
    background: #fff;
    color: #1e293b;
    max-width: 640px;
    margin: 40px auto;
    padding: 36px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    text-align: center;
}
.kiosk-pin-card h2 {
    font-size: 22px;
    margin-bottom: 6px;
    color: #0f172a;
}

/* Input PIN utama */
.kiosk-pin-card input#pinInput {
    font-size: 48px;
    text-align: center;
    letter-spacing: 24px;
    padding: 20px;
    padding-right: 0; /* compensate letter-spacing on last char */
    font-family: "SF Mono", Consolas, Monaco, monospace;
    font-weight: bold;
    border: 2px solid #cbd5e1;
    text-transform: uppercase;
    background: #f8fafc;
    cursor: default;
    caret-color: transparent;
    color: #0f172a;
}
.kiosk-pin-card input#pinInput:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 4px rgba(37,99,235,.2);
}
.kiosk-pin-card input#pinInput::placeholder {
    color: #cbd5e1;
    letter-spacing: 24px;
}

/* ---------- 12. NUMPAD (ANGKA & ALPHA) ---------- */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 20px;
}
.numpad .num {
    padding: 20px;
    font-size: 24px;
    font-weight: bold;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    color: #0f172a;
    transition: all .1s;
    user-select: none;
}
.numpad .num:hover { background: #e2e8f0; }
.numpad .num:active { background: #cbd5e1; transform: scale(.97); }

/* Numpad alfanumerik (8 kolom) */
.numpad.alpha {
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}
.numpad.alpha .num {
    padding: 14px 0;
    font-size: 20px;
    min-width: 0;
}
.numpad.alpha .num.back {
    background: #fef3c7;
    color: #92400e;
}
.numpad.alpha .num.back:hover { background: #fde68a; }
.numpad.alpha .num.wide {
    grid-column: span 4;
    font-size: 16px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}
.numpad.alpha .num.wide:hover { background: #fecaca; }

/* ---------- 13. KANDIDAT GRID ---------- */
.candidate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px;
}
.candidate-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    position: relative;
    display: block;
}
.candidate-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.candidate-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.candidate-card input:checked ~ .cand-body {
    border: 4px solid #16a34a;
    border-radius: 16px;
}
.candidate-card input:checked ~ .cand-body::after {
    content: "✓ DIPILIH";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #16a34a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}
.cand-body {
    padding: 20px;
    text-align: center;
    color: #1e293b;
    position: relative;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 16px;
    transition: border-color .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.cand-no {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2563eb;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.cand-body img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    margin: 10px 0;
    border: 3px solid #e2e8f0;
}
.cand-ph {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    margin: 10px 0;
    color: #94a3b8;
}
.cand-body h3 { font-size: 17px; margin-top: 4px; color: #0f172a; }
.cand-body .muted { font-size: 13px; }

/* ---------- 14. CONFIRM BOX ---------- */
.confirm-box {
    background: #fff;
    color: #1e293b;
    max-width: 800px;
    margin: 20px auto;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.confirm-box h2 { margin-bottom: 8px; color: #0f172a; }
.confirm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 24px 0;
}
.confirm-grid h4 {
    margin-bottom: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .5px;
}
.confirm-grid img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto 10px;
    border: 3px solid #e2e8f0;
}
.confirm-grid p { font-size: 15px; }

/* ---------- 15. THANK YOU PAGE ---------- */
.center-all { display: flex; align-items: center; justify-content: center; }
.thank-box {
    background: #fff;
    color: #1e293b;
    padding: 60px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    max-width: 500px;
}
.thank-icon { font-size: 80px; margin-bottom: 20px; line-height: 1; }
.thank-box h1 { font-size: 28px; margin-bottom: 10px; color: #0f172a; }
.thank-box p { color: #64748b; font-size: 15px; }

/* ---------- 16. PROFILE KANDIDAT ---------- */
.profile-box {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    margin-top: 20px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.profile-left { text-align: center; }
.profile-img {
    width: 100%;
    max-width: 260px;
    border-radius: 12px;
    margin: 0 auto 16px;
    border: 3px solid #e2e8f0;
}
.profile-left h1 { font-size: 22px; margin-bottom: 6px; color: #0f172a; }
.profile-right h3 {
    font-size: 15px;
    color: #2563eb;
    margin: 20px 0 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
}
.profile-right h3:first-child { margin-top: 0; }
.profile-right p { color: #334155; font-size: 14px; line-height: 1.6; }

.video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 20px;
    background: #0f172a;
}
.video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- 17. TOOLBAR & INLINE FORM ---------- */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form input,
.inline-form select {
    width: auto;
    min-width: 140px;
}
.inline-form label {
    margin: 0;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* ---------- 18. PRINT PIN CARD ---------- */
@media screen {
    .pin-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-top: 20px;
    }
}

.pin-card {
    border: 1.5px dashed #333;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-family: "SF Mono", Consolas, Monaco, monospace;
    background: #fff;
    color: #000;
}
.pin-card .school { font-size: 10px; line-height: 1.3; }
.pin-card .name   { font-weight: bold; font-size: 12px; margin: 4px 0; }
.pin-card .kelas  { font-size: 10px; }

.pin-card .pin {
    font-size: 26px;
    letter-spacing: 8px;
    font-weight: bold;
    margin: 8px 0;
    text-transform: uppercase;
    background: #f1f5f9;
    padding: 6px 10px 6px 18px; /* adjust letter-spacing visual center */
    border-radius: 4px;
    display: inline-block;
    font-family: "SF Mono", Consolas, Monaco, monospace;
    color: #000;
}
.pin-card .hint {
    font-size: 9px;
    color: #555;
    margin-top: 4px;
}

/* ---------- 19. PRINT STYLES ---------- */
@media print {
    .no-print,
    .navbar,
    .toolbar,
    .btn,
    .btn-logout,
    .nav-menu {
        display: none !important;
    }
    body {
        background: #fff;
        padding: 0;
        margin: 0;
    }
    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    h1 { font-size: 16px; margin-bottom: 10px; }

    .pin-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .pin-card {
        page-break-inside: avoid;
        break-inside: avoid;
        border: 1.5px dashed #000;
    }

    @page { margin: 10mm; size: A4; }
}

/* ---------- 20. RESPONSIVE ---------- */
@media (max-width: 900px) {
    .profile-box { grid-template-columns: 1fr; padding: 20px; }
    .confirm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .container { padding: 16px; }
    .navbar { flex-wrap: wrap; height: auto; padding: 12px; }
    .nav-menu { margin-left: 0; flex-wrap: wrap; gap: 4px; width: 100%; margin-top: 8px; }
    .nav-user { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }

    .kiosk-header h1 { font-size: 22px; }
    .kiosk-pin-card { padding: 20px; margin: 20px auto; }
    .kiosk-pin-card h2 { font-size: 18px; }
    .kiosk-pin-card input#pinInput {
        font-size: 34px;
        letter-spacing: 14px;
        padding: 14px;
    }
    .kiosk-pin-card input#pinInput::placeholder { letter-spacing: 14px; }

    /* Numpad alpha: 6 kolom di tablet */
    .numpad.alpha { grid-template-columns: repeat(6, 1fr); }
    .numpad.alpha .num { padding: 12px 0; font-size: 18px; }
    .numpad.alpha .num.wide { grid-column: span 3; font-size: 14px; }

    .candidate-grid { grid-template-columns: 1fr; padding: 12px; }
    .confirm-box, .thank-box { padding: 24px; }
    .thank-icon { font-size: 60px; }
    .thank-box h1 { font-size: 22px; }
    .btn-xl { padding: 14px 22px; font-size: 16px; width: 100%; margin: 4px 0; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px 6px; }
    .inline-form input, .inline-form select { width: 100%; }
}

@media (max-width: 480px) {
    .login-card { padding: 24px; }
    .login-card .brand h1 { font-size: 20px; }
    .stat-num { font-size: 22px; }

    /* Numpad alpha: 5 kolom di HP */
    .numpad.alpha { grid-template-columns: repeat(5, 1fr); }
    .numpad.alpha .num { padding: 10px 0; font-size: 16px; }
    .numpad.alpha .num.wide { grid-column: span 2; font-size: 12px; }

    .kiosk-pin-card input#pinInput {
        font-size: 28px;
        letter-spacing: 10px;
    }
    .kiosk-pin-card input#pinInput::placeholder { letter-spacing: 10px; }
}