/* Dip&Sip Table — customer portal styles */
:root {
  --ds-ink: #161616;
  --ds-ink-soft: #4a4a4a;
  --ds-paper: #fbfaf7;
  --ds-paper-2: #f2efe8;
  --ds-accent: #E15635;        /* Dip&Sip warm accent */
  --ds-accent-2: #f49715;      /* secondary highlight */
  --ds-accent-ink: #ffffff;
  --ds-primary: #6E2A1A;       /* Deep Spice — darkened terracotta, primary button fill (replaces black) */
  --ds-primary-ink: #ffffff;
  --ds-line: rgba(22, 22, 22, 0.08);
  --ds-success: #2f7d3a;
  --ds-warn: #f49715;
  --ds-danger: #b1301c;
  --ds-radius: 14px;
  --ds-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --ds-font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ds-serif: 'Instrument Serif', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ds-font);
  background: var(--ds-paper);
  color: var(--ds-ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* Layout */
.ds-shell { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--ds-dock-h, 112px) + 20px); }
.ds-boot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70dvh; gap: 14px; color: var(--ds-ink-soft); }

/* Header */
.ds-top {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(var(--ds-paper) 85%, rgba(251, 250, 247, 0));
  padding: 12px 0 8px;
  display: flex; align-items: center; gap: 12px;
}
.ds-top .brand { display: flex; align-items: center; gap: 8px; }
.ds-top .brand img { width: 28px; height: 28px; }
.ds-top .brand strong { font-family: var(--ds-serif); font-size: 20px; letter-spacing: 0.2px; }
.ds-top .ctx { margin-left: auto; text-align: right; font-size: 12px; color: var(--ds-ink-soft); }
.ds-top .ctx .rname { font-weight: 600; color: var(--ds-ink); }

/* Menu */
.ds-cat { margin: 18px 0 8px; font-family: var(--ds-serif); font-size: 22px; }
.ds-item {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--ds-line);
}
.ds-item .n { font-weight: 600; }
.ds-item .d { font-size: 13px; color: var(--ds-ink-soft); margin-top: 2px; }
.ds-item .p { font-weight: 600; align-self: start; white-space: nowrap; }
.ds-item .add {
  grid-column: 2; align-self: end;
  background: var(--ds-primary); color: var(--ds-primary-ink); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
}
.ds-item .add:disabled { opacity: 0.4; }
.ds-item .add.customize { background: var(--ds-accent); }
.ds-menu-stepper {
  display: inline-flex; align-items: center;
  background: var(--ds-accent); border-radius: 999px;
  grid-column: 2; align-self: end; overflow: hidden;
}
.ds-menu-stepper .ds-stepper-dec,
.ds-menu-stepper .ds-stepper-inc {
  width: 32px; height: 32px; color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ds-menu-stepper .ds-stepper-dec:disabled,
.ds-menu-stepper .ds-stepper-inc:disabled { opacity: 0.5; }
.ds-menu-stepper .ds-stepper-count {
  min-width: 26px; text-align: center; color: #fff; font-weight: 700; font-size: 14px;
  padding: 0 2px;
}

/* Unavailable items */
.ds-item--unavailable {
  opacity: 0.45;
  filter: grayscale(0.5);
  pointer-events: none;
}
.ds-badge-unavail {
  grid-column: 2; align-self: end;
  font-size: 11px; font-weight: 700; color: var(--ds-ink-soft);
  border: 1px solid var(--ds-line); border-radius: 999px;
  padding: 5px 10px; white-space: nowrap;
}

/* Customize modal */
.ds-customize-modal {
  max-height: 80dvh;
  overflow-y: auto;
}
.ds-customize-group {
  margin-bottom: 16px;
}
.ds-customize-group-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--ds-ink);
}
.ds-required { color: #c0392b; }
.ds-customize-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ds-customize-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--ds-line);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.ds-customize-option:hover { background: var(--ds-paper-2); }
.ds-customize-option input { accent-color: var(--ds-primary); flex-shrink: 0; }
.ds-customize-option span:first-of-type { flex: 1; }
.ds-extra-price { font-size: 0.82rem; font-weight: 600; color: var(--ds-ink-soft); white-space: nowrap; }
.ds-customize-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--ds-line);
  flex-wrap: wrap;
  gap: 10px;
}

/* Bottom dock — pairs the Review Order pill with the AI assistant button */
.ds-dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 30; pointer-events: none;
  width: min(720px, 100%); margin: 0 auto;
  box-sizing: border-box;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
/* Opaque surface — only when the dock holds the cart pill and/or the chat
   button, so the post-payment / bare state stays invisible. Stops menu
   content from bleeding through behind the floating chat circle. */
.ds-dock.has-content {
  pointer-events: auto;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--ds-line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
}
.ds-dock > #ds-fab {
  flex: 1 1 0; min-width: 0;
  display: flex; justify-content: center;
  pointer-events: none;
}
/* View action rail — status/cart CTAs stack here, left of the chat circle */
.ds-dock > #ds-dock-actions {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
}
.ds-dock > #ds-fab:empty,
.ds-dock > #ds-dock-actions:empty { display: none; }

/* Cart fab */
.ds-fab {
  background: var(--ds-primary); color: var(--ds-primary-ink); border-radius: 999px;
  padding: 12px 18px; display: flex; gap: 10px; align-items: center;
  font-weight: 600; box-shadow: var(--ds-shadow);
  min-width: 220px; max-width: 100%; justify-content: center;
  white-space: nowrap; pointer-events: auto;
}
.ds-fab .count {
  background: var(--ds-accent); border-radius: 999px; padding: 2px 8px; font-size: 12px;
}

