/* ==========================================================================
   CHECK-IN PESERTA — Design System & Styles
   ========================================================================== */

/* ---------- CSS Variables — Light Theme (Default) ---------- */
:root {
    /* Colors — Light Theme */
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-input: #f8fafc;
    --bg-modal: rgba(0, 0, 0, 0.4);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #0284c7;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Accent Colors */
    --accent-primary: #0284c7;
    --accent-primary-hover: #0369a1;
    --accent-success: #16a34a;
    --accent-success-bg: rgba(22, 163, 74, 0.08);
    --accent-success-border: rgba(22, 163, 74, 0.25);
    --accent-warning: #d97706;
    --accent-warning-bg: rgba(217, 119, 6, 0.08);
    --accent-warning-border: rgba(217, 119, 6, 0.25);
    --accent-danger: #dc2626;
    --accent-danger-bg: rgba(220, 38, 38, 0.08);
    --accent-danger-border: rgba(220, 38, 38, 0.25);

    /* Gradients */
    --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-primary: linear-gradient(135deg, #0284c7, #0369a1);
    --gradient-header: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-base: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
    --shadow-glow-success: 0 0 20px rgba(34,197,94,.15);
    --shadow-glow-warning: 0 0 20px rgba(245,158,11,.15);
    --shadow-glow-danger: 0 0 20px rgba(239,68,68,.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dark Theme Override ---------- */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #273548;
    --bg-glass: rgba(30, 41, 59, 0.85);
    --bg-input: #0f172a;
    --bg-modal: rgba(0, 0, 0, 0.7);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #38bdf8;

    --border-color: #334155;
    --border-light: #1e293b;

    --accent-primary: #38bdf8;
    --accent-primary-hover: #0ea5e9;
    --accent-success: #22c55e;
    --accent-success-bg: rgba(34, 197, 94, 0.12);
    --accent-success-border: rgba(34, 197, 94, 0.3);
    --accent-warning: #f59e0b;
    --accent-warning-bg: rgba(245, 158, 11, 0.12);
    --accent-warning-border: rgba(245, 158, 11, 0.3);
    --accent-danger: #ef4444;
    --accent-danger-bg: rgba(239, 68, 68, 0.12);
    --accent-danger-border: rgba(239, 68, 68, 0.3);

    --gradient-primary: linear-gradient(135deg, #38bdf8, #0ea5e9);
    --gradient-header: linear-gradient(135deg, #0f172a 0%, #1a2744 100%);

    --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.4);
    --shadow-glow-success: 0 0 20px rgba(34,197,94,.25);
    --shadow-glow-warning: 0 0 20px rgba(245,158,11,.25);
    --shadow-glow-danger: 0 0 20px rgba(239,68,68,.25);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

html, body {
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Header ---------- */
header {
    background: var(--gradient-header);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.header-left { display: flex; align-items: center; gap: var(--space-base); }
.header-right { display: flex; align-items: center; gap: var(--space-base); }

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    width: 36px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.15));
}

.logo h1 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 400;
}

.live-clock {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: 600;
}

.live-clock span {
    font-variant-numeric: tabular-nums;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    border: none;
    padding: 0;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle::after {
    content: '☀️';
    position: absolute;
    left: 3px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
}

[data-theme="dark"] .theme-toggle {
    background: var(--accent-primary);
}

[data-theme="dark"] .theme-toggle::after {
    content: '🌙';
    transform: translateX(20px);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}
.status-dot.online {
    background: var(--accent-success);
    box-shadow: 0 0 6px var(--accent-success);
    animation: pulse-dot 2s infinite;
}
.status-dot.offline {
    background: var(--text-muted);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---------- Banner + Stats Row ---------- */
.banner-stats-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    animation: bannerFadeIn 0.6s ease;
}

.event-banner {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
}

.event-banner img {
    width: 320px;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: block;
}

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

.stats-group {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    align-content: center;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
    display: flex;
    gap: var(--space-base);
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-base);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-width: fit-content;
    flex: 1;
}

.stat-icon { font-size: 1.3rem; }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: var(--font-size-xl);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-success .stat-number { color: var(--accent-success); }
.stat-pending .stat-number { color: var(--accent-warning); }

.stat-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
}

/* Progress Ring */
.progress-ring-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 4;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--accent-success);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 125.66;
    stroke-dashoffset: 125.66;
    transition: stroke-dashoffset 0.6s ease;
}

.progress-text {
    position: absolute;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-primary);
}

/* ---------- Main Content ---------- */
main {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0; /* Important for flex child to shrink */
    overflow: hidden;
}

