/* =====================================================================
   Soul Chicken Kiosk — mobile-first
   ===================================================================== */
:root {
  --bg: #0f0f10;
  --panel: #17181a;
  --panel-2: #1e1f22;
  --border: #2a2b2e;
  --text: #ffffff;
  --muted: #a0a1a6;
  --accent: #f5c518;    /* Soul Chicken yellow */
  --accent-ink: #0f0f10;
  --danger: #ff5a5f;
  --success: #4ade80;
  --radius: 18px;
  --tap: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: 24px;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* -------------------------- Top bar -------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top, 0) 16px 0 16px;
  background: linear-gradient(180deg, rgba(15,15,16,1), rgba(15,15,16,0.85));
  backdrop-filter: blur(12px);
  height: calc(64px + env(safe-area-inset-top, 0));
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 0.3px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.cart-btn {
  position: relative;
  width: var(--tap); height: var(--tap);
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  border: none; font-size: 22px;
  display: grid; place-items: center;
  cursor: pointer;
}
.cart-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: white;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--bg);
}

/* ------------------------ Env banner ------------------------- */
.env-banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  background: #3a2a08; border: 1px solid #6b4a0a; color: #ffd66b;
}
.env-banner.prod { background: #0b2a18; border-color: #1f6844; color: #7ee2a5; }

/* ------------------------ Category tabs ---------------------- */
.category-tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 14px 16px; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: 0 0 auto; padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); font-weight: 600;
  cursor: pointer; scroll-snap-align: start;
}
.cat-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ----------------------------- Menu -------------------------- */
.menu { padding: 8px 16px 120px; }
.menu-status { padding: 40px 8px; text-align: center; color: var(--muted); }
.menu-category { margin: 20px 0; }
.menu-category h3 {
  margin: 0 0 12px; font-size: 20px; letter-spacing: 0.2px;
}
.items-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .items-grid { grid-template-columns: 1fr 1fr; } }

.item-card {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px; gap: 12px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, border-color 0.15s;
}
.item-card:active { transform: scale(0.99); border-color: #3a3b3f; }
.item-image {
  width: 64px; height: 64px; border-radius: 12px;
  object-fit: cover; flex-shrink: 0; background: #222;
}
.item-body { flex: 1; min-width: 0; text-align: left; }
.item-hero {
  width: 100%; max-height: 280px; object-fit: cover;
  border-radius: 16px; margin: 8px 0 14px; background: #222;
  display: block;
}
.item-hero.hidden { display: none; }

.modifiers { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 16px; }
.mod-group {
  background: #17181a; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.mod-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mod-title { font-weight: 700; font-size: 15px; }
.mod-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #2a2b2e; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.mod-tag.required { background: #4a1f1f; color: #ff9b9b; }
.mod-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; cursor: pointer;
  border-top: 1px solid var(--border);
}
.mod-option:first-of-type { border-top: none; }
.mod-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.mod-name { flex: 1; font-size: 15px; }
.mod-price { color: var(--accent); font-size: 14px; font-weight: 600; }
.line-mods { color: var(--muted); font-size: 12px; margin-top: 2px; }
.item-title { font-weight: 700; font-size: 16px; }
.item-price { color: var(--accent); font-weight: 700; font-size: 16px; white-space: nowrap; }
.item-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* -------------------------- Drawers -------------------------- */
.drawer {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end;
}
.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}
.drawer-panel {
  position: relative; width: 100%;
  background: var(--panel);
  border-radius: 24px 24px 0 0;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0));
  max-height: 88vh; overflow-y: auto;
  animation: slideUp 0.2s ease;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
}
.drawer-panel.sheet { max-height: 70vh; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.drawer-head h2 { margin: 0; font-size: 18px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0.6; } to { transform: none; opacity: 1; } }

/* Cart */
.cart-lines { display: grid; gap: 10px; margin: 8px 0 16px; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  align-items: center;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px;
}
.cart-line .name { font-weight: 600; }
.cart-line .qty { display: flex; align-items: center; gap: 6px; }
.cart-line .qty button {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border);
  cursor: pointer;
}
.cart-line .price { color: var(--accent); font-weight: 700; min-width: 64px; text-align: right; }
.cart-line .remove { color: var(--danger); font-size: 12px; background: none; border: none; padding: 0; }

.cart-totals { margin: 6px 0 14px; }
.cart-totals .row { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0; }
.cart-totals .row:first-child { font-weight: 700; font-size: 18px; }

.phone-form { display: grid; gap: 10px; }
.phone-form label { font-size: 14px; color: var(--muted); }
.phone-form input {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  font-size: 16px;
}
.phone-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.primary {
  width: 100%; height: var(--tap); border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  border: none; font-weight: 800; font-size: 16px;
  cursor: pointer;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.error {
  margin-top: 4px; padding: 10px 12px;
  background: #3b0b10; border: 1px solid #641720; color: #ffb4b9;
  border-radius: 10px; font-size: 13px;
}

/* Item sheet */
.qty-row {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin: 20px 0;
}
.qty-btn {
  width: 48px; height: 48px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 22px; cursor: pointer;
}
.qty-val { font-size: 28px; font-weight: 800; min-width: 32px; text-align: center; }

/* -------------------------- Pay sheet -------------------------- */
.pay-amount-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.pay-amount-row.total {
  font-size: 22px; font-weight: 800;
  padding: 14px 0 20px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.order-id-chip {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted);
}

.pay-path {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.pay-path-title {
  font-weight: 800; font-size: 17px; margin-bottom: 4px; color: var(--accent);
}
.pay-path-sub {
  color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 12px;
}

.pay-qr {
  display: flex; align-items: center; justify-content: center;
  padding: 12px; background: var(--accent); border-radius: 14px;
  min-height: 260px; margin: 8px 0 10px;
}
.pay-qr canvas { display: block; border-radius: 8px; }

.pay-url {
  font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  color: var(--muted); word-break: break-all;
  padding: 8px 10px; background: #0b0b0c; border-radius: 8px;
  margin-top: 6px;
}
.pay-hint { font-size: 12px; margin-top: 8px; text-align: center; }

.pay-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 2px; margin: 4px 0 14px;
}
.pay-divider::before, .pay-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
