/* ==========================================================================
   IMM UMSURA BRAND THEME OVERRIDES (CRIMSON / MAROON & GOLD)
   ========================================================================== */

:root,
html,
[data-theme="default"],
[data-theme-colors="default"],
[data-theme-colors="green"],
[data-bs-theme="light"] {
    --vz-primary: #800000 !important;
    --vz-primary-rgb: 128, 0, 0 !important;
    --vz-primary-bg-subtle: rgba(128, 0, 0, 0.12) !important;
    --vz-primary-border-subtle: rgba(128, 0, 0, 0.25) !important;
    --vz-primary-text-emphasis: #800000 !important;
    --vz-primary-hover-bg: #680d11 !important;
    --vz-primary-hover-border: #680d11 !important;
    --vz-link-color: #800000 !important;
    --vz-link-hover-color: #680d11 !important;
}

[data-bs-theme="dark"] {
    --vz-primary: #ba1b1d !important;
    --vz-primary-rgb: 186, 27, 29 !important;
    --vz-primary-bg-subtle: rgba(186, 27, 29, 0.18) !important;
    --vz-primary-border-subtle: rgba(186, 27, 29, 0.35) !important;
    --vz-primary-text-emphasis: #ef4444 !important;
    --vz-primary-hover-bg: #991b1b !important;
    --vz-primary-hover-border: #991b1b !important;
    --vz-link-color: #f87171 !important;
    --vz-link-hover-color: #fca5a5 !important;
}

/* ── Auth Cover Background (Layar Luar Halaman Login) ── */
.auth-bg-cover {
    background: linear-gradient(135deg, #2b0305 0%, #5c0d12 40%, #7a0c13 75%, #991b1b 100%) !important;
    position: relative;
    overflow: hidden;
}

.auth-bg-cover > .bg-overlay {
    background-image: url(../images/cover-pattern.png) !important;
    background-position: center !important;
    background-size: cover !important;
    opacity: 0.12 !important;
    background-color: transparent !important;
}

.auth-bg-cover .footer {
    color: rgba(255, 255, 255, 0.75) !important;
}

.auth-bg-cover .footer p {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* ── Auth Left Banner Card ── */
.auth-one-bg {
    background-image: url(../../uploads/site/bg_auth.png);
    background-size: cover !important;
    background-position: center !important;
}

.auth-one-bg .bg-overlay {
    background: transparent !important;
    opacity: 0 !important;
}

/* ── Global Primary Elements ── */
.btn-primary {
    background-color: #800000 !important;
    border-color: #800000 !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #680d11 !important;
    border-color: #680d11 !important;
    color: #ffffff !important;
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(128, 0, 0, 0.3) !important;
}

.text-primary {
    color: #800000 !important;
}

.bg-primary {
    background-color: #800000 !important;
}

.form-check-input:checked {
    background-color: #800000 !important;
    border-color: #800000 !important;
}

.form-control:focus {
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 0.2rem rgba(128, 0, 0, 0.15) !important;
}

.error-validation {
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #f06548;
}

#loading-ajax {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 9999;
}

#reader {
    width: 100%;
    border: none !important;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#reader video {
    border-radius: 20px;
    transform: scaleX(-1);
    object-fit: cover;
}

