/* ==========================================================
   Restaurant Ordering System — Design System
   Palette: deep teal (ops calm) + warm amber (kitchen heat) + warm paper
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --primary: #0F766E;
  --secondary: #134E4A;
  --accent: #D97706;

  --paper: #FAF7F2;
  --surface: #FFFFFF;
  --surface-sunken: #F3EFE7;
  --border: #E7E1D6;
  --ink: #1F2420;
  --ink-soft: #5B655F;
  --ink-faint: #93998F;

  --red: #DC2626;
  --blue: #2563EB;
  --amber: #D97706;
  --green: #059669;
  --gray: #6B7280;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(31, 36, 32, 0.06);
  --shadow-md: 0 6px 20px rgba(31, 36, 32, 0.08);
  --shadow-lg: 0 16px 40px rgba(31, 36, 32, 0.14);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
::selection { background: var(--accent); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- App shell (dashboard layout) ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--secondary);
  color: #EAF4F2;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  flex-shrink: 0;
}
.brand-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: rgba(234,244,242,0.55); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section-label {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(234,244,242,0.4); margin: 16px 10px 6px; font-weight: 600;
}
.nav-section-label:first-child { margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: rgba(234,244,242,0.78);
  margin-bottom: 2px; transition: background 0.15s, color 0.15s;
}
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }

.sidebar-footer {
  padding: 14px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; font-family: var(--font-display);
}
.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(234,244,242,0.55); text-transform: capitalize; }
.logout-btn {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); color: #EAF4F2; font-size: 15px;
  transition: background 0.15s;
}
.logout-btn:hover { background: var(--red); }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink); }
.page-title { font-size: 19px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; font-family: var(--font-mono); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(5,150,105,0.5);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(5,150,105,0.45); }
  70% { box-shadow: 0 0 0 7px rgba(5,150,105,0); }
  100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); }
}

.content { padding: 26px 28px 60px; flex: 1; }

/* ---------------- Alerts / toasts ---------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 340px; background: var(--surface);
  border-left: 4px solid var(--primary); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 13px 16px;
  font-size: 13.5px; color: var(--ink);
  animation: toast-in 0.25s ease-out;
}
.toast.toast-ready { border-left-color: var(--green); }
.toast.toast-new { border-left-color: var(--red); }
.toast strong { display: block; margin-bottom: 2px; font-family: var(--font-display); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.toast.toast-out { animation: toast-out 0.25s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---------------- Cards / stats ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-top: 6px; color: var(--ink); }
.stat-sub { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; }

/* ---------------- Kanban / order board ---------------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; align-items: start; }
.board-col { background: var(--surface-sunken); border-radius: var(--radius-lg); padding: 14px; min-height: 200px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 14px; }
.board-col-title { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.board-col-count {
  background: var(--surface); border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 700; font-family: var(--font-mono);
}
.board-empty { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 30px 10px; }

.order-card {
  background: var(--surface); border-radius: var(--radius-md); padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--gray);
  transition: transform 0.15s, box-shadow 0.15s;
}
.order-card:hover { box-shadow: var(--shadow-md); }
.order-card.is-new { animation: card-pop 0.5s ease-out; }
@keyframes card-pop { 0% { transform: scale(0.94); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }

.order-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.order-table-num { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.order-time { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.order-items-list { list-style: none; margin: 10px 0; padding: 0; font-size: 13.5px; }
.order-items-list li { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink); }
.order-items-list .qty { color: var(--ink-soft); font-family: var(--font-mono); font-size: 12px; margin-right: 6px; }
.order-notes { font-size: 12.5px; color: var(--ink-soft); background: var(--surface-sunken); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-style: italic; }
.order-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: transform 0.1s, filter 0.15s; font-family: var(--font-body);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th { text-align: left; padding: 10px 12px; color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1.5px solid var(--border); }
table.data-table td { padding: 12px; border-bottom: 1px solid var(--border); }
table.data-table tr:last-child td { border-bottom: none; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: var(--font-body); background: var(--surface); color: var(--ink);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.form-hint { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.color-input-wrap { display: flex; align-items: center; gap: 10px; }
.color-swatch { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--border); flex-shrink: 0; padding: 0; cursor: pointer; }

/* ---------------- Placeholder pages ---------------- */
.placeholder-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 70px 20px; color: var(--ink-soft);
}
.placeholder-icon { font-size: 40px; margin-bottom: 14px; }
.placeholder-box h2 { font-size: 18px; margin-bottom: 8px; color: var(--ink); }
.placeholder-box p { max-width: 420px; font-size: 14px; line-height: 1.6; }
.placeholder-tag { display: inline-block; margin-top: 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-sunken); color: var(--ink-soft); padding: 4px 12px; border-radius: 20px; }

