/* Copyright (c) 2026 Voscart Labs. All rights reserved. */
/* design-system.css — shared foundation, imported FIRST on every page.
   Additive only: scales, universal interaction states, accessible-error pattern,
   utilities, spinner, reduced-motion. Page palettes (warm) live in each page's :root. */

:root {
    /* ── Canonical color palette ──────────────────────────────────────────────
       Single source of truth for the warm palette shared by the booking page,
       gate/verify terminal, and admin dashboard. Each page's own stylesheet
       aliases its locally-used names (e.g. admin.css's --text-primary) to
       these instead of redeclaring hex values — one place to change the brand. */
    --accent: #E8470A;
    --accent-mid: #F97316;
    --accent-bg: #FFF3EE;
    --accent-glow: rgba(232, 71, 10, 0.14);

    --text: #1A1208;
    --sub: #5C4F38;
    --muted: #7A6F52;

    --bg: #FEFCF8;
    --surface: #FFFFFF;
    --surface-2: #F9F7F3;
    --border: #EDE9E0;
    --border-mid: #D9D3C7;

    --gold: #B45309;
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --danger: #DC2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning: #D97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --info: #2563EB;
    --info-bg: rgba(37, 99, 235, 0.08);

    /* Dark navy — used for the admin sidebar/topbar and gate-terminal chrome */
    --navy: #0E1628;
    --navy-mid: #172038;
    --navy-border: rgba(255, 255, 255, 0.08);
    --navy-muted: rgba(255, 255, 255, 0.38);
    --navy-text: rgba(255, 255, 255, 0.9);

    /* Spacing scale (4px base) — prefer these over raw rem */
    --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
    --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px;

    /* Radius scale */
    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

    /* Type scale */
    --fs-xs: .75rem; --fs-sm: .875rem; --fs-base: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;

    /* Elevation & motion */
    --shadow-1: 0 1px 2px rgba(14,22,40,.06);
    --shadow-2: 0 8px 24px rgba(14,22,40,.10);
    --shadow-3: 0 20px 60px rgba(14,22,40,.18);
    --ease: cubic-bezier(.16,1,.3,1);
    --dur: .18s;
    --tap: 44px; /* minimum ergonomic touch target */
}

/* ── Universal interaction states ─────────────────────────────────────────── */
:where(button, [role="button"], .btn, .chip, .badge-btn):active:not(:disabled) {
    transform: scale(.97);
}
:where(button, [role="button"], a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
/* Consistent disabled affordance (was missing app-wide) */
:where(button, .btn, a.btn):disabled,
:where(button, .btn)[disabled],
.is-loading {
    opacity: .55 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ── Inline button spinner (used by setButtonLoading) ─────────────────────── */
.btn-spinner {
    width: 1em; height: 1em;
    border: 2px solid currentColor; border-top-color: transparent;
    border-radius: 50%;
    display: inline-block; vertical-align: -2px;
    animation: ds-spin .6s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

.field-error-text {
    display: flex; align-items: center; gap: var(--space-1);
    margin-top: var(--space-1);
    font-size: var(--fs-xs); font-weight: 500;
    color: var(--danger);
    animation: ds-err-in .15s var(--ease);
    line-height: 1.4;
}
.block-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 0.9rem;
}
.field-error-text i { font-size: 0.85em; flex-shrink: 0; position: relative; top: -0.05em; }
@keyframes ds-err-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }

/* ── Touch-target floor: 44px hit area without enlarging the visual ───────── */
.u-touch { position: relative; }
.u-touch::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: var(--tap); height: var(--tap);
    transform: translate(-50%, -50%);
}

/* ── Layout utilities (replace inline-style soup) ─────────────────────────── */
.u-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.u-row { display: flex; align-items: center; gap: var(--space-2); }
.u-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.u-spread { margin-left: auto; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Respect reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
