/* ===========================================================================
   ISO Snack v2 — design system
   Warm, playful frituur palette. Mobile-first. Container queries. Light + dark.
   =========================================================================== */

:root {
    /* palette */
    --amber-50:  #fff7e0;
    --amber-100: #ffe9a8;
    --amber-300: #f9c850;
    --amber-500: #f2a900;   /* frites */
    --amber-700: #b07500;
    --tomato-100: #fde0dc;
    --tomato-500: #c0392b;  /* frituur red */
    --tomato-700: #8c2820;
    --cream:     #fff8ec;
    --paper:     #ffffff;
    --ink:       #1a1410;
    --ink-soft:  #5b4f47;
    --line:      #ebe1cf;
    --shadow-1:  0 1px 2px rgba(60, 38, 0, 0.06), 0 1px 3px rgba(60, 38, 0, 0.08);
    --shadow-2:  0 4px 12px rgba(60, 38, 0, 0.10), 0 2px 4px rgba(60, 38, 0, 0.06);

    /* semantic */
    --bg:        var(--cream);
    --surface:   var(--paper);
    --surface-2: var(--amber-50);
    --text:      var(--ink);
    --text-soft: var(--ink-soft);
    --border:    var(--line);
    --accent:    var(--amber-500);
    --accent-ink: var(--ink);
    --danger:    var(--tomato-500);
    --danger-soft: var(--tomato-100);

    /* radii / sizing */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 22px;
    --r-pill: 999px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;

    --font-display: 'Outfit', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --container: 720px;
    --tap: 44px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #1a1410;
        --surface:   #251c16;
        --surface-2: #30241b;
        --text:      #fff4dd;
        --text-soft: #c4ad94;
        --border:    #3a2c21;
        --shadow-1:  0 1px 2px rgba(0,0,0,0.4);
        --shadow-2:  0 4px 14px rgba(0,0,0,0.4);
    }
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    -webkit-font-smoothing: antialiased;
}

/* === Layout === */
.app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100dvh;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* === Header === */
.app-header {
    background: linear-gradient(135deg, var(--amber-500), var(--amber-300));
    color: var(--ink);
    box-shadow: var(--shadow-1);
}
.app-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-block: var(--space-3);
    min-height: 56px;
}
.app-header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}
.app-header__brand-dot {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--tomato-500);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.6);
}
.app-header__balance {
    margin-left: auto;
    background: rgba(255,255,255,0.65);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--r-pill);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* === Main === */
main.app-main {
    padding-block: var(--space-5);
}

/* === Nav (bottom on mobile, side on desktop) === */
.nav {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 10;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    list-style: none;
    margin: 0;
}
.nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) 0;
    font-size: 0.75rem;
    color: var(--text-soft);
    min-height: var(--tap);
}
.nav__link[aria-current="page"] {
    color: var(--accent);
    font-weight: 600;
}
.nav__link svg { width: 22px; height: 22px; }

@media (min-width: 900px) {
    .app { grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; }
    .app-header { grid-column: 1 / -1; }
    .nav {
        position: sticky;
        top: 56px;
        align-self: start;
        border-top: 0;
        border-right: 1px solid var(--border);
        height: calc(100dvh - 56px);
        padding: var(--space-4);
    }
    .nav__list {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }
    .nav__link {
        flex-direction: row;
        justify-content: flex-start;
        padding: var(--space-3);
        border-radius: var(--r-md);
        font-size: 1rem;
        gap: var(--space-3);
    }
    .nav__link[aria-current="page"] {
        background: var(--surface-2);
    }
    main.app-main { padding-block: var(--space-6); }
}

/* === Typography === */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.text-soft { color: var(--text-soft); }
.text-money { font-variant-numeric: tabular-nums; font-weight: 600; }

/* === Card === */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: var(--space-5);
}
.card--accent {
    background: linear-gradient(135deg, var(--amber-100), var(--amber-50));
    border: 1px solid var(--amber-300);
}
.card__header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.card__title  { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }

