/* ============================================================================
   Blastfood — market-flyer aesthetic.
   Cream paper, ink lines, hot paprika accents, chunky price stamps.
   ========================================================================= */

:root {
    --paper:      #f8f1e3;
    --paper-deep: #f1e6cf;
    --ink:        #26180e;
    --ink-soft:   #6b5844;
    --hot:        #c2431f;
    --hot-deep:   #9a2f10;
    --mustard:    #eba937;
    --leaf:       #3e7a3a;
    --danger:     #a31621;
    --card:       #fffdf7;
    --line:       2px solid var(--ink);
    --shadow:     4px 4px 0 rgba(38, 24, 14, 0.9);
    --shadow-sm:  3px 3px 0 rgba(38, 24, 14, 0.9);
    --radius:     10px;
    --display:    "Bricolage Grotesque", "Arial Black", sans-serif;
    --body:       "Karla", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(rgba(38, 24, 14, 0.045) 1px, transparent 1.5px) 0 0 / 22px 22px,
        var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.45;
}

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.1; margin: 0 0 .5rem; }
a { color: var(--hot); }

/* ---------- boot ---------- */
.boot-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.boot-burst { font-size: 3rem; animation: bootpulse 0.9s ease-in-out infinite alternate; }
@keyframes bootpulse { from { transform: scale(1) rotate(-8deg); } to { transform: scale(1.25) rotate(8deg); } }

/* ---------- shell ---------- */
.shell { max-width: 880px; margin: 0 auto; padding: 0 16px 80px; }

.masthead {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px 0 10px;
    border-bottom: 3px solid var(--ink);
}
.wordmark {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.7rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.wordmark .burst {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--hot);
    color: var(--paper);
    font-size: 1.1rem;
    clip-path: polygon(50% 0%, 61% 15%, 78% 6%, 78% 24%, 96% 25%, 84% 39%, 100% 50%, 84% 61%, 96% 75%, 78% 76%, 78% 94%, 61% 85%, 50% 100%, 39% 85%, 22% 94%, 22% 76%, 4% 75%, 16% 61%, 0% 50%, 16% 39%, 4% 25%, 22% 24%, 22% 6%, 39% 15%);
    transform: rotate(-6deg);
}
.wordmark em { color: var(--hot); font-style: normal; }
.tagline { color: var(--ink-soft); font-size: .85rem; margin-left: auto; text-align: right; }

.topnav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
}
.topnav button {
    font-family: var(--display);
    font-weight: 700;
    font-size: .95rem;
    padding: 7px 14px;
    background: var(--card);
    border: var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .08s ease;
}
.topnav button:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow-sm); }
.topnav button.active { background: var(--ink); color: var(--paper); }
.topnav .spacer { flex: 1; }
.nav-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: var(--hot);
    color: var(--paper);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    vertical-align: 1px;
}
.topnav button.active .nav-badge { background: var(--paper); color: var(--ink); }
.nav-badge.alert { animation: badge-pulse 1.2s ease-in-out infinite; }
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.18); }
}
.nav-badge { display: inline-block; }

/* Signed-in identity, centered between the wordmark and the tagline. */
.masthead-user {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verify-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #fdf3d7;
    border: 2px solid var(--mustard);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 14px 0 0;
    font-size: .92rem;
}

/* ---------- hamburger menu ---------- */
.menu-anchor { position: relative; }
.menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 900;
    background: var(--card);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 10px;
    min-width: 220px;
    animation: rise .15s ease both;
}
.menu-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 2px 4px 6px;
}
.menu-langs { display: flex; gap: 8px; margin-bottom: 8px; }
.menu-langs .btn { flex: 1; }
/* .menu-pop prefix so these out-rank .topnav button (the pop lives in the
   topnav) — without it the items render as cramped nav pills. */