.scanner-container {
    position: relative;
    text-align: center;
    background: var(--vz-card-bg, #fff);
    border-radius: 20px;
}

/* ── Modern Scanner Layout ── */
.scanner-card {
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
    background-color: var(--vz-card-bg, #fff);
}

.scanner-header {
    background: linear-gradient(155deg, #fff5f5 0%, #ffffff 100%);
    border-bottom: 5px solid #991b1b;
    padding: 1rem 1.5rem;
    position: relative;
}

.scanner-logo {
    max-height: 75px;
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.05));
    margin-bottom: 0;
}

.scanner-title {
    color: #8B0000;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0;
    font-size: 1.25rem;
}

.scanner-header-text {
    border-top: 2px solid #991b1b;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    text-align: center;
}

@media (min-width: 768px) {
    .scanner-header-text {
        border-top: none;
        border-left: 2px solid #991b1b;
        padding-top: 0;
        padding-left: 1rem;
        margin-top: 0;
        text-align: left;
    }
}

.scanner-body {
    background: #f3f6f9;
    padding: 1.25rem;
}

/* ── Result Card ── */
.scan-result-card {
    height: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 20px;
    background-color: var(--vz-card-bg, #fff);
    transition:
        background 0.4s ease,
        border-color 0.4s ease;
}

.idle-state {
    opacity: 0.5;
}

.result-state {
    display: none;
}

.result-state.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result icon pulse */
.result-icon-wrap {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 3.5rem;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-icon-wrap.success {
    background: rgba(10, 179, 156, 0.15);
    color: #0ab39c;
}
.result-icon-wrap.error {
    background: rgba(240, 101, 72, 0.15);
    color: #f06548;
}

.result-nama {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    word-break: break-word;
    text-align: center;
}

.result-tipe-badge {
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 8px;
    display: inline-block;
}

.result-msg {
    font-size: 1.5rem;
    line-height: 1.4;
    text-align: center;
    word-break: break-word;
    padding: 0 12px;
}

/* Background card saat hasil muncul */
.scan-result-card.state-success {
    background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%) !important;
    border: 2px solid #0ab39c !important;
}
.scan-result-card.state-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fff5f5 100%) !important;
    border: 2px solid #f06548 !important;
}
.scan-result-card.state-idle {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
}

/* ── Live Count ── */
.candidate-rank {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 35px;
    height: 35px;
    background-color: #800000;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(128, 0, 0, 0.4);
    z-index: 10;
}

.card-animate {
    transition: all 0.4s;
}

.card-animate:hover {
    transform: translateY(-5px);
}

/* ── DataTable & Monitoring ── */
.dt-buttons {
    margin-bottom: 15px;
}
.status-badge {
    font-size: 13px;
    padding: 5px 10px;
}
.snapshot-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}
.snapshot-img:hover {
    transform: scale(1.1);
}

/* ── 7-Column Responsive Grid ── */
@media (min-width: 992px) {
    .row-cols-lg-7 > * {
        flex: 0 0 auto;
        width: 14.285714%;
    }
}
@media (min-width: 1200px) {
    .row-cols-xl-7 > * {
        flex: 0 0 auto;
        width: 14.285714%;
    }
}
@media (min-width: 1400px) {
    .row-cols-xxl-7 > * {
        flex: 0 0 auto;
        width: 14.285714%;
    }
}

/* ── Bilik Vote ── */
.candidate-card {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
    position: relative;
}

.candidate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.candidate-card.selected {
    border-color: #800000;
    background-color: #fff5f5;
    box-shadow: 0 10px 20px rgba(128, 0, 0, 0.2);
}

.candidate-card .check-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2rem;
    color: #800000;
    display: none;
    background: #fff;
    border-radius: 50%;
    line-height: 1;
}

