/* ==========================================================================
   1. RESET & VARIABLE GLOBAL
   ========================================================================== */
:root {
    --primary-color: #1a365d;    /* Navy Blue - Kesan Aman & Profesional */
    --secondary-color: #2b6cb0;  /* Bright Blue */
    --success-color: #2f855a;    /* Green - Akses Valid */
    --danger-color: #c53030;     /* Red - Akses Ditolak */
    --warning-color: #dd6b20;    /* Orange - Loading / Warning */
    --text-main: #2d3748;        /* Dark Grey - Mudah Dibaca */
    --text-muted: #718096;
    --bg-light: #f7fafc;
    --card-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
    padding: 20px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* ==========================================================================
   2. LAYOUT CONTAINER & CARD
   ========================================================================== */
.container {
    width: 100%;
    max-width: 450px; /* Ukuran pas untuk layar Smartphone */
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
    font-weight: 500;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    border: 1px solid rgba(66, 153, 225, 0.1);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   3. FORM & ELEMENT TOMBOL (USER FRIENDLY)
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

/* Tombol Besar & Jelas untuk Semua Usia */
.btn {
    display: block;
    width: 100%;
    padding: 16px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: 0 4px 6px rgba(26, 54, 93, 0.2);
}

.btn:hidden-accessible, .btn:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

.btn:active {
    background-color: #0f233d;
}

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    text-decoration: underline;
}

.info-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.warning-text {
    font-size: 0.8rem;
    color: var(--danger-color);
    background-color: #fff5f5;
    padding: 10px;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 500;
}

/* ==========================================================================
   4. INTERFACE QR CODE (SISI WARGA)
   ========================================================================== */
.profile-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed #edf2f7;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.profile-info h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: #ffffff;
    border-radius: 12px;
    margin: 0 auto 20px auto;
}

#qrcode img {
    border: 6px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Timer & Progress Bar */
.timer-container {
    margin-top: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #edf2f7;
    border-radius: 3px;
    margin: 6px auto;
    overflow: hidden;
}

#progress-fill {
    width: 100%;
    height: 100%;
    background-color: var(--secondary-color);
    transition: width 1s linear;
}

/* ==========================================================================
   5. INTERFACE SCANNER & TOGGLE (SISI SATPAM)
   ========================================================================== */
.direction-toggle {
    display: flex;
    background: #edf2f7;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.radio-label {
    flex: 1;
    text-align: center;
    cursor: pointer;
}

.radio-label input {
    display: none; /* Sembunyikan radio button bawaan */
}

.radio-label span {
    display: block;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

/* Style saat Arah Masuk/Keluar dipilih */
.radio-label input:checked + span {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.camera-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000000;
    border: 3px solid var(--primary-color);
}

#reader {
    width: 100% !important;
    border: none !important;
}

/* ==========================================================================
   6. MODAL HASIL VALIDASI SCAN
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 54, 93, 0.85); /* Overlay gelap transparan */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.badge-status {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

/* Status Colors */
.badge-status.digital { background: #ebf8ff; color: var(--secondary-color); }
.badge-status.loading { background: #feebc8; color: var(--warning-color); }
.badge-status.valid { background: #c6f6d5; color: var(--success-color); font-size: 1.2rem; padding: 10px 24px;}
.badge-status.ditolak { background: #fed7d7; color: var(--danger-color); font-size: 1.2rem; padding: 10px 24px;}

.plat-nomor-display {
    display: inline-block;
    background: #1a202c;
    color: #ffffff;
    font-family: monospace;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 6px;
    border: 2px solid #4a5568;
    margin: 10px 0;
    letter-spacing: 1px;
}

/* Container Foto berdampingan */
.photo-container {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.photo-box {
    flex: 1;
    background: var(--bg-light);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.photo-box small {
    display: block;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.photo-box img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    background: #edf2f7;
}