/* === Button === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--space-2);
    min-height: var(--tap);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--r-pill);
    font-weight: 600;
    transition: transform 80ms ease, box-shadow 120ms ease;
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow-1);
}
.btn:hover { box-shadow: var(--shadow-2); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--danger  { background: var(--danger); color: white; }
.btn--ghost   { background: transparent; box-shadow: none; }
.btn--block   { width: 100%; }
.btn[disabled], .btn--disabled { opacity: 0.5; pointer-events: none; }

/* === Form === */
.field { display: block; }
.field__label { display: block; font-weight: 500; margin-bottom: var(--space-1); }
.input {
    display: block; width: 100%;
    min-height: var(--tap);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    transition: border-color 80ms ease;
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.checkbox { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }

/* === List (menu/cart/saldo) === */
.list { list-style: none; }
.list__item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
    min-height: var(--tap);
}
.list__item:last-child { border-bottom: 0; }
.list__icon {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: var(--surface-2);
    border-radius: var(--r-md);
    flex-shrink: 0;
}
.list__icon svg { width: 26px; height: 26px; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 500; }
.list__sub   { font-size: 0.875rem; color: var(--text-soft); }
.list__meta  { text-align: right; font-variant-numeric: tabular-nums; }

/* === Badge === */
.badge {
    display: inline-flex; align-items: center; gap: var(--space-1);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-soft);
}
.badge--ok     { background: #1e8c2e; color: white; }
.badge--warn   { background: var(--amber-300); color: var(--ink); }
.badge--danger { background: var(--danger); color: white; }

/* === Toast (flash messages) === */
.toast {
    background: var(--ink);
    color: var(--amber-100);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    display: flex; align-items: center; gap: var(--space-3);
    margin-bottom: var(--space-4);
    animation: slide-in 200ms ease;
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* === Sheet (sauce picker) === */
.sheet {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-2);
}
.sheet__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.sheet__option {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: var(--space-3);
    background: var(--surface-2);
    border: 2px solid transparent;
    border-radius: var(--r-md);
    text-align: center;
    min-height: var(--tap);
    font-weight: 500;
}
.sheet__option:hover { border-color: var(--amber-300); }
.sheet__option--selected { border-color: var(--accent); background: var(--amber-50); }
.sheet__option-price { font-size: 0.75rem; color: var(--text-soft); }

/* === Product grid === */
.menu-section { margin-top: var(--space-5); }
.menu-section__title {
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--font-display);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    margin-bottom: var(--space-3);
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-3);
}
.product-card {
    background: var(--surface);
    border-radius: var(--r-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; align-items: center;
    gap: var(--space-2);
    text-align: center;
    min-height: 140px;
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.product-card__icon { width: 56px; height: 56px; }
.product-card__name { font-weight: 600; font-size: 0.9375rem; line-height: 1.2; }
.product-card__price { font-size: 0.8125rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* === Empty state === */
.empty {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}
.empty__art { width: 96px; height: 96px; margin-inline: auto; opacity: 0.7; }
.empty__title { font-family: var(--font-display); font-size: 1.25rem; margin-top: var(--space-4); }
.empty__sub { color: var(--text-soft); margin-top: var(--space-2); }

/* === Utility === */
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-soft); }
.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;
}

/* === View transitions === */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
}

/* === Admin === */
.admin-nav {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.admin-nav__link {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-soft);
    font-weight: 600; font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
}
.admin-nav__link.is-active {
    background: var(--accent);
    color: var(--accent-ink);
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
}
@media (max-width: 480px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: var(--space-3);
    text-align: center;
}
.stat__value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.stat__label { color: var(--text-soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* === Icon sizing ===
   Action icons (24×24 viewBox) have no intrinsic size, so constrain them per
   context. The snack/hero contexts (.list__icon, .nav__link, .product-card__icon)
   set their own sizes above and are unaffected. */
.btn svg,
.row > svg   { width: 20px; height: 20px; flex-shrink: 0; }
.toast svg   { width: 20px; height: 20px; flex-shrink: 0; }
.badge svg   { width: 14px; height: 14px; flex-shrink: 0; }
.empty__art svg { width: 100%; height: 100%; }
