/* ==========================================================================
   BookDinePlay — shared product design system
   Used by both the Blazor Web App and the MAUI Blazor Hybrid app.
   Signature: the "slot board" — time-slot chips that read as a booking rail
   and a scoreboard. Palette grounded in the sports-bar/game-house world:
   warm midnight walnut, chalk, tungsten ember, billiard baize.
   ========================================================================== */

:root {
    /* Brand tokens */
    --ink: #141210;
    --ink-2: #211c18;
    --ink-3: #2c251f;
    --chalk: #f4efe6;
    --chalk-2: #fbf8f2;
    --paper: #ffffff;
    --ember: #f97316;
    --ember-strong: #ea6606;
    --baize: #178a5a;
    --baize-strong: #0f6f47;
    --line: #e7ded0;
    --line-dark: #3a322c;
    --muted: #6c6157;
    --danger: #c0392b;

    /* Type */
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    /* Scale */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(20, 18, 16, 0.06), 0 2px 8px rgba(20, 18, 16, 0.05);
    --shadow-md: 0 6px 24px rgba(20, 18, 16, 0.10);
    --shadow-lg: 0 24px 60px rgba(20, 18, 16, 0.18);

    --content-max: 1120px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--chalk);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 16px;
    line-height: 1.55;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin: 0 0 0.4em;
    font-weight: 800;
}

.bdp-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ember-strong);
}

a { color: var(--baize-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.bdp-num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   App shell — dark top bar, content, mobile bottom nav
   -------------------------------------------------------------------------- */
.bdp-app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--chalk);
}

.bdp-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem clamp(1rem, 4vw, 2rem);
    padding-top: calc(0.85rem + env(safe-area-inset-top));
    background: var(--ink);
    color: var(--chalk);
    border-bottom: 1px solid var(--line-dark);
}

.bdp-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--chalk);
    font-size: 1.06rem;
}
.bdp-brand:hover { text-decoration: none; }

.bdp-brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background:
        radial-gradient(120% 120% at 30% 20%, var(--ember) 0%, var(--ember-strong) 55%, #b64e05 100%);
    display: grid; place-items: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15), 0 4px 14px rgba(249,115,22,0.45);
    position: relative;
    flex: 0 0 auto;
}
.bdp-brand-mark::after {
    /* a small chalk "8-ball" dot — the game accent */
    content: "";
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--chalk);
    box-shadow: 0 0 0 2px var(--ink);
}

.bdp-topnav { display: flex; gap: 0.25rem; }
.bdp-topnav a {
    color: rgba(244,239,230,0.72);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
}
.bdp-topnav a:hover { color: var(--chalk); background: rgba(255,255,255,0.06); text-decoration: none; }
.bdp-topnav a.active { color: var(--ink); background: var(--ember); }

.bdp-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: clamp(1.1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 6rem;
}

/* Mobile bottom navigation — native-app feel */
.bdp-bottomnav {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: none;
    justify-content: space-around;
    gap: 0.25rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 0.4rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
}
.bdp-bottomnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.35rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
}
.bdp-bottomnav a .ico { width: 22px; height: 22px; }
.bdp-bottomnav a.active { color: var(--ember-strong); }
.bdp-bottomnav a:hover { text-decoration: none; }

@media (max-width: 720px) {
    .bdp-topnav { display: none; }
    .bdp-bottomnav { display: flex; }
    .bdp-content { padding-bottom: 5rem; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.bdp-btn {
    --btn-bg: var(--ember);
    --btn-fg: #1a1206;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1;
    padding: 0.8rem 1.25rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: var(--btn-bg);
    color: var(--btn-fg);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 6px 18px rgba(249,115,22,0.28);
    text-decoration: none;
}
.bdp-btn:hover { background: var(--ember-strong); text-decoration: none; transform: translateY(-1px); }
.bdp-btn:active { transform: translateY(0); }
.bdp-btn[disabled], .bdp-btn.is-disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

.bdp-btn.ghost {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    border-color: var(--line-dark);
    box-shadow: none;
}
.bdp-btn.ghost:hover { background: rgba(20,18,16,0.05); }

.bdp-btn.on-dark.ghost { --btn-fg: var(--chalk); border-color: rgba(244,239,230,0.28); }
.bdp-btn.on-dark.ghost:hover { background: rgba(255,255,255,0.08); }

.bdp-btn.baize { --btn-bg: var(--baize); --btn-fg: #eafaf1; box-shadow: 0 6px 18px rgba(23,138,90,0.28); }
.bdp-btn.baize:hover { background: var(--baize-strong); }

.bdp-btn.block { width: 100%; }
.bdp-btn.lg { padding: 1rem 1.6rem; font-size: 1.05rem; }

:where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid var(--baize);
    outline-offset: 2px;
    border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Cards & surfaces
   -------------------------------------------------------------------------- */
.bdp-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.bdp-card.pad { padding: clamp(1.1rem, 3vw, 1.6rem); }

.bdp-grid { display: grid; gap: 1rem; }
.bdp-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.bdp-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .bdp-grid.cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .bdp-grid.cols-2, .bdp-grid.cols-3 { grid-template-columns: 1fr; } }

.bdp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-pill);
    background: rgba(23,138,90,0.10);
    color: var(--baize-strong);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.bdp-chip.ember { background: rgba(249,115,22,0.12); color: var(--ember-strong); }
.bdp-chip.plain { background: var(--chalk); color: var(--muted); }

/* Feature card */
.bdp-feature { padding: 1.4rem; }
.bdp-feature .ico {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--ink); color: var(--ember);
    margin-bottom: 0.9rem;
}
.bdp-feature h3 { font-size: 1.12rem; }
.bdp-feature p { color: var(--muted); margin: 0.25rem 0 0; }

