@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;600;700;800;900&display=swap');

:root {
  --slice-red: #EE032B;
  --slice-red-dark: #B8001F;
  --slice-red-soft: rgba(238, 3, 43, 0.15);
  --bg: #0A0A0A;
  --bg-elev: #121212;
  --surface: #181818;
  --surface-2: #222222;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #FFFFFF;
  --text-muted: #A1A1A1;
  --text-faint: #666666;
  --emerald: #10B981;
  --gold: #F59E0B;
  --rust: #EF4444;
  --info: #3B82F6;
  --violet: #8B5CF6;
  --cyan: #06B6D4;
  --font-ui: 'Raleway', sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* --- Utilities --- */
.flex { display: flex; align-items: center; }
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }
.demo-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- Status Dots & Badges --- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.pending { background: var(--gold); }
.status-dot.preparing { background: #3B82F6; }
.status-dot.out_for_delivery { background: #8B5CF6; }
.status-dot.delivered { background: var(--emerald); }
.status-dot.cancelled { background: var(--rust); }

.badge-status {
  padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--border);
}
.badge-status.pending { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.badge-status.preparing { color: var(--info); background: color-mix(in srgb, var(--info) 15%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.badge-status.ready { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 15%, transparent); border-color: color-mix(in srgb, var(--cyan) 30%, transparent); }
.badge-status.out_for_delivery { color: var(--violet); background: color-mix(in srgb, var(--violet) 15%, transparent); border-color: color-mix(in srgb, var(--violet) 30%, transparent); }
.badge-status.delivered { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); border-color: color-mix(in srgb, var(--emerald) 30%, transparent); }
.badge-status.cancelled { color: var(--rust); background: color-mix(in srgb, var(--rust) 15%, transparent); border-color: color-mix(in srgb, var(--rust) 30%, transparent); }
.badge-status.confirmed { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); border-color: color-mix(in srgb, var(--emerald) 30%, transparent); }
.badge-status.available { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); border-color: color-mix(in srgb, var(--emerald) 30%, transparent); }
.badge-status.busy { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }

