/* BITE - design tokens + components. Dark-first (app dùng buổi tối). */

:root {
    --canvas: #0b0f0c;
    --surface: #131a15;
    --surface2: #1a231c;
    --line: #26332a;
    --text: #eef3ee;
    --text2: #a7b3a9;
    --muted: #71806f;
    --primary: #4ade80;
    --on-primary: #062812;
    --primary-dim: rgba(74, 222, 128, 0.12);
    --amber: #fbbf24;
    --on-amber: #3b2503;
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, 0.12);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --ring: rgba(74, 222, 128, 0.55);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    --radius-sm: 10px;
    color-scheme: dark;
}

[data-theme="light"] {
    --canvas: #f4f7f4;
    --surface: #ffffff;
    --surface2: #ecf1ec;
    --line: #dbe4db;
    --text: #121c14;
    --text2: #47564b;
    --muted: #7d8b80;
    --primary: #15803d;
    --on-primary: #ffffff;
    --primary-dim: rgba(21, 128, 61, 0.1);
    --amber: #b45309;
    --on-amber: #ffffff;
    --danger: #dc2626;
    --danger-dim: rgba(220, 38, 38, 0.08);
    --bg-hover: rgba(0, 0, 0, 0.05);
    --ring: rgba(21, 128, 61, 0.45);
    --shadow: 0 1px 3px rgba(20, 40, 25, 0.1);
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--canvas);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.num, .price, .code { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

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

/* ── Layout ── */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-bottom: 64px; }
.section { margin-top: 40px; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* ── Nav ── */
.nav {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--canvas) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 8px; height: 58px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo svg { color: var(--primary); }
.logo .dotvn { color: var(--primary); font-size: 13px; font-weight: 700; align-self: flex-end; padding-bottom: 3px; }
.nav-spacer { flex: 1; }
.nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 12px; border-radius: 999px;
    color: var(--text2); font-size: 14px; font-weight: 600;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 999px;
    background: none; border: none; color: var(--text2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 12px 20px; border-radius: 999px;
    font-size: 16px; font-weight: 700; font-family: inherit;
    border: 1px solid transparent; cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, var(--text) 12%); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-dim); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ── Hero ── */
.hero { padding: 36px 0 8px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; max-width: 640px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p { color: var(--text2); max-width: 560px; margin-top: 12px; font-size: 17px; }

/* ── Impact strip ── */
.impact {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    margin-top: 24px;
}
@media (min-width: 720px) { .impact { grid-template-columns: repeat(4, 1fr); } }
.impact-tile {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px;
}
.impact-tile b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--primary); font-variant-numeric: tabular-nums; }
.impact-tile span { font-size: 13px; color: var(--text2); }

/* ── Filter chips ── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 18px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 8px 16px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
    color: var(--text2); font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: inherit; text-decoration: none;
}
.chip:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ── Box grid + card ── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; color: var(--text);
    display: flex; flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.sticker {
    position: absolute; top: 8px; left: 8px;
    background: var(--amber); color: var(--on-amber);
    font-size: 13px; font-weight: 800; padding: 4px 9px;
    border-radius: 8px; transform: rotate(-3deg);
    font-variant-numeric: tabular-nums;
}
.pill-left {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0, 0, 0, 0.65); color: #fff;
    font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.pill-featured {
    position: absolute; top: 8px; right: 8px;
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(0, 0, 0, 0.65); color: var(--amber);
    font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
[data-theme="light"] .pill-featured { color: #fcd34d; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-size: 15px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-store { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.card-store svg { flex-shrink: 0; }
.card-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.card-price { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.price-new { font-size: 18px; font-weight: 800; color: var(--amber); }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }

/* ── Empty state ── */
.empty { text-align: center; padding: 48px 16px; }
.empty svg { color: var(--muted); margin: 0 auto 12px; }
.empty h3 { font-size: 18px; font-weight: 700; }
.empty p { color: var(--text2); font-size: 14.5px; max-width: 420px; margin: 8px auto 20px; }

/* ── How it works ── */
.steps { display: grid; gap: 12px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step-n {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--primary-dim); color: var(--primary);
    display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.step h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.step p { font-size: 14px; color: var(--text2); }

/* ── Merchant CTA banner ── */
.banner {
    background: linear-gradient(135deg, var(--primary-dim), transparent 70%), var(--surface);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--line));
    border-radius: var(--radius); padding: 26px 22px;
    display: flex; flex-direction: column; gap: 14px;
}
@media (min-width: 720px) { .banner { flex-direction: row; align-items: center; justify-content: space-between; } }
.banner h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.banner p { color: var(--text2); font-size: 14.5px; margin-top: 4px; max-width: 480px; }