/* Chat widget */
.ds-chat {
  position: relative; flex: 0 0 auto; pointer-events: auto;
  margin-left: auto;   /* always pin to the right edge, even when alone */
}
.ds-chat-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ds-accent), var(--ds-accent-2));
  color: var(--ds-accent-ink); box-shadow: var(--ds-shadow);
  display: flex; align-items: center; justify-content: center;
}
.ds-chat-panel {
  position: absolute; right: 0; bottom: 64px;
  width: min(360px, 92vw); max-height: 70dvh;
  background: #fff; border-radius: var(--ds-radius); box-shadow: var(--ds-shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
.ds-chat-panel header {
  padding: 10px 14px; background: var(--ds-accent); color: #fff; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.ds-chat-panel .msgs { flex: 1; padding: 10px; overflow-y: auto; }
.ds-chat-panel .msg { margin: 6px 0; padding: 8px 10px; border-radius: 10px; max-width: 85%; font-size: 14px; }
.ds-chat-panel .msg.u { background: var(--ds-paper-2); margin-left: auto; }
.ds-chat-panel .msg.a { background: #fff6ee; border: 1px solid #f5dcc7; }
.ds-chat-panel form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--ds-line); }
.ds-chat-panel input { flex: 1; padding: 8px 10px; border: 1px solid var(--ds-line); border-radius: 10px; font: inherit; }
.ds-chat-panel button[type="submit"] { background: var(--ds-primary); color: var(--ds-primary-ink); border-radius: 10px; padding: 8px 12px; }

/* Cart view */
.ds-cart-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--ds-line);
}
.ds-cart-row .who { font-size: 12px; color: var(--ds-ink-soft); }
.ds-qty { display: inline-flex; align-items: center; gap: 6px; }
.ds-qty button { width: 28px; height: 28px; border-radius: 999px; background: var(--ds-paper-2); font-weight: 700; }

/* Buttons */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--ds-radius); font-weight: 600;
  background: var(--ds-primary); color: var(--ds-primary-ink); width: 100%;
}
.ds-btn.secondary { background: var(--ds-paper-2); color: var(--ds-ink); }
.ds-btn.danger { background: var(--ds-danger); }
.ds-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Pills */
.ds-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.ds-pill.ok { background: #e7f4e9; color: var(--ds-success); }
.ds-pill.warn { background: #fff1d7; color: var(--ds-warn); }
.ds-pill.bad { background: #fde5e1; color: var(--ds-danger); }

/* Dialog / overlay */
.ds-overlay {
  position: fixed; inset: 0; background: rgba(22,22,22,0.35);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 40;
}
.ds-sheet {
  width: 100%; max-width: 520px; background: var(--ds-paper);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 16px 18px 24px; box-shadow: var(--ds-shadow);
  animation: ds-rise 0.2s ease-out;
}
@keyframes ds-rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Forms */
.ds-field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.ds-field label { font-size: 12px; color: var(--ds-ink-soft); font-weight: 600; }
.ds-field input, .ds-field select, .ds-field textarea {
  padding: 10px; border: 1px solid var(--ds-line); border-radius: 10px; font: inherit; background: #fff;
}
.ds-field.row { display: flex; gap: 10px; }

/* Error page */
.ds-error {
  min-height: 70dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 16px;
  padding: 24px;
}
.ds-error h1 { font-family: var(--ds-serif); font-size: 28px; margin: 0; }
.ds-error p { color: var(--ds-ink-soft); max-width: 32ch; margin: 0; }

/* Countdown */
.ds-countdown {
  padding: 10px 14px; background: #fff6ee; border: 1px solid #f5dcc7;
  border-radius: 10px; margin: 12px 0; font-size: 14px; display: flex; justify-content: space-between;
}

/* Reviews */
.ds-stars { display: flex; gap: 4px; }
.ds-stars button { font-size: 22px; padding: 2px 4px; }

/* Modal */
.ds-modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 14, 10, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000; padding: 12px;
}
.ds-modal {
  background: var(--ds-paper); border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 520px;
  animation: ds-rise 220ms ease-out;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.15);
}
@media (min-width: 600px) {
  .ds-modal-overlay { align-items: center; }
  .ds-modal { border-radius: 16px; }
}

/* Post-confirm status+menu combo view */
.ds-status-section {
  margin: 14px 0; padding: 12px 14px;
  background: var(--ds-paper-2); border: 1px solid var(--ds-line);
  border-radius: 12px;
}
.ds-status-section h3 {
  font-family: var(--ds-serif); font-size: 18px; margin: 0 0 8px;
}
.ds-status-section .row {
  display: flex; justify-content: space-between; padding: 4px 0;
  color: var(--ds-ink); font-size: 15px;
}
/* Toast notification */
.ds-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ds-primary); color: var(--ds-primary-ink);
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--ds-shadow); z-index: 50;
  animation: ds-toast-in 0.25s ease-out;
  pointer-events: none;
}
@keyframes ds-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Inline status dots — compact 4-square progress shown next to each diner name */
.ds-status-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  vertical-align: middle;
}
.ds-sq {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--ds-line);
  transition: background 0.3s;
}
.ds-sq--done {
  background: var(--ds-success);
}
.ds-sq--active {
  background: var(--ds-accent);
  animation: ds-sq-pulse 1.4s ease-in-out infinite;
}
@keyframes ds-sq-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 86, 53, 0.45); }
  50%       { box-shadow: 0 0 0 4px rgba(225, 86, 53, 0); }
}

/* Motion prefers */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