.left-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border-color);
}

/* ---------- Panels ---------- */
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for flex child to shrink */
}

.panel-list {
    flex: 1;
    min-width: 0;
    border-top: 1px solid var(--border-color);
}

.panel-scanner {
    width: 380px;
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.panel-header h2 {
    font-size: var(--font-size-base);
    font-weight: 600;
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ---------- Search Box ---------- */
.search-box {
    position: relative;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.search-box input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-base) var(--space-sm) 2.2rem;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}

.search-icon {
    position: absolute;
    left: calc(var(--space-lg) + 0.6rem);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ---------- Check-in List ---------- */
.checkin-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.checkin-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-base);
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    transition: background var(--transition-fast);
    cursor: default;
    animation: slideIn 0.35s ease;
}

.checkin-item:hover {
    background: var(--bg-card-hover);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.checkin-item-number {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--accent-success-bg);
    color: var(--accent-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid var(--accent-success-border);
}

.checkin-item-info {
    flex: 1;
    min-width: 0;
}

.checkin-item-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkin-item-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.checkin-item-meta .separator {
    width: 3px;
    height: 3px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    display: inline-block;
}

.checkin-item-time {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ---------- Empty State ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-base);
    text-align: center;
    color: var(--text-muted);
    height: 100%;
    min-height: 200px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-base);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
}

.empty-hint {
    font-size: var(--font-size-xs) !important;
    color: var(--text-muted) !important;
}

/* ---------- Scanner ---------- */
.panel-scanner {
    width: 380px;
    flex-shrink: 0;
    background: var(--bg-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.camera-selector {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.camera-selector label {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.camera-selector select {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-family: var(--font-family);
}

.scanner-container {
    position: relative;
    padding: var(--space-lg);
}

.qr-reader {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: #000;
    max-width: 450px;
    width: 100%;
    margin: 0 auto;
}

/* Override html5-qrcode default styles */
#qr-reader {
    border: none !important;
    background: transparent !important;
}

#qr-reader video {
    border-radius: var(--radius-md);
    width: 100% !important;
    max-height: 250px !important;
    object-fit: cover !important;
}

#qr-reader__scan_region {
    min-height: 200px !important;
}

#qr-reader__dashboard {
    padding: var(--space-sm) !important;
}

#qr-reader__dashboard span, 
#qr-reader__dashboard a {
    color: var(--text-secondary) !important;
    font-size: var(--font-size-xs) !important;
}

#qr-reader__dashboard select {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-xs) var(--space-sm) !important;
}

#qr-reader__dashboard button {
    background: var(--accent-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: var(--space-sm) var(--space-base) !important;
    cursor: pointer !important;
    font-family: var(--font-family) !important;
    font-weight: 600 !important;
}

#qr-reader__dashboard button:hover {
    background: var(--accent-primary-hover) !important;
}

#qr-reader__dashboard_section {
    padding: var(--space-sm) 0 !important;
}

#qr-reader__dashboard_section_swaplink {
    color: var(--accent-primary) !important;
    text-decoration: underline !important;
}

#qr-reader__status_span {
    display: none !important;
}

.scanner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: var(--space-base);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.placeholder-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ---------- Scan Result Card ---------- */
.scan-result {
    padding: 0 var(--space-lg) var(--space-base);
}

.result-card {
    display: flex;
    align-items: center;
    gap: var(--space-base);
    padding: var(--space-base) var(--space-lg);
    border-radius: var(--radius-lg);
    animation: resultPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all var(--transition-base);
}

.result-card.success {
    background: var(--accent-success-bg);
    border: 1px solid var(--accent-success-border);
    box-shadow: var(--shadow-glow-success);
}

.result-card.warning {
    background: var(--accent-warning-bg);
    border: 1px solid var(--accent-warning-border);
    box-shadow: var(--shadow-glow-warning);
}

.result-card.error {
    background: var(--accent-danger-bg);
    border: 1px solid var(--accent-danger-border);
    box-shadow: var(--shadow-glow-danger);
}

@keyframes resultPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.result-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-info h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 2px;
}

.result-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.result-time {
    font-size: var(--font-size-xs) !important;
    color: var(--text-muted) !important;
    font-variant-numeric: tabular-nums;
}

/* ---------- Recent Scans ---------- */
.recent-scans {
    padding: var(--space-base) var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.recent-scans h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.recent-scans-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 160px;
    overflow-y: auto;
}

.recent-scan-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    animation: slideIn 0.3s ease;
}

.recent-scan-item.success { color: var(--accent-success); }
.recent-scan-item.warning { color: var(--accent-warning); }
.recent-scan-item.error { color: var(--accent-danger); }