/* ── Forms ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input {
    width: 100%; min-height: 48px; padding: 12px 14px;
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 16px; font-family: inherit;
}
textarea.input { resize: vertical; min-height: 72px; }
.input:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: transparent; }
.input.invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* qty stepper */
.stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface2); }
.stepper button {
    width: 48px; height: 48px; border: none; background: none; color: var(--text);
    font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 999px;
}
.stepper button:hover { background: var(--bg-hover); }
.stepper b { min-width: 40px; text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ── Panels / cards ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 14px; }
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ── Flash / alert ── */
.flash {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--primary-dim); border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
    color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px;
    font-size: 14.5px; margin: 16px 0;
}
.flash svg { color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.flash.warn { background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.flash.warn svg { color: var(--danger); }

/* ── Boarding pass (rescue code) ── */
.pass { max-width: 420px; margin: 24px auto 0; }
.pass-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.pass-top { padding: 22px 22px 18px; text-align: center; }
.pass-top .status-line { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em; }
.pass-top .status-line.done { color: var(--primary); }
.pass-top .status-line.dead { color: var(--muted); }
.code-big {
    font-size: clamp(40px, 13vw, 56px); font-weight: 800; letter-spacing: 0.12em;
    margin: 10px 0 2px; font-variant-numeric: tabular-nums;
}
.pass-sub { color: var(--text2); font-size: 14px; }
.pass-cut { position: relative; border-top: 2px dashed var(--line); margin: 0 -1px; }
.pass-cut::before, .pass-cut::after {
    content: ""; position: absolute; top: -11px; width: 22px; height: 22px;
    background: var(--canvas); border-radius: 50%;
}
.pass-cut::before { left: -12px; border-right: 1px solid var(--line); }
.pass-cut::after { right: -12px; border-left: 1px solid var(--line); }
.pass-bottom { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.pass-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.pass-line .k { color: var(--muted); flex-shrink: 0; }
.pass-line .v { font-weight: 600; text-align: right; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--amber); }

/* ── Stats tiles (rescue record / dashboard) ── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: 12.5px; color: var(--text2); }
.stat.accent b { color: var(--primary); }

/* ── Badge hero ── */
.badge-hero {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, var(--primary-dim), transparent 60%), var(--surface);
    border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--line));
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
}
.badge-hero .medal {
    width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
    background: var(--primary); color: var(--on-primary);
    display: flex; align-items: center; justify-content: center;
}
.badge-hero h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.badge-hero p { font-size: 13.5px; color: var(--text2); }

/* progress bar */
.bar { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* ── List rows (reservations, history) ── */
.rowlist { display: flex; flex-direction: column; gap: 10px; }
.rowitem {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 12px 14px;
}
.rowitem .grow { flex: 1; min-width: 0; }
.rowitem .t { font-weight: 700; font-size: 15px; }
.rowitem .s { font-size: 13px; color: var(--text2); }
.rowitem .code-chip {
    font-weight: 800; font-size: 15px; letter-spacing: 0.08em;
    background: var(--primary-dim); color: var(--primary);
    padding: 6px 10px; border-radius: 8px; font-variant-numeric: tabular-nums;
}
.rowactions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Premium plans ── */
.plans { display: grid; gap: 12px; }
@media (min-width: 720px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.plan.best { border-color: var(--primary); position: relative; }
.plan .best-tag {
    position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: var(--on-primary);
    font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.plan h3 { font-size: 15px; font-weight: 700; color: var(--text2); }
.plan .amount { font-size: 26px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.plan .per { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

/* ── Toast ── */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(8px);
    background: var(--text); color: var(--canvas);
    padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Store header ── */
.store-head { display: flex; gap: 14px; align-items: flex-start; padding: 24px 0 4px; }
.store-avatar {
    width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
    background: var(--surface2); color: var(--muted); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.store-avatar img { width: 100%; height: 100%; object-fit: cover; }
.store-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.store-head .sub { color: var(--text2); font-size: 13.5px; margin-top: 3px; }

/* ── Box detail ── */
.detail { display: grid; gap: 20px; margin-top: 20px; }
@media (min-width: 860px) { .detail { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.detail-media { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface2); aspect-ratio: 4 / 3; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-media .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.detail h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 2px; }
.price-row .price-new { font-size: 30px; }
.price-row .price-old { font-size: 16px; }
.meta-line { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 14.5px; padding: 5px 0; }
.meta-line svg { color: var(--muted); flex-shrink: 0; }

/* footer */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 48px; }
footer .cols { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: flex-start; }
footer p { color: var(--muted); font-size: 13px; max-width: 420px; }
footer .links { display: flex; gap: 16px; }
footer a { color: var(--text2); font-size: 13.5px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

/* ── Viral: milestone + bảng vàng ── */
.milestone-strip { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.milestone-flash {
    display: flex; flex-direction: column; gap: 2px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), transparent 70%);
    border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line));
    border-radius: var(--radius-sm); padding: 12px 14px;
}
.milestone-flash b { color: var(--amber); font-size: 15px; letter-spacing: 0.02em; }
.milestone-flash span { font-size: 12.5px; color: var(--text2); }
.lb-rank {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px;
    background: var(--surface2); color: var(--text2);
}
.lb-rank-1 { background: var(--amber); color: var(--on-amber); }
.lb-rank-2 { background: color-mix(in srgb, var(--text2) 30%, var(--surface2)); color: var(--text); }
.lb-rank-3 { background: color-mix(in srgb, var(--amber) 30%, var(--surface2)); color: var(--text); }
.rowitem.lb-me { border-color: var(--primary); background: var(--primary-dim); }
a.rowitem:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }

/* utilities */
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* pagination (Laravel default markup) */
.pagination { display: flex; gap: 6px; list-style: none; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text2); font-size: 14px; }
.pagination .active span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