/* --------------------------------------------------------------------------
   Venue header
   -------------------------------------------------------------------------- */
.bdp-venue-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    color: var(--chalk);
    background:
        radial-gradient(90% 120% at 85% -10%, rgba(249,115,22,0.35) 0%, rgba(249,115,22,0) 55%),
        radial-gradient(80% 120% at 0% 120%, rgba(23,138,90,0.35) 0%, rgba(23,138,90,0) 55%),
        var(--ink);
    padding: clamp(1.4rem, 4vw, 2.4rem);
    border: 1px solid var(--line-dark);
}
.bdp-venue-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.bdp-venue-hero .tagline { color: rgba(244,239,230,0.82); font-weight: 600; }
.bdp-venue-hero .meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin-top: 0.9rem; color: rgba(244,239,230,0.72); font-size: 0.9rem; }
.bdp-venue-hero .meta span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* --------------------------------------------------------------------------
   Section headings
   -------------------------------------------------------------------------- */
.bdp-section { margin-top: 2.2rem; }
.bdp-section > .head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.bdp-section h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); }
.bdp-section .sub { color: var(--muted); margin: 0; }

/* --------------------------------------------------------------------------
   Opening hours
   -------------------------------------------------------------------------- */
.bdp-hours { list-style: none; margin: 0; padding: 0; }
.bdp-hours li {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: 0.6rem 0.1rem;
    border-bottom: 1px dashed var(--line);
}
.bdp-hours li:last-child { border-bottom: 0; }
.bdp-hours .day { font-weight: 700; }
.bdp-hours li.today { color: var(--ember-strong); }
.bdp-hours li.today .day::after { content: " · Today"; font-weight: 700; }
.bdp-hours .closed { color: var(--muted); font-style: italic; }
.bdp-special { margin-top: 0.8rem; font-size: 0.86rem; color: var(--muted); }
.bdp-special strong { color: var(--ink); }

/* --------------------------------------------------------------------------
   Menu
   -------------------------------------------------------------------------- */
.bdp-menu-group { margin-bottom: 1.3rem; }
.bdp-menu-group h4 { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; }
.bdp-menu-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; align-items: baseline; }
.bdp-menu-item .lead { display: flex; align-items: baseline; gap: 0.5rem; flex: 1; min-width: 0; }
.bdp-menu-item .name { font-weight: 700; }
.bdp-menu-item .desc { color: var(--muted); font-size: 0.86rem; }
.bdp-menu-item .price { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.bdp-menu-dots { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); min-width: 12px; }

/* --------------------------------------------------------------------------
   Resource type selector
   -------------------------------------------------------------------------- */
.bdp-typegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.7rem; }
.bdp-typecard {
    text-align: left;
    border: 1.5px solid var(--line);
    background: var(--paper);
    border-radius: var(--radius-sm);
    padding: 0.85rem 0.9rem;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 0.35rem;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
    font: inherit;
    color: inherit;
}
.bdp-typecard:hover { border-color: var(--ember); transform: translateY(-1px); }
.bdp-typecard .ico { width: 26px; height: 26px; color: var(--ink); }
.bdp-typecard .label { font-weight: 700; }
.bdp-typecard[aria-pressed="true"] {
    border-color: var(--ember);
    background: rgba(249,115,22,0.08);
    box-shadow: inset 0 0 0 1px var(--ember);
}
.bdp-typecard[aria-pressed="true"] .ico { color: var(--ember-strong); }

/* --------------------------------------------------------------------------
   Booking step indicator
   -------------------------------------------------------------------------- */