.recent-scan-item .scan-time {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.recent-scan-item .scan-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Buttons ---------- */
.btn {
    font-family: var(--font-family);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-sm);
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-base);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm);
    border-radius: var(--radius-full);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-checkin {
    background: var(--gradient-success);
    color: #fff;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.btn-checkin:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ---------- Modals ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: min(480px, 92vw);
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: var(--font-size-md);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-base) var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: var(--space-base);
}

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"] {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-base);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}

.form-group input[type="checkbox"] {
    margin-right: var(--space-sm);
    accent-color: var(--accent-primary);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
    display: block;
}

/* ---------- Manual Search Results ---------- */
.manual-search-results {
    max-height: 320px;
    overflow-y: auto;
}

.manual-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-base);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background var(--transition-fast);
}

.manual-item:hover { background: var(--bg-card-hover); }

.manual-item-info {
    flex: 1;
}

.manual-item-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.manual-item-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.manual-item .badge {
    font-size: var(--font-size-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.badge-checkedin {
    background: var(--accent-success-bg);
    color: var(--accent-success);
    border: 1px solid var(--accent-success-border);
}

.badge-pending {
    background: var(--bg-primary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* ---------- Footer ---------- */
footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-xl);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast.toast-success { border-left: 3px solid var(--accent-success); }
.toast.toast-warning { border-left: 3px solid var(--accent-warning); }
.toast.toast-error { border-left: 3px solid var(--accent-danger); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .panel-scanner {
        order: -1;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 55vh;
    }

    .banner-stats-row {
        flex-direction: column;
    }

    .event-banner {
        padding: var(--space-sm) var(--space-base);
        justify-content: center;
    }

    .event-banner img {
        width: 280px;
    }

    .stats-group {
        padding: var(--space-sm) var(--space-base);
        gap: var(--space-sm);
    }

    .stat-item {
        padding: var(--space-xs) var(--space-sm);
    }

    .stat-number {
        font-size: var(--font-size-lg);
    }

    header {
        padding: var(--space-sm) var(--space-base);
    }

    .logo h1 { font-size: var(--font-size-base); }

    footer {
        padding: var(--space-sm) var(--space-base);
    }

    .scanner-container {
        padding: var(--space-base);
    }
}

@media (max-width: 480px) {
    .stat-progress {
        display: none;
    }

    .stat-label {
        display: none;
    }

    .panel-actions {
        gap: 2px;
    }
}

/* ---------- Scan Result Popup Overlay ---------- */
.scan-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.scan-popup {
    background: var(--bg-card);
    border-radius: 1.5rem;
    padding: 2.5rem 3rem;
    text-align: center;
    min-width: 360px;
    max-width: 500px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    border: 3px solid transparent;
}

.scan-popup.success {
    border-color: var(--accent-success);
    background: linear-gradient(135deg, var(--accent-success-bg), var(--bg-card));
}

.scan-popup.warning {
    border-color: var(--accent-warning);
    background: linear-gradient(135deg, var(--accent-warning-bg), var(--bg-card));
}

.scan-popup.error {
    border-color: var(--accent-danger);
    background: linear-gradient(135deg, var(--accent-danger-bg), var(--bg-card));
}

.scan-popup-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.scan-popup-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.scan-popup-details {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.scan-popup-time {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.btn-popup-close {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 0.75rem 3rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-popup-close:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.05);
}

@keyframes popupBounce {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Check-in Table ---------- */
.checkin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.checkin-table thead th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.checkin-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.checkin-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.checkin-table td {
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.col-no {
    width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted) !important;
    font-size: var(--font-size-xs);
}

.col-nama {
    font-weight: 600;
    min-width: 120px;
}

.col-kota, .col-status {
    color: var(--text-secondary) !important;
    font-size: var(--font-size-xs);
}

.col-time {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: var(--font-size-xs);
    color: var(--text-muted) !important;
    white-space: nowrap;
}

.col-action {
    width: 40px;
    text-align: center;
}

/* ---------- Undo & Reset Buttons ---------- */
.btn-xs {
    padding: 0.2rem 0.4rem;
    font-size: var(--font-size-xs);
    border-radius: 0.375rem;
    line-height: 1;
}

.btn-undo {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.5;
}

.btn-undo:hover {
    background: var(--accent-danger-bg);
    border-color: var(--accent-danger-border);
    color: var(--accent-danger);
    opacity: 1;
}

.btn-danger {
    background: var(--accent-danger) !important;
    color: #fff !important;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c !important;
}
