/* ============================================================
   Classic 80's Einlass-App – Mobile-First CSS
   ============================================================ */

:root {
    --color-bg: #0f1117;
    --color-surface: #1a1d27;
    --color-surface2: #22263a;
    --color-primary: #3b82f6;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-border: #2d3148;
    --bottom-nav-h: 64px;
    --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

/* ── App Shell ───────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(var(--bottom-nav-h) + 8px);
}

/* ── Bottom Navigation ───────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: stretch;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 11px;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    padding: 8px 4px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.08);
}

.bottom-nav-icon { font-size: 22px; line-height: 1; }
.bottom-nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.bottom-nav-btn { -webkit-appearance: none; }

/* ── Page Headers ────────────────────────────────────────── */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 12px 4px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    user-select: none;
}

.stat-card:active { transform: scale(0.97); }

.stat-total.stat-active  { background: rgba(59,130,246,0.15);  border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary); }
.stat-checked.stat-active { background: rgba(34,197,94,0.15);  border-color: var(--color-success); box-shadow: 0 0 0 2px var(--color-success); }
.stat-remaining.stat-active { background: rgba(245,158,11,0.15); border-color: var(--color-warning); box-shadow: 0 0 0 2px var(--color-warning); }

.stat-total  { border-color: var(--color-primary); }
.stat-checked { border-color: var(--color-success); }
.stat-remaining { border-color: var(--color-warning); }

.stat-num {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.stat-total  .stat-num  { color: var(--color-primary); }
.stat-checked .stat-num { color: var(--color-success); }
.stat-remaining .stat-num { color: var(--color-warning); }

.stat-lbl {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── Progress Bar ────────────────────────────────────────── */
.progress-lg {
    height: 10px;
    border-radius: 10px;
    background: var(--color-surface2);
    overflow: hidden;
}

.progress-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 4px;
}

/* ── Day Filter ──────────────────────────────────────────── */
.filter-section {
    padding: 8px 12px 0;
}

.filter-label {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 6px;
}

.day-filter-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 8px;
}

.day-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 20px !important;
    min-width: 80px;
    font-weight: 600;
}

.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-outline-secondary { border-color: var(--color-border); color: var(--color-text-muted); background: transparent; }
.btn-outline-secondary:hover { background: var(--color-surface2); color: var(--color-text); }

/* ── Section Header & Search ─────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 4px;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-muted);
}

.search-box {
    flex: 1;
    margin-left: 10px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    background: var(--color-surface2);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
}

.search-box::placeholder { color: var(--color-text-muted); }
.search-box:focus { border-color: var(--color-primary); }

/* ── Booking List ────────────────────────────────────────── */
.booking-list {
    padding: 4px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.booking-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}

.booking-item.checked-in {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.06);
}

.checkin-item { cursor: pointer; }
.checkin-item:active { background: var(--color-surface2); }

.booking-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.booking-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.badge-plate {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.04em;
}

.badge-plate-lg {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.06em;
}

.badge-persons {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-in {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.status-out {
    background: rgba(156, 163, 175, 0.15);
    color: var(--color-text-muted);
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px 20px;
    font-size: 15px;
}

/* ── Check-in Page ───────────────────────────────────────── */
.search-section {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.search-input {
    background: var(--color-surface2) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text) !important;
    border-radius: 12px !important;
    font-size: 16px !important;
}

.search-input::placeholder { color: var(--color-text-muted) !important; }
.search-input:focus { border-color: var(--color-primary) !important; box-shadow: none !important; }

.search-clear {
    border-color: var(--color-border);
    color: var(--color-text-muted);
    background: var(--color-surface2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
}

.filter-row {
    padding: 8px 12px;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
}

.filter-toggle input { width: 18px; height: 18px; accent-color: var(--color-primary); }

/* ── Modal Sheet ─────────────────────────────────────────── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    backdrop-filter: blur(2px);
}

.modal-sheet {
    position: fixed;
    bottom: var(--bottom-nav-h);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--color-border);
    z-index: 201;
    max-height: 85dvh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.modal-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 12px auto 0;
}

.modal-sheet-content {
    padding: 16px 20px 24px;
}

.modal-sheet-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--color-text);
}

.detail-grid { display: flex; flex-direction: column; gap: 0; margin-bottom: 20px; }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.detail-lbl { font-size: 13px; color: var(--color-text-muted); font-weight: 500; }
.detail-val { font-size: 15px; font-weight: 600; color: var(--color-text); }

.modal-actions { display: flex; flex-direction: column; gap: 0; }

/* ── Walk-In Page ────────────────────────────────────────── */
.form-section {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-lg {
    margin-bottom: 12px;
}

.form-label-lg {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.form-control, .form-control-lg {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text) !important;
    border-radius: 10px !important;
}

.form-control:focus, .form-control-lg:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
    background: var(--color-surface) !important;
}

.form-control::placeholder, .form-control-lg::placeholder {
    color: var(--color-text-muted) !important;
}

.plate-input {
    text-transform: uppercase;
    font-family: monospace;
    font-size: 18px !important;
    letter-spacing: 0.08em;
}

.persons-counter {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    width: fit-content;
}

.counter-btn {
    width: 52px !important;
    height: 52px !important;
    font-size: 22px !important;
    border: none !important;
    border-radius: 0 !important;
    background: var(--color-surface2) !important;
    color: var(--color-text) !important;
}

.counter-val {
    min-width: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--color-text);
    padding: 0 8px;
}

/* ── Login Page ──────────────────────────────────────────── */
.login-screen {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 40px 28px 32px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon { font-size: 48px; }

.login-title {
    font-size: 28px;
    font-weight: 800;
    margin: 8px 0 4px;
    color: var(--color-text);
}

.login-subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 0;
}

.login-form .form-label-lg {
    margin-bottom: 8px;
}

/* ── Shared Buttons ──────────────────────────────────────── */
.btn-xl {
    padding: 16px 20px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    width: 100%;
}

.btn-success {
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
    color: #fff !important;
}

.btn-warning {
    background: var(--color-warning) !important;
    border-color: var(--color-warning) !important;
    color: #000 !important;
}

.btn-outline-light {
    border-color: rgba(255,255,255,0.3);
    color: var(--color-text);
    background: transparent;
}

.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.mx-3 { margin-left: 12px; margin-right: 12px; }
.d-flex { display: flex; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.w-100 { width: 100%; }
.text-success { color: var(--color-success) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.small { font-size: 12px; }

/* ── Blazor Error UI ─────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: #7f1d1d;
    color: #fecaca;
    bottom: var(--bottom-nav-h);
    box-shadow: 0 -1px 2px rgba(0,0,0,0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 999;
    font-size: 14px;
}

#blazor-error-ui .reload { color: #fca5a5; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; font-weight: 700; }

/* ── Loading Animation ───────────────────────────────────── */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--color-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto;
    color: var(--color-text);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}