/* ═══════════════════════════════════════════════════════════
   OneTap Menu — Shared Design System
   Aesthetic: Clean editorial / warm mercantile
   Font: Syne (display) + DM Sans (body)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ── VARIABLES ── */
:root {
  --ink:       #18120e;
  --ink2:      #4a3d35;
  --ink3:      #8a7a70;
  --cream:     #faf8f4;
  --cream2:    #f3ede4;
  --cream3:    #ebe3d8;
  --border:    #e0d5c8;
  --border2:   #c9bfb3;
  --accent:    #e85c2c;
  --accent-dk: #c24820;
  --accent-lt: #fdf0eb;
  /* Space-separated for rgba(var(--accent-rgb), alpha) — updated by applyRestaurantTheme */
  --accent-rgb: 232, 92, 44;
  --green:     #1a7a4a;
  --green-lt:  #e8f5ee;
  --amber:     #b86e00;
  --amber-lt:  #fef5e0;
  --red:       #c02020;
  --red-lt:    #fdeaea;
  --blue:      #1a5fb4;
  --blue-lt:   #e8f0fc;
  --purple:    #6b3fa0;
  --purple-lt: #f3ecff;

  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow:    0 1px 3px rgba(24,18,14,.08), 0 4px 16px rgba(24,18,14,.06);
  --shadow-lg: 0 8px 32px rgba(24,18,14,.12);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --sidebar-w: 240px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Inline / body-text links that should follow restaurant accent */
a.link-accent {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.link-accent:hover { color: var(--accent-dk); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img { display: block; max-width: 100%; }

/* ── TYPOGRAPHY ── */
h1,h2,h3,h4,h5 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* ── FORM ELEMENTS ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink2);
}
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: .93rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14);
}
.input::placeholder, .textarea::placeholder { color: var(--ink3); }
.textarea { resize: vertical; min-height: 90px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a7a70' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(var(--accent-rgb), .32); }

.btn-secondary {
  background: var(--cream2);
  color: var(--ink);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--cream3); border-color: var(--border2); }

.btn-ghost {
  background: transparent;
  color: var(--ink2);
}
.btn-ghost:hover { background: var(--cream2); }

.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border: 1.5px solid rgba(192,32,32,.2);
}
.btn-danger:hover { background: #f8d7d7; }

.btn-success {
  background: var(--green-lt);
  color: var(--green);
  border: 1.5px solid rgba(26,122,74,.2);
}

.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 13px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-green   { background: var(--green-lt);  color: var(--green); }
.badge-amber   { background: var(--amber-lt);  color: var(--amber); }
.badge-red     { background: var(--red-lt);    color: var(--red); }
.badge-blue    { background: var(--blue-lt);   color: var(--blue); }
.badge-purple  { background: var(--purple-lt); color: var(--purple); }
.badge-gray    { background: var(--cream3);    color: var(--ink2); }
.badge-accent  { background: var(--accent-lt); color: var(--accent-dk); }

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--radius); }

/* ── TOAST / ALERTS ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 18px;
  border: 1.5px solid;
}
.alert-error   { background: var(--red-lt);    color: var(--red);    border-color: rgba(192,32,32,.25); }
.alert-success { background: var(--green-lt);  color: var(--green);  border-color: rgba(26,122,74,.25); }
.alert-info    { background: var(--blue-lt);   color: var(--blue);   border-color: rgba(26,95,180,.25); }
.alert-warning { background: var(--amber-lt);  color: var(--amber);  border-color: rgba(184,110,0,.25); }

/* ── TOAST NOTIFICATION ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  pointer-events: all;
  max-width: 320px;
}
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red); }
.toast.toast-warning { background: var(--amber); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1.5px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  background: var(--cream2);
  padding: 11px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink2);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--cream); }
tbody td { padding: 12px 16px; vertical-align: middle; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24,18,14,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 { font-family: var(--font-display); font-size: 1.2rem; }
.modal-close {
  width: 32px; height: 32px;
  background: var(--cream2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink2);
  transition: background .15s;
}
.modal-close:hover { background: var(--cream3); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── LOADING SPINNER ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner-dark {
  border-color: rgba(24,18,14,.15);
  border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PAGE LOADER ── */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--cream);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity .3s, visibility .3s;
}
#page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}
.loader-bar {
  width: 160px; height: 3px;
  background: var(--cream3);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: barFill 1.2s ease infinite;
}
@keyframes barFill {
  0%   { width: 0;    margin-left: 0; }
  50%  { width: 60%;  margin-left: 20%; }
  100% { width: 0;    margin-left: 100%; }
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  gap: 12px;
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--cream2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
}
.empty-state h3 { font-size: 1rem; color: var(--ink2); }
.empty-state p { font-size: .88rem; color: var(--ink3); max-width: 280px; }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.divider-label {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink3); font-size: .8rem; margin: 20px 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── TOGGLE ── */
.toggle {
  position: relative;
  width: 42px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--cream3);
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── STATUS COLORS ── */
.status-new       { color: var(--blue);   background: var(--blue-lt);   }
.status-confirmed { color: var(--purple); background: var(--purple-lt); }
.status-preparing { color: var(--amber);  background: var(--amber-lt);  }
.status-ready     { color: var(--green);  background: var(--green-lt);  }
.status-done      { color: var(--green);  background: var(--green-lt);  }
.status-cancelled { color: var(--red);    background: var(--red-lt);    }
.status-delivered { color: var(--green);  background: var(--green-lt);  }

/* ── IMAGE UPLOAD AREA ── */
.upload-area {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--cream);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.upload-area-icon { color: var(--ink3); margin: 0 auto 10px; }
.upload-area h4 { font-size: .93rem; color: var(--ink2); }
.upload-area p  { font-size: .8rem; color: var(--ink3); margin-top: 4px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .modal { padding: 24px; }
}
