/* ===== Tema E-Voting SMAN 1 Air Saleh ===== */
:root {
    --ev-primary: #123c7c;
    --ev-primary-dark: #0b2752;
    --ev-accent: #f2b705;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.bg-ev {
    background: linear-gradient(135deg, var(--ev-primary-dark) 0%, var(--ev-primary) 60%, #1d5bb8 100%);
}

.btn-ev {
    --bs-btn-bg: var(--ev-primary);
    --bs-btn-border-color: var(--ev-primary);
    --bs-btn-hover-bg: var(--ev-primary-dark);
    --bs-btn-hover-border-color: var(--ev-primary-dark);
    --bs-btn-active-bg: var(--ev-primary-dark);
    --bs-btn-disabled-bg: #6c7a92;
    --bs-btn-disabled-border-color: #6c7a92;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.text-ev { color: var(--ev-primary); }
.bg-ev-subtle { background: #e7edf7; }

/* ===== Dashboard panitia (admin.php) ===== */

/* Badge "sedang berlangsung" dengan titik berdenyut */
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #e7f6ec;
    color: #0f7a3d;
    font-weight: 600;
    font-size: .8rem;
    padding: .3rem .7rem;
    border-radius: 999px;
}

.dot-live {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 rgba(22, 163, 74, .6);
    animation: denyut-live 1.8s infinite;
}

@keyframes denyut-live {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, .55); }
    70%  { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Kartu statistik dengan ikon bulat */
.stat-card .stat-ikon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Donut partisipasi dengan angka di tengah */
.donut-wrap {
    position: relative;
    width: 220px;
    height: 220px;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 62%;
    text-align: center;
    pointer-events: none;
    line-height: 1.2;
}

.donut-center .text-muted { font-size: .72rem; }

/* Daftar partisipasi per kelas */
.baris-kelas {
    border-bottom: 1px solid #eef1f5;
    transition: background-color .15s ease;
}

.baris-kelas:last-child { border-bottom: 0; }
.baris-kelas:hover { background: #f8f9fc; }

.bar-baik   { background-color: #198754; }
.bar-sedang { background-color: #f2b705; }
.bar-rendah { background-color: #dc3545; }
.bar-netral { background-color: #adb5bd; }

/* Papan hasil pemilihan (leaderboard) */
.leaderboard-foto {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
}

.leaderboard-foto .kandidat-foto,
.leaderboard-foto .kandidat-avatar {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
    font-size: .95rem;
}

.leaderboard-crown {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--ev-accent);
    color: #5a4400;
    font-size: .6rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.bar-unggul { background-color: var(--ev-accent); }
.bar-biasa  { background-color: var(--ev-primary); }

/* ===== Menu panitia (admin_nav.php) ===== */
.navbar-admin .nav-link {
    border-radius: .5rem;
    padding-left: .85rem !important;
    padding-right: .85rem !important;
}

.navbar-admin .nav-link.active {
    background: rgba(255, 255, 255, .16);
    font-weight: 600;
}

/* Foto kecil di tabel admin */
.foto-mini {
    width: 54px;
    flex-shrink: 0;
}

.foto-mini .kandidat-foto,
.foto-mini .kandidat-avatar {
    border-radius: .4rem;
}

.foto-mini .kandidat-avatar {
    font-size: 1.1rem;
}

.foto-preview {
    width: 150px;
}

.foto-preview .kandidat-avatar {
    font-size: 2.5rem;
}

/* Potong teks panjang menjadi 2 baris */
.teks-ringkas {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 420px;
}

[id] { scroll-margin-top: 1rem; }

/* ===== Login Kiosk (index.php) ===== */
.kiosk-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.kiosk-card {
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .3);
}

.kiosk-logo {
    width: 110px;
    height: auto;
}

.input-token {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: .6em;
    text-align: center;
    padding-left: 1.2em; /* imbangi letter-spacing agar angka tetap di tengah */
    font-family: "Consolas", "Courier New", monospace;
}

.input-token::placeholder {
    letter-spacing: .6em;
    color: #c5ccd8;
}

/* ===== Halaman Pemilihan (pemilihan.php) ===== */
.kandidat-card {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 1rem;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    height: 100%;
}

.kandidat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 .75rem 1.5rem rgba(18, 60, 124, .18) !important;
}

.btn-check:checked + .kandidat-card {
    border-color: var(--ev-accent);
    box-shadow: 0 0 0 .3rem rgba(242, 183, 5, .35) !important;
}

.btn-check:focus-visible + .kandidat-card {
    outline: 3px solid var(--ev-primary);
    outline-offset: 3px;
}

.kandidat-foto {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: .75rem;
    background: #e9eef6;
}

.kandidat-avatar {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: .75rem;
    background: linear-gradient(160deg, #dfe7f3, #b9c9e2);
    color: var(--ev-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 700;
}

.no-urut {
    position: absolute;
    top: .75rem;
    left: .75rem;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: var(--ev-primary);
    color: #fff;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.tanda-pilih {
    display: none;
    position: absolute;
    top: .75rem;
    right: .75rem;
    font-size: 2.25rem;
    color: var(--ev-accent);
    background: #fff;
    border-radius: 50%;
    line-height: 1;
}

.btn-check:checked + .kandidat-card .tanda-pilih {
    display: block;
}

.bar-kirim {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid #dee2e6;
    backdrop-filter: blur(4px);
}

.layar-sukses {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    padding: 1rem;
}

.layar-sukses .bi-check-circle-fill {
    font-size: 7rem;
    color: var(--ev-accent);
}

/* ===== Surat suara versi HP (pemilihan.php) ===== */
.ballot-body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.ballot-wrap { max-width: 640px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
.ballot-header { position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.ballot-progress { height: 4px; background: rgba(255, 255, 255, .2); }
.ballot-progress-isi { height: 100%; width: 0; background: var(--ev-accent); transition: width .25s ease; }

.ballot-cari { position: relative; }
.ballot-cari .bi-search { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #8a94a6; }
.ballot-cari input { padding-left: 2.4rem; border-radius: 2rem; }

.daftar-guru { display: flex; flex-direction: column; gap: .5rem; }
.guru-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .6rem .8rem; background: #fff; cursor: pointer;
    border: 2px solid #e3e8f0; border-radius: .9rem;
    transition: border-color .12s ease, background-color .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.guru-item[hidden] { display: none; }
.guru-item:active { background: #f3f6fb; }
.btn-check:checked + .guru-item { border-color: var(--ev-accent); background: #fffaf0; box-shadow: 0 0 0 .2rem rgba(242, 183, 5, .25); }
.btn-check:focus-visible + .guru-item { outline: 3px solid var(--ev-primary); outline-offset: 2px; }

.guru-foto { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; overflow: hidden; display: block; }
.guru-foto .kandidat-foto,
.guru-foto .kandidat-avatar { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; font-size: 1.1rem; object-fit: cover; }
.guru-info { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.guru-nama { font-weight: 600; line-height: 1.25; }
.guru-ket { font-size: .85rem; color: #6c757d; }
.guru-cek { font-size: 1.6rem; color: #d5dbe5; flex-shrink: 0; }
.btn-check:checked + .guru-item .guru-cek { color: var(--ev-accent); }

.ballot-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: rgba(255, 255, 255, .97); border-top: 1px solid #dee2e6;
    padding-bottom: env(safe-area-inset-bottom);
}