/* --- Buttons --- */
.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}
.btn-primary { background: var(--slice-red); color: #fff; }
.btn-primary:hover { background: var(--slice-red-dark); transform: translateY(-2px); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--slice-red); }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.btn-danger-solid { background: var(--rust); color: #fff; border: none; }
.btn-danger-solid:hover { background: #d63c3c; transform: translateY(-2px); }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--text-muted); }
.form-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
}
.form-input:focus { outline: none; border-color: var(--slice-red); }

/* --- Cards & Layout --- */
.card-elev {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* --- Dashboard Shell --- */
.app-shell { display: flex; height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}
.sidebar .logo { font-size: 1.4rem; font-weight: 900; margin-bottom: 2rem; display: flex; align-items: center; gap: 0.5rem; }
.sidebar .logo img { height: 28px; }
.nav-link-app {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 0.3rem;
  transition: all 0.2s;
}
.nav-link-app:hover { background: var(--surface-2); color: var(--text); }
.nav-link-app.active { background: var(--slice-red-soft); color: var(--slice-red); }

.main-col { flex: 1; overflow-y: auto; }
.topbar {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
  flex-shrink: 0;
}

/* --- Metrics --- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.2rem; }
.metric-card h3 { font-size: 1.8rem; margin: 0 0 0.2rem 0; color: var(--slice-red); }
.metric-card p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

/* --- Tables --- */
.table-app { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table-app th { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.table-app td { padding: 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.table-app tr:hover { background: var(--surface-2); }

/* --- Menu Grid --- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }
.menu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; transition: 0.2s; }
.menu-card:hover { transform: translateY(-4px); border-color: var(--slice-red); }
.menu-img { height: 140px; background: #222; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.menu-img img { width: 100%; height: 100%; object-fit: cover; }
.menu-body { padding: 1rem; }
.menu-body h4 { margin: 0 0 0.3rem 0; font-size: 1rem; }
.menu-body p { margin: 0 0 0.6rem 0; color: var(--text-muted); font-weight: 600; }

/* --- Modals --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 900; display: none; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; max-width: 500px; width: 100%; position: relative; }
.modal-box .close { position: absolute; top: 1rem; right: 1rem; cursor: pointer; color: var(--text-muted); font-size: 1.5rem; }
.modal-box h3 { margin-bottom: 1rem; }

/* --- Toast --- */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 2000; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.5rem; margin-top: 0.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.5); display: flex; align-items: center; gap: 0.5rem; color: var(--text); animation: slideUp 0.3s ease; }
.toast.success { border-left: 4px solid var(--emerald); }
.toast.error { border-left: 4px solid var(--rust); }
.toast.info { border-left: 4px solid var(--info); }
.toast-container { z-index: 3200; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- Checkout Specifics --- */
.tip-preset { padding: 0.2rem 0.8rem; }
.tip-preset.active { border-color: var(--slice-red); color: var(--slice-red); background: var(--slice-red-soft); }
.form-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.form-switch input { opacity: 0; width: 0; height: 0; }
.form-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--surface-2); transition: .4s; border-radius: 24px; }
.form-switch .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: var(--text-muted); transition: .4s; border-radius: 50%; }
.form-switch input:checked + .slider { background-color: var(--slice-red); }
.form-switch input:checked + .slider:before { transform: translateX(20px); background-color: white; }
.form-check-label { margin-left: 0.5rem; cursor: pointer; font-size: 0.85rem; color: var(--text-muted); }

/* --- Tracking Timeline --- */
.timeline-step { display: flex; align-items: center; gap: 1rem; padding: 0.5rem 0; }

/* --- Footer --- */
.footer-slice {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 1.5rem;
  margin-top: 3rem;
}
.footer-slice .container { max-width: 1200px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2rem; }
.footer-grid h5 { margin-bottom: 1rem; color: var(--text); font-weight: 700; }
.footer-grid p, .footer-grid a { font-size: 0.85rem; color: var(--text-muted); text-decoration: none; display: block; margin-bottom: 0.5rem; }
.footer-grid a:hover { color: var(--slice-red); }
.footer-bottom { text-align: center; border-top: 1px solid var(--border); padding-top: 1.2rem; margin-top: 2rem; color: var(--text-muted); font-size: 0.8rem; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-shell { flex-direction: column; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
/* --- Topbar enhancements --- */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem;
}
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.breadcrumb span {
    color: var(--text);
    font-weight: 600;
}

/* --- NEMESIS Enterprise Footer (Admin Panel) --- */
.footer-nemesis {
    padding: 0.8rem 0;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 0.8rem;
}
.footer-nemesis-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}
.footer-nemesis-left, .footer-nemesis-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.footer-nemesis-sep {
    color: var(--border);
}
@media (max-width: 768px) {
    .footer-nemesis-content {
        flex-direction: column;
        text-align: center;
    }
    .footer-nemesis-left, .footer-nemesis-right {
        justify-content: center;
    }
}

/* ============================================================
   Sales & Reports — KPI deltas, period tabs, charts, print
   ============================================================ */
.delta {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.delta-up { color: var(--emerald); background: rgba(16,185,129,0.15); }
.delta-down { color: var(--rust); background: rgba(239,68,68,0.15); }

.period-tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.period-btn {
  border: none; background: transparent; color: var(--text-muted);
  font-family: var(--font-ui); font-weight: 700; font-size: 0.8rem;
  padding: 0.35rem 0.85rem; border-radius: 999px; cursor: pointer; transition: 0.15s;
}
.period-btn:hover { color: var(--text); }
.period-btn.active { background: var(--slice-red); color: #fff; }

.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }

@media (max-width: 900px) {
  .report-grid { grid-template-columns: 1fr !important; }
}

/* Print / PDF: show only the report content, cleanly */
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .footer-slice, .demo-badge, .no-print, .toast-container, #modalOverlay { display: none !important; }
  .app-shell, .main-col { display: block !important; height: auto !important; overflow: visible !important; }
  #pageContent { padding: 0 !important; }
  .card-elev { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; page-break-inside: avoid; }
  .metric-card { border: 1px solid #ddd !important; }
  .metric-card h3, .report-header h2 { color: #000 !important; }
  .metric-card p, .report-meta, .text-muted { color: #444 !important; }
  .report-grid { display: grid !important; }
}

/* ============================================================
   Menu image emoji fallback (shows when the photo fails to load)
   ============================================================ */
.menu-img { position: relative; }
.menu-img::after {
  content: attr(data-emoji);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; z-index: 0;
}
.menu-img img { position: relative; z-index: 1; }

/* ============================================================
   Customer cart button + slide-out drawer
   ============================================================ */
.cart-toggle {
  position: relative; display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--slice-red); color: #fff; border: none; cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.85rem;
  padding: 0.45rem 0.9rem; border-radius: var(--radius-sm); transition: 0.2s;
}
.cart-toggle:hover { background: var(--slice-red-dark); }
.cart-toggle .cart-badge {
  background: #fff; color: var(--slice-red); font-size: 0.7rem; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}

.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1400;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.cart-overlay.active { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; z-index: 1450;
  background: var(--bg-elev); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0,0,0,0.5); transform: translateX(100%);
  transition: transform 0.28s ease; display: flex; flex-direction: column;
}
.cart-drawer.active { transform: translateX(0); }
.cart-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem; border-bottom: 1px solid var(--border); }
.cart-drawer-head h3 { margin: 0; }
.cart-drawer-close { background: none; border: none; color: var(--text-muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.cart-lines { flex: 1; overflow-y: auto; padding: 0.5rem 1.2rem; }
.cart-line { display: flex; gap: 0.7rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.cart-line-emoji { font-size: 1.6rem; width: 34px; text-align: center; flex-shrink: 0; }
.cart-line-main { flex: 1; min-width: 0; }
.cart-line-name { font-weight: 700; font-size: 0.9rem; }
.cart-line-notes { color: var(--text-faint); font-size: 0.72rem; font-style: italic; }
.cart-line-price { color: var(--slice-red); font-weight: 700; font-size: 0.85rem; margin-top: 0.15rem; }
.cart-qty { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.35rem; }
.cart-qty button { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 0.9rem; line-height: 1; }
.cart-qty span { min-width: 18px; text-align: center; font-weight: 700; font-size: 0.8rem; }
.cart-line-remove { background: none; border: none; color: var(--rust); cursor: pointer; font-size: 0.75rem; align-self: flex-start; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }
.cart-empty .big { font-size: 2.6rem; display: block; margin-bottom: 0.5rem; }
.cart-foot { padding: 1.2rem; border-top: 1px solid var(--border); background: var(--surface); }
.cart-row { display: flex; justify-content: space-between; padding: 0.2rem 0; color: var(--text-muted); font-size: 0.9rem; }
.cart-row.grand { color: var(--text); font-weight: 800; font-size: 1.15rem; padding-top: 0.5rem; margin-top: 0.4rem; border-top: 1px solid var(--border); }
.cart-row.grand span:last-child { color: var(--slice-red); }
.cart-hint { font-size: 0.72rem; color: var(--gold); text-align: center; margin-bottom: 0.4rem; }

@media (max-width: 480px) { .cart-drawer { width: 100%; } }

/* ============================================================
   Toggle switch (e.g. "Schedule for later")
   ============================================================ */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; transition: 0.2s; }
.switch .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background: var(--slice-red); border-color: var(--slice-red); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; gap: 0.6rem; }

/* ============================================================
   Shared UI kit — branded modal dialogs (confirm / alert / prompt)
   ============================================================ */
.ui-modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.ui-modal-overlay.active { display: flex; animation: uiFade 0.15s ease; }
@keyframes uiFade { from { opacity: 0; } to { opacity: 1; } }
.ui-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55); animation: uiPop 0.18s ease;
}
@keyframes uiPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ui-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem 0.6rem; }
.ui-modal-head h3 { margin: 0; font-size: 1.15rem; }
.ui-modal-x { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.ui-modal-x:hover { color: var(--text); }
.ui-modal-body { padding: 0.4rem 1.3rem 0.6rem; color: var(--text-muted); line-height: 1.6; }
.ui-modal-body .form-group:last-child { margin-bottom: 0.3rem; }
.ui-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.8rem 1.3rem 1.2rem; }