.candidate-card.selected .check-icon {
    display: block;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.candidate-img {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    object-position: top;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bottom-bar-spacer {
    height: 80px;
}

.vote-header-logo {
    max-height: 100px;
}

.candidate-detail-img {
    max-height: 250px;
    aspect-ratio: 3/4;
}

.visimisi-content {
    max-height: 320px;
    white-space: pre-wrap;
}

/* ── Scanner Camera Overlay & Snapshot Preview ── */
/* .reader-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
} */

.camera-prep-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99;
    border-radius: 16px;
    text-align: center;
    padding: 1.5rem;
    color: #ffffff;
    animation: fadeIn 0.3s ease;
}

.camera-prep-overlay.active {
    display: flex;
}

.camera-prep-overlay .prep-icon-box {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(247, 184, 75, 0.2);
    color: #f7b84b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: bounceDown 0.8s infinite alternate ease-in-out;
}

@keyframes bounceDown {
    from {
        transform: translateY(-8px);
    }
    to {
        transform: translateY(6px);
    }
}

.camera-prep-overlay .prep-alert-text {
    font-size: 1.75rem;
    font-weight: 900;
    color: #f7b84b;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
    margin-bottom: 0.25rem;
}

.camera-prep-overlay .prep-sub-text {
    font-size: 1.15rem;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.camera-prep-overlay .prep-counter-box {
    font-size: 6.5rem;
    font-weight: 900;
    color: #ef4444;
    line-height: 1;
    text-shadow: 0 4px 20px rgba(239, 68, 68, 0.6);
    animation: pulseCount 1s infinite;
}

@keyframes pulseCount {
    0% {
        transform: scale(0.92);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(0.92);
        opacity: 0.85;
    }
}

.camera-flash-overlay {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    border-radius: 16px;
    transition: opacity 0.35s ease-out;
}

.camera-flash-overlay.flash {
    opacity: 0.95;
    transition: none;
}

.result-snapshot-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
    background: #f1f5f9;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═════════════════════════════════════════════════════════════════
   VELZON DARK MODE INTEGRATION (Standards Compliant)
   Targeting both [data-bs-theme="dark"] and [data-layout-mode="dark"]
   ═════════════════════════════════════════════════════════════════ */

/* 1. Loading Overlay */
[data-bs-theme="dark"] #loading-ajax,
[data-layout-mode="dark"] #loading-ajax {
    background-color: rgba(0, 0, 0, 0.7);
}

/* 2. Html5Qrcode Reader Box */
#reader {
    background: #f8f9fa;
}
[data-bs-theme="dark"] #reader,
[data-layout-mode="dark"] #reader {
    background: var(--vz-tertiary-bg, #2a2d31) !important;
    color: var(--vz-body-color, #ced4da) !important;
}

[data-bs-theme="dark"] #reader button,
[data-layout-mode="dark"] #reader button,
[data-bs-theme="dark"] #reader__dashboard_section_csr button,
[data-layout-mode="dark"] #reader__dashboard_section_csr button {
    background-color: var(--vz-primary, #800000) !important;
    border-color: var(--vz-primary, #800000) !important;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 6px 16px;
    font-weight: 600;
}

[data-bs-theme="dark"] #reader a,
[data-layout-mode="dark"] #reader a {
    color: #3bc2b0 !important;
}

/* 3. Modern Scanner Card & Header */
[data-bs-theme="dark"] .scanner-card,
[data-layout-mode="dark"] .scanner-card {
    background-color: var(--vz-secondary-bg, #212529) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .scanner-header,
[data-layout-mode="dark"] .scanner-header {
    background: linear-gradient(155deg, rgba(153, 27, 27, 0.25) 0%, var(--vz-secondary-bg, #212529) 100%) !important;
    border-bottom: 5px solid #b91c1c;
}

[data-bs-theme="dark"] .scanner-title,
[data-layout-mode="dark"] .scanner-title {
    color: #ef4444 !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .scanner-body,
[data-layout-mode="dark"] .scanner-body {
    background: var(--vz-secondary-bg, #212529) !important;
}

/* 4. Active Agenda Info Banner inside Scanner Card */
[data-bs-theme="dark"] #card_active_agenda_banner,
[data-layout-mode="dark"] #card_active_agenda_banner {
    background: rgba(56, 113, 194, 0.15) !important;
    border: 1px solid rgba(56, 113, 194, 0.3) !important;
}

[data-bs-theme="dark"] #card_active_agenda_title,
[data-layout-mode="dark"] #card_active_agenda_title {
    color: #70a6f2 !important;
}

/* 5. Result Card States */
[data-bs-theme="dark"] .scan-result-card.state-idle,
[data-layout-mode="dark"] .scan-result-card.state-idle {
    background: var(--vz-secondary-bg, #212529) !important;
    border: 1px solid var(--vz-border-color, #2a2f34) !important;
}

[data-bs-theme="dark"] .scan-result-card.state-idle .idle-state i,
[data-bs-theme="dark"] .scan-result-card.state-idle .idle-state h2,
[data-bs-theme="dark"] .scan-result-card.state-idle .idle-state p,
[data-layout-mode="dark"] .scan-result-card.state-idle .idle-state i,
[data-layout-mode="dark"] .scan-result-card.state-idle .idle-state h2,
[data-layout-mode="dark"] .scan-result-card.state-idle .idle-state p {
    color: var(--vz-secondary-color, #878a99) !important;
}

[data-bs-theme="dark"] .scan-result-card.state-success,
[data-layout-mode="dark"] .scan-result-card.state-success {
    background: linear-gradient(135deg, rgba(10, 179, 156, 0.22) 0%, rgba(10, 179, 156, 0.08) 100%) !important;
    border: 2px solid #0ab39c !important;
}

[data-bs-theme="dark"] .scan-result-card.state-error,
[data-layout-mode="dark"] .scan-result-card.state-error {
    background: linear-gradient(135deg, rgba(240, 101, 72, 0.25) 0%, rgba(240, 101, 72, 0.08) 100%) !important;
    border: 2px solid #f06548 !important;
}

[data-bs-theme="dark"] .result-nama,
[data-layout-mode="dark"] .result-nama {
    color: var(--vz-emphasis-color, #ffffff) !important;
}

[data-bs-theme="dark"] .result-msg,
[data-layout-mode="dark"] .result-msg {
    color: var(--vz-body-color, #ced4da) !important;
}

[data-bs-theme="dark"] .result-snapshot-avatar,
[data-layout-mode="dark"] .result-snapshot-avatar {
    border-color: var(--vz-border-color, #32383e) !important;
    background: var(--vz-tertiary-bg, #2a2d31) !important;
}

/* 6. Scanner Info Box */
.scanner-info-box {
    background: #ffffff;
    border: 1px solid #dee2e6;
}
[data-bs-theme="dark"] .scanner-info-box,
[data-layout-mode="dark"] .scanner-info-box {
    background: var(--vz-tertiary-bg, #2a2d31) !important;
    border: 1px solid var(--vz-border-color, #2a2f34) !important;
}

/* 7. Bilik Suara */
[data-bs-theme="dark"] .bottom-bar,
[data-layout-mode="dark"] .bottom-bar {
    background: var(--vz-secondary-bg, #212529) !important;
    border-top: 1px solid var(--vz-border-color, #2a2f34) !important;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.4) !important;
    color: var(--vz-body-color, #ced4da) !important;
}

[data-bs-theme="dark"] .candidate-card.selected,
[data-layout-mode="dark"] .candidate-card.selected {
    background-color: rgba(186, 27, 29, 0.18) !important;
    border-color: #ba1b1d !important;
}

[data-bs-theme="dark"] .candidate-card .check-icon,
[data-layout-mode="dark"] .candidate-card .check-icon {
    background: var(--vz-secondary-bg, #212529) !important;
    color: #ef4444 !important;
}

[data-bs-theme="dark"] .candidate-img,
[data-layout-mode="dark"] .candidate-img {
    background: var(--vz-tertiary-bg, #2a2d31) !important;
}

/* 8. Target Mode Selector di Kelola Peserta */
[data-bs-theme="dark"] .target-mode-card,
[data-layout-mode="dark"] .target-mode-card {
    border-color: var(--vz-border-color, #2a2f34) !important;
    background-color: var(--vz-secondary-bg, #212529) !important;
}

[data-bs-theme="dark"] .target-mode-card.active,
[data-layout-mode="dark"] .target-mode-card.active {
    background-color: rgba(186, 27, 29, 0.18) !important;
    border-color: #ba1b1d !important;
}