.bdp-steps { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.2rem; }
.bdp-steps .step { display: flex; align-items: center; gap: 0.5rem; }
.bdp-steps .dot {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 0.8rem; font-weight: 800;
    background: var(--chalk); color: var(--muted);
    border: 1.5px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.bdp-steps .step.done .dot { background: var(--baize); color: #eafaf1; border-color: var(--baize); }
.bdp-steps .step.current .dot { background: var(--ember); color: #1a1206; border-color: var(--ember); }
.bdp-steps .step .name { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.bdp-steps .step.current .name { color: var(--ink); }
.bdp-steps .bar { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.bdp-steps .step.done + .bar { background: var(--baize); }
@media (max-width: 620px) { .bdp-steps .step .name { display: none; } }

/* --------------------------------------------------------------------------
   Slot board — the signature element
   -------------------------------------------------------------------------- */
.bdp-slotboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.bdp-slot {
    position: relative;
    border: 1.5px solid var(--line);
    background: var(--paper);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.5rem;
    text-align: center;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color 0.12s ease, transform 0.08s ease, background 0.12s ease;
}
.bdp-slot .time { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.bdp-slot .price { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.bdp-slot .rname { font-size: 0.68rem; color: var(--muted); margin-top: 3px; display: block; }
.bdp-slot::before {
    content: ""; position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--baize);
    box-shadow: 0 0 0 3px rgba(23,138,90,0.16);
}
.bdp-slot:hover { border-color: var(--ember); transform: translateY(-1px); }
.bdp-slot[aria-pressed="true"] { border-color: var(--ember); background: rgba(249,115,22,0.10); box-shadow: inset 0 0 0 1px var(--ember); }
.bdp-slot[aria-pressed="true"]::before { background: var(--ember); box-shadow: 0 0 0 3px rgba(249,115,22,0.18); }
.bdp-slot[disabled] { cursor: not-allowed; opacity: 0.5; }
.bdp-slot[disabled]::before { background: var(--line-dark); box-shadow: none; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.bdp-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.bdp-field label { font-weight: 700; font-size: 0.86rem; }
.bdp-input, .bdp-select {
    font: inherit;
    padding: 0.7rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    width: 100%;
}
.bdp-input:focus, .bdp-select:focus { border-color: var(--ember); outline: none; box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.bdp-check { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.8rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--chalk-2); }
.bdp-check input { margin-top: 0.2rem; width: 18px; height: 18px; accent-color: var(--ember); }
.bdp-check .hint { color: var(--muted); font-size: 0.84rem; margin: 0.15rem 0 0; }
.bdp-error { color: var(--danger); font-size: 0.85rem; font-weight: 600; }

/* --------------------------------------------------------------------------
   States: loading / empty / error
   -------------------------------------------------------------------------- */
.bdp-skel { position: relative; overflow: hidden; background: var(--line); border-radius: var(--radius-sm); }
.bdp-skel::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    transform: translateX(-100%);
    animation: bdp-shimmer 1.3s infinite;
}
@keyframes bdp-shimmer { 100% { transform: translateX(100%); } }

.bdp-state { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.bdp-state .ico { width: 40px; height: 40px; margin: 0 auto 0.7rem; color: var(--line-dark); }
.bdp-state h3 { color: var(--ink); }

/* Confirmation */
.bdp-confirm { text-align: center; padding: 1.6rem; }
.bdp-confirm .seal {
    width: 66px; height: 66px; border-radius: 50%;
    background: var(--baize); color: #eafaf1;
    display: grid; place-items: center; margin: 0 auto 1rem;
    box-shadow: 0 10px 30px rgba(23,138,90,0.35);
    animation: bdp-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes bdp-pop { from { transform: scale(0.6); opacity: 0; } }
.bdp-confirm .ref {
    display: inline-block; margin-top: 0.4rem;
    font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.08em;
    background: var(--ink); color: var(--chalk); padding: 0.4rem 0.9rem; border-radius: var(--radius-sm);
}
.bdp-summary { text-align: left; margin: 1.3rem auto 0; max-width: 380px; }
.bdp-summary .row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.bdp-summary .row:last-child { border-bottom: 0; }
.bdp-summary .k { color: var(--muted); }
.bdp-summary .v { font-weight: 700; }

/* Payment placeholder */
.bdp-pay { border: 1.5px dashed var(--line-dark); border-radius: var(--radius); padding: 1.2rem; background: var(--chalk-2); }
.bdp-pay .lead { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; }

/* Utilities */
.bdp-stack > * + * { margin-top: 0.9rem; }
.bdp-muted { color: var(--muted); }
.bdp-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.bdp-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* Blazor error UI (keep functional, restyle) */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: var(--ink); color: var(--chalk);
    padding: 0.8rem 1.2rem; box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
#blazor-error-ui .reload { color: var(--ember); font-weight: 700; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
.blazor-error-boundary { background: var(--danger); color: #fff; padding: 1rem 1.2rem; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "Something went wrong here."; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
