/* =========================================================
   CaffeGo — Core Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600;9..144,700;9..144,800&family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand palette — warm specialty-coffee */
  --espresso: #2A1810;
  --espresso-soft: #3B2418;
  --coffee: #6F4E37;
  --coffee-light: #9B7B5E;
  --cream: #F6EFE4;
  --cream-soft: #FBF7F0;
  --milk: #FFFFFF;
  --amber: #E07A1F;
  --amber-soft: #F4B66A;
  --amber-deep: #B85A0E;
  --leaf: #5F7A4F;
  --ruby: #C0392B;
  --gold: #D4A24C;

  /* Surfaces */
  --bg: var(--cream-soft);
  --surface: var(--milk);
  --surface-2: #FAF3E8;
  --surface-3: #F1E8D8;
  --ink: var(--espresso);
  --ink-soft: #5A463A;
  --ink-mute: #8B7868;
  --line: rgba(42, 24, 16, 0.10);
  --line-strong: rgba(42, 24, 16, 0.18);

  /* Type */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Manrope', system-ui, sans-serif;

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(42, 24, 16, 0.05);
  --shadow-sm: 0 4px 14px rgba(42, 24, 16, 0.06);
  --shadow-md: 0 14px 40px -10px rgba(42, 24, 16, 0.18);
  --shadow-lg: 0 30px 80px -20px rgba(42, 24, 16, 0.25);
  --shadow-amber: 0 18px 44px -16px rgba(224, 122, 31, 0.55);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #1A0F09;
  --surface: #261810;
  --surface-2: #2E1E14;
  --surface-3: #3A271A;
  --ink: #F4E8D6;
  --ink-soft: #C8B49C;
  --ink-mute: #8C7860;
  --line: rgba(244, 232, 214, 0.10);
  --line-strong: rgba(244, 232, 214, 0.18);
  --cream: #261810;
  --cream-soft: #1A0F09;
  --milk: #2E1E14;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }

/* Typography helpers */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.display em { font-style: italic; color: var(--amber-deep); font-weight: 500; }
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-deep);
}
[data-theme="dark"] .eyebrow { color: var(--amber-soft); }

/* Layout */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-narrow { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 24px; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-amber);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 24px 50px -14px rgba(224, 122, 31, 0.7); }
.btn-dark {
  background: var(--espresso);
  color: var(--cream);
}
.btn-dark:hover { background: var(--espresso-soft); transform: translateY(-2px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft {
  background: var(--surface-2);
  color: var(--ink);
}
.btn-soft:hover { background: var(--surface-3); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 15.5px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2);
}
.btn-icon:hover { background: var(--surface-3); }

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s var(--ease);
}
.card-pad { padding: 24px; }
.card-pad-lg { padding: 32px; }
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.glass {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
[data-theme="dark"] .glass {
  background: rgba(46, 30, 20, 0.65);
  border-color: rgba(244, 232, 214, 0.08);
}

/* =========================================================
   Forms
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input, .select, .textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 14.5px;
  color: var(--ink);
  transition: all 0.2s var(--ease);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(224, 122, 31, 0.12);
}
.textarea { resize: vertical; min-height: 100px; }
.input::placeholder { color: var(--ink-mute); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  transition: all 0.2s var(--ease);
}
.search-bar:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(224, 122, 31, 0.10);
}
.search-bar input {
  border: none; background: transparent; outline: none;
  flex: 1; font-size: 14.5px;
}

/* =========================================================
   Badges & chips
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.badge-amber { background: rgba(224, 122, 31, 0.14); color: var(--amber-deep); }
.badge-leaf { background: rgba(95, 122, 79, 0.16); color: var(--leaf); }
.badge-ruby { background: rgba(192, 57, 43, 0.14); color: var(--ruby); }
.badge-gold { background: rgba(212, 162, 76, 0.18); color: #8B6520; }
.badge-dark { background: var(--espresso); color: var(--cream); }

.dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(95, 122, 79, 0.2);
}
.dot.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(95, 122, 79, 0.2); }
  50% { box-shadow: 0 0 0 7px rgba(95, 122, 79, 0.05); }
}
.dot.amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(224, 122, 31, 0.22); }
.dot.ruby { background: var(--ruby); box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2); }

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }

/* =========================================================
   Navbar (public pages)
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  padding: 18px 0;
  background: rgba(251, 247, 240, 0.78);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .nav { background: rgba(26, 15, 9, 0.78); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-deep) 100%);
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(224, 122, 31, 0.65);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute;
  inset: 7px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-top-color: transparent;
}
.brand em { font-style: italic; font-weight: 500; color: var(--amber-deep); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  transition: color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* =========================================================
   Toast notifications
   ========================================================= */
.toast-stack {
  position: fixed; top: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 12px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  min-width: 280px; max-width: 380px;
  padding: 14px 18px;
  background: var(--espresso);
  color: var(--cream);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 14px;
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease);
  border-left: 3px solid var(--amber);
}
.toast.success { border-left-color: var(--leaf); }
.toast.error { border-left-color: var(--ruby); border-left-width: 3px; }
.toast.info { border-left-color: var(--amber); }
.toast-icon { font-size: 18px; line-height: 1; padding-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; margin-bottom: 2px; font-family: var(--font-display); font-size: 15px; }
.toast-msg { color: rgba(246, 239, 228, 0.78); font-size: 13.5px; }
.toast.leaving { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* =========================================================
   Modal
   ========================================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26, 15, 9, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  padding: 24px;
  animation: fadeIn 0.25s var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s var(--ease);
  max-height: 90vh; overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-title { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }
.modal-close { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; line-height: 1; }
.modal-close:hover { background: var(--surface-3); }

/* =========================================================
   Skeleton loaders
   ========================================================= */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================
   Empty state
   ========================================================= */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-mute);
}
.empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 6px;
}

/* =========================================================
   Theme toggle
   ========================================================= */
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: inline-grid; place-items: center;
  transition: all 0.25s var(--ease);
  font-size: 16px;
}
.theme-toggle:hover { background: var(--surface-3); transform: rotate(15deg); }

/* =========================================================
   Utility
   ========================================================= */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.col { flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; }
.text-muted { color: var(--ink-mute); }
.text-soft { color: var(--ink-soft); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-sm { margin-top: 8px; } .mt-md { margin-top: 16px; } .mt-lg { margin-top: 24px; } .mt-xl { margin-top: 40px; }
.mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 24px; } .mb-xl { margin-bottom: 40px; }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* =========================================================
   Order status pills
   ========================================================= */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
.status-pending { background: rgba(212, 162, 76, 0.18); color: #8B6520; }
.status-accepted { background: rgba(95, 122, 79, 0.16); color: var(--leaf); }
.status-preparing { background: rgba(224, 122, 31, 0.16); color: var(--amber-deep); }
.status-ready { background: rgba(95, 122, 79, 0.22); color: #3D5731; }
.status-completed { background: var(--surface-3); color: var(--ink-soft); }
.status-cancelled { background: rgba(192, 57, 43, 0.14); color: var(--ruby); }

/* =========================================================
   Mobile responsive
   ========================================================= */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .container, .container-narrow { padding: 0 18px; }
  .modal { padding: 24px; }
  .toast-stack { top: 16px; right: 16px; left: 16px; }
  .toast { min-width: 0; max-width: none; }
}