.menu-pop .menu-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: var(--display);
    font-weight: 700;
    font-size: .95rem;
    padding: 11px 12px;
    margin: 2px 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ink);
}
.menu-pop .menu-item:hover { background: var(--paper-deep); transform: none; box-shadow: none; }
.menu-pop .menu-item.current { background: var(--ink); color: var(--paper); }
.menu-pop .menu-item.danger { color: var(--danger); }
.menu-rule { border: none; border-top: 1px dashed rgba(38,24,14,.35); margin: 8px 0; }
.menu-rule.gap { margin: 18px 0 10px; }

/* ---------- cards & lists ---------- */
.card {
    background: var(--card);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin: 16px 0;
    animation: rise .25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.offer-row {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px dashed rgba(38, 24, 14, 0.35);
}
.offer-row:last-child { border-bottom: none; }
.offer-main { flex: 1; min-width: 0; }
.offer-title { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.offer-detail { color: var(--ink-soft); font-size: .92rem; margin: 2px 0; }
.offer-meta { font-size: .82rem; color: var(--ink-soft); display: flex; gap: 10px; flex-wrap: wrap; }

.pricestamp {
    align-self: center;
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--mustard);
    border: var(--line);
    border-radius: 50%;
    min-width: 72px;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: rotate(6deg);
    transition: transform .12s ease;
    text-align: center;
    line-height: 1;
    flex: none;
}
.pricestamp small { font-family: var(--body); font-weight: 700; font-size: .55rem; letter-spacing: .5px; text-transform: uppercase; }
.offer-row:hover .pricestamp { transform: rotate(-4deg) scale(1.06); }
.pricestamp.free { background: var(--leaf); color: var(--paper); }

.offer-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 2px solid var(--ink);
    border-radius: 10px;
    flex: none;
    align-self: center;
    background: var(--paper-deep);
}
.offer-hero {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border: var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.chip {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 1px 8px;
    background: var(--paper-deep);
}
.chip.hot { background: var(--hot); color: var(--paper); border-color: var(--hot-deep); }
.chip.leaf { background: var(--leaf); color: var(--paper); }
.chip.warn { background: var(--mustard); }
.chip.dim { opacity: .6; }

/* ---------- buttons ---------- */
.btn {
    font-family: var(--display);
    font-weight: 700;
    font-size: .95rem;
    white-space: nowrap;
    padding: 9px 18px;
    border: var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover:not(:disabled) { transform: translate(-1.5px, -1.5px); box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--hot); color: var(--paper); border-color: var(--hot-deep); }
.btn.leaf { background: var(--leaf); color: var(--paper); }
.btn.danger { background: var(--danger); color: var(--paper); }
.btn.ghost { background: transparent; border-style: dashed; }
.btn.small { font-size: .8rem; padding: 5px 10px; border-width: 1.5px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row.stack { flex-direction: column; }

/* ---------- forms ---------- */
.field { margin: 12px 0; }
.field label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 4px; letter-spacing: .3px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="datetime-local"], .field select, .field textarea {
    width: 100%;
    font-family: var(--body);
    font-size: 1rem;
    padding: 9px 12px;
    border: var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(194, 67, 31, 0.35);
}
.field .hint { font-size: .78rem; color: var(--ink-soft); margin-top: 3px; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: .95rem; }
.checkline input { width: 18px; height: 18px; accent-color: var(--hot); }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-fields .field { flex: 1; min-width: 130px; }

.error-box {
    background: #fbe6e4;
    border: 2px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-weight: 700;
    padding: 8px 12px;
    margin: 10px 0;
}
.ok-box {
    background: #e7f2e4;
    border: 2px solid var(--leaf);
    border-radius: 8px;
    color: var(--leaf);
    font-weight: 700;
    padding: 8px 12px;
    margin: 10px 0;
}

/* ---------- auth hero ---------- */
.hero {
    text-align: center;
    padding: 40px 0 8px;
}
.hero h1 { font-size: 2.6rem; font-weight: 800; letter-spacing: -1px; }
.hero h1 em { color: var(--hot); font-style: normal; }
.hero p { color: var(--ink-soft); max-width: 480px; margin: 8px auto; }
.auth-card { max-width: 420px; margin: 20px auto; }
.auth-toggle { display: flex; gap: 8px; margin-bottom: 10px; }
.auth-toggle button {
    flex: 1;
    font-family: var(--display);
    font-weight: 700;
    padding: 8px;
    border: var(--line);
    border-radius: 8px;
    background: var(--paper-deep);
    cursor: pointer;
}
.auth-toggle button.active { background: var(--ink); color: var(--paper); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.grid th {
    font-family: var(--display);
    text-align: left;
    border-bottom: 2px solid var(--ink);
    padding: 6px 10px 6px 0;
    white-space: nowrap;
}
table.grid td { border-bottom: 1px dashed rgba(38,24,14,.3); padding: 8px 10px 8px 0; vertical-align: top; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: var(--paper-deep); }
table.grid tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- map ---------- */
.map-box {
    height: 300px;
    border: var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 10px 0;
}
.geocode-results { margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.geocode-results button {
    text-align: left;
    font-family: var(--body);
    font-size: .88rem;
    padding: 6px 10px;
    background: var(--paper-deep);
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    cursor: pointer;
}
.geocode-results button:hover { background: var(--mustard); }

/* ---------- modal ---------- */
.modal-veil {
    position: fixed;
    inset: 0;
    background: rgba(38, 24, 14, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}
.modal {
    background: var(--card);
    border: var(--line);
    border-radius: var(--radius);
    box-shadow: 6px 6px 0 rgba(38,24,14,.9);
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 20px;
    animation: rise .18s ease both;
}

/* ---------- pickup QR ---------- */
.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin: 10px 0;
}
.qr-box img, .qr-box canvas { image-rendering: pixelated; }
.qr-code-text { font-family: var(--body); font-size: .7rem; color: var(--ink-soft); word-break: break-all; text-align: center; }

/* ---------- QR scanner ---------- */
.scan-stage {
    position: relative;
    border: var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 3 / 4;
    max-height: 60vh;
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle {
    position: absolute;
    inset: 15%;
    border: 3px dashed rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    pointer-events: none;
}

/* ---------- loyalty meter ---------- */
.loyalty {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    margin: 8px 0;
}
.loyalty .dot {
    width: 16px;
    height: 16px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--paper-deep);
}
.loyalty .dot.full { background: var(--hot); }
.loyalty .dot.prize { background: var(--leaf); width: 20px; height: 20px; }
.loyalty span { font-size: .8rem; font-weight: 700; margin-left: 6px; }

/* ---------- misc ---------- */
.section-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}
.section-title h2 { font-size: 1.5rem; margin: 0; }
.section-title .sub { color: var(--ink-soft); font-size: .85rem; }
.empty {
    text-align: center;
    color: var(--ink-soft);
    padding: 34px 10px;
    border: 2px dashed rgba(38,24,14,.35);
    border-radius: var(--radius);
    margin: 16px 0;
    font-style: italic;
}
.muted { color: var(--ink-soft); font-size: .85rem; }
.stat-big { font-family: var(--display); font-weight: 800; font-size: 1.6rem; }
.leaflet-container { font-family: var(--body); }

/* ---------- portrait phones ---------- */
@media (max-width: 560px) {
    .pricestamp { min-width: 60px; height: 60px; font-size: 1.2rem; }
    .offer-thumb { width: 56px; height: 56px; }
    .hero h1 { font-size: 2rem; }
    .tagline { display: none; }

    /* Identity wraps to its own centered line under the wordmark. */
    .masthead { justify-content: center; }
    .masthead-user { flex-basis: 100%; }

    .topnav button { font-size: .82rem; padding: 6px 10px; }
    .btn { font-size: .88rem; padding: 8px 12px; }

    /* Offer rows: text + price stamp share the first line, the action
       buttons drop to their own full-width row instead of squeezing and
       breaking mid-word. */
    .offer-row { flex-wrap: wrap; }
    .offer-main { flex: 1 1 140px; min-width: 0; }
    .offer-row .row-actions {
        flex-basis: 100%;
        flex-direction: row;
        align-self: auto;
        margin-top: 8px;
    }
    .offer-row .row-actions .btn { flex: 1; }

    .modal { padding: 14px; }
    .map-box { height: 240px; }
}
