/* ── Fonts ─────────────────────────────────────────────────── */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/plus-jakarta-sans-var.woff2') format('woff2');
}

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* ── Primitives ──────────────────────────────────────────
     The design system proper. Everything below the "Legacy
     aliases" heading maps the older token names onto these,
     so manage.css / auth.css / inline styles keep working. */

  /* Brand */
  --primary:       #C84B31;
  --primary-dark:  #A93A24;
  --primary-soft:  #FBEAE5;
  --emerald:       #006A4E;
  --emerald-dark:  #00543E;
  --emerald-soft:  #E3F2EC;
  --amber:         #DD9426;
  --amber-soft:    #FCF3E1;

  /* Warm neutrals */
  --ink:           #1F1A17;
  --ink-soft:      #4A3F39;
  --muted:         #6E6862;
  --surface:       #FFFFFF;
  --surface-warm:  #F6F5F3;
  --line:          #E9E7E3;
  --line-strong:   #D8D5D0;

  /* Semantic */
  --success:       #1E7F4F;
  --success-soft:  #E4F3EA;
  --danger:        #BE3455;
  --danger-soft:   #FAE8ED;
  --info:          #2D6CA2;
  --info-soft:     #E7F0F8;

  /* Type */
  --font:          'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --text-xs:       0.75rem;
  --text-sm:       0.875rem;
  --text-base:     1rem;
  --text-lg:       1.125rem;
  --text-xl:       1.375rem;
  --text-2xl:      1.75rem;
  --text-3xl:      2.25rem;
  --text-4xl:      3rem;

  /* Shape & depth */
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --radius-full:   999px;
  --shadow-sm:     0 1px 4px rgba(31,26,23,.06);
  --shadow:        0 3px 14px rgba(31,26,23,.08);
  --shadow-lg:     0 12px 36px rgba(31,26,23,.14);

  /* Layout */
  --container:     1160px;
  --header-h:      68px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --transition:    .18s ease;

  /* ── Legacy aliases ──────────────────────────────────────
     Kept so the management area and older rules need no edit.
     Prefer the primitives above in new code. */
  --orange:        var(--primary);
  --orange-light:  var(--primary-dark);   /* hover now darkens, per the reference */
  --orange-pale:   var(--primary-soft);
  --orange-border: var(--line-strong);
  --brown-dark:    var(--ink);
  --brown-mid:     var(--ink-soft);
  --brown-light:   var(--ink-soft);
  --cream:         var(--surface-warm);
  --white:         var(--surface);
  --gray-100:      #FAFAF9;
  --gray-200:      var(--line);
  --gray-300:      var(--line-strong);
  --gray-400:      var(--line-strong);
  --gray-500:      var(--muted);
  --gray-600:      var(--muted);
  --gray-800:      var(--ink-soft);
  --text:          var(--ink);
  --text-muted:    var(--muted);
  --border:        var(--line);
  --heading:       var(--ink);
  --green:         var(--emerald);
  --green-pale:    var(--emerald-soft);
  --red:           var(--danger);
  --red-pale:      var(--danger-soft);
  --yellow:        var(--amber);
  --yellow-pale:   var(--amber-soft);
  --blue:          var(--info);
  --blue-pale:     var(--info-soft);
  --ring:          var(--primary-soft);
  --radius-2:      var(--radius-sm);
  --radius-3:      var(--radius);
  --radius-xl:     var(--radius-lg);
  --radius-pill:   var(--radius-full);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--primary-soft); }

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

/* Public-facing headings (scoped so management pages keep their own styling) */
.customer-app h1, .customer-app h2, .customer-app h3,
.customer-app h4, .customer-app h5, .customer-app h6,
.auth-page h1, .auth-page h2, .auth-page h3,
.auth-page h4, .auth-page h5, .auth-page h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--heading);
  text-wrap: balance;
}

.customer-app p, .auth-page p { text-wrap: pretty; }

img { max-width: 100%; display: block; }

/* ── Shared form elements ──────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-group label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.field-group input,
.field-group select,
.field-group textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-group textarea { resize: vertical; min-height: 90px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-emerald {
  background: var(--emerald);
  color: #fff;
}
.btn-emerald:hover { background: var(--emerald-dark); color: #fff; }

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-outline:hover { border-color: var(--ink-soft); background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--surface-warm); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { background: #f4d6df; color: var(--danger); }

.btn-sm { padding: 6px 14px; font-size: var(--text-xs); }
.btn-lg { padding: 14px 28px; font-size: var(--text-base); }
.btn-full,
.btn-block { width: 100%; justify-content: center; }

@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  flex-shrink: 0;
}
button[type="submit"]:disabled { opacity: .72; cursor: not-allowed; }

/* ── Badges / status pills ─────────────────────────────────── */
/* Class names are emitted from the order / kitchen status enums —
   keep every one of them even if it looks unused here. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-plain::before { display: none; }

.badge-pending        { background: var(--amber-soft);   color: #9A6614; }
.badge-preparing      { background: var(--info-soft);    color: var(--info); }
.badge-ready          { background: var(--primary-soft); color: var(--primary); }
.badge-delivered      { background: var(--success-soft); color: var(--success); }
.badge-cancelled      { background: var(--danger-soft);  color: var(--danger); }
.badge-accepted       { background: var(--info-soft);    color: var(--info); }
.badge-confirmed      { background: var(--success-soft); color: var(--success); }
.badge-completed      { background: var(--surface-warm); color: var(--muted); }
.badge-pendingapproval{ background: var(--amber-soft);   color: #9A6614; }
.badge-inreview       { background: var(--info-soft);    color: var(--info); }
.badge-approved       { background: var(--success-soft); color: var(--success); }
.badge-rejected       { background: var(--danger-soft);  color: var(--danger); }
.badge-open           { background: var(--emerald-soft); color: var(--emerald); }
.badge-paused         { background: var(--surface-warm); color: var(--muted); }

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.card-hover { transition: box-shadow .2s, transform .2s; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* ── Toggle switch ─────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--emerald); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: var(--text-sm); color: var(--muted); }

/* ── Utility ───────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-center { text-align: center; }
.mt-1 { margin-top:  8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom:  8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap:  8px; }
.gap-2 { gap: 16px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap  { flex-wrap: wrap; }