/* ---------------- Login page ---------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #E9F4F1 0%, var(--paper) 55%);
  padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 40px 36px; width: 100%; max-width: 380px; border: 1px solid var(--border);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-mark { margin: 0 auto 12px; width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
.login-brand h1 { font-size: 20px; font-weight: 700; }
.login-brand p { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.login-demo { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--ink-faint); line-height: 1.7; }
.login-demo code { background: var(--surface-sunken); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); }

/* ---------------- Customer ordering page ---------------- */
.customer-page { max-width: 640px; margin: 0 auto; padding-bottom: 120px; }
.customer-hero {
  background: var(--secondary); color: #EAF4F2; padding: 28px 22px 22px; border-radius: 0 0 26px 26px;
  position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow-md);
}
.customer-hero .table-tag { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(234,244,242,0.65); font-weight: 600; }
.customer-hero h1 { font-size: 22px; margin-top: 4px; }
.menu-section { padding: 22px; }
.menu-cat-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin: 22px 0 12px; padding-left: 2px; border-left: 4px solid var(--accent); padding-left: 10px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px;
}
.menu-item-info { flex: 1; min-width: 0; }
.menu-item-name { font-weight: 600; font-size: 14.5px; }
.menu-item-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.menu-item-price { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; color: var(--primary); margin-top: 6px; }
.qty-stepper { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface);
  font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-val { font-family: var(--font-mono); font-weight: 700; min-width: 16px; text-align: center; }

.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
  border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0,0,0,0.08);
  padding: 14px 20px; z-index: 50; display: flex; align-items: center; gap: 14px;
}
.cart-bar-info { flex: 1; }
.cart-bar-count { font-size: 12px; color: var(--ink-soft); }
.cart-bar-total { font-family: var(--font-display); font-weight: 700; font-size: 18px; }

.notes-box { margin: 0 22px 10px; }

.order-success {
  text-align: center; padding: 60px 24px; max-width: 480px; margin: 0 auto;
}
.order-success .check-circle {
  width: 78px; height: 78px; border-radius: 50%; background: #ECFDF5; color: var(--green);
  display: flex; align-items: center; justify-content: center; font-size: 38px; margin: 0 auto 20px;
}
.status-tracker { display: flex; justify-content: space-between; margin: 34px 0 10px; position: relative; }
.status-tracker::before { content:''; position: absolute; top: 14px; left: 20px; right: 20px; height: 2px; background: var(--border); z-index: 0; }
.status-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.status-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-faint); font-weight: 700; }
.status-step.done .status-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.status-step.active .status-dot { background: var(--accent); border-color: var(--accent); color: #fff; animation: pulse-dot 1.5s infinite; }
.status-step-label { font-size: 10.5px; color: var(--ink-soft); text-align: center; font-weight: 600; }

/* ---------------- Responsive ---------------- */
@media (max-width: 880px) {
  .sidebar { position: fixed; left: -260px; transition: left 0.2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .sidebar-toggle { display: block; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 14px 16px; }
}
