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

:root {
  --sidebar-w: 240px;
  --bg: #f0f4f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #eef2ff;
  --sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(99,102,241,.18);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

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

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ─── Layout ──────────────────────────────────────────────── */

.layout {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ─── Sidebar ────────────────────────────────────────────── */

.sidebar-logo {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo .logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: -.2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}

.sidebar-nav a svg { flex-shrink: 0; }

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #cbd5e1;
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #a5b4fc;
}

.sidebar-nav a.active svg { color: #a5b4fc; }

.sidebar-section {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 16px 10px 6px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-restaurant {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.sidebar-email {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  width: 100%;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}

.btn-logout:hover { background: rgba(255,255,255,.06); color: #cbd5e1; }

/* ─── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 20px; }

/* ─── Stats grid ─────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }

.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ─── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.btn-secondary {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 5px; }

/* ─── Tables ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
}

.td-muted { color: var(--text-3); font-size: 12.5px; }

/* ─── Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-new     { background: #e0f2fe; color: #0369a1; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-muted   { background: var(--bg); color: var(--text-3); }

/* ─── Forms ──────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=time],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  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(99,102,241,.12);
}

textarea { resize: vertical; min-height: 80px; }

.input-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}

.input-error {
  font-size: 11.5px;
  color: var(--danger);
  margin-top: 4px;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 100px;
  cursor: pointer;
  transition: .2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ─── Category tabs ──────────────────────────────────────── */

.tab-list {
  display: flex;
  gap: 4px;
  padding: 0;
  list-style: none;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-item a {
  display: block;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
  white-space: nowrap;
}

.tab-item a:hover { color: var(--text); }
.tab-item.active a { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Opening hours table ────────────────────────────────── */

.hours-table { width: 100%; }
.hours-row {
  display: grid;
  grid-template-columns: 110px 60px 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.hours-row:last-child { border-bottom: none; }

.hours-day { font-weight: 500; font-size: 13.5px; }

.hours-row input[type=time] { padding: 7px 10px; }

/* ─── Modal ──────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--card);
  border-radius: 12px;
  width: 480px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  transform: translateY(12px);
  transition: transform .2s;
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 18px; line-height: 1;
  padding: 2px 6px;
  border-radius: 5px;
  transition: background .15s;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Toast ──────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .2s, transform .2s;
  max-width: 320px;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ─── Empty state ────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state svg { margin: 0 auto 12px; display: block; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ─── Login page ─────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
}

.login-box {
  background: var(--card);
  border-radius: 14px;
  width: 400px;
  max-width: 95vw;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.login-header {
  padding: 28px 28px 0;
  text-align: center;
}

.login-logo {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff;
  margin: 0 auto 14px;
}

.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--text-2); margin-bottom: 24px; }

.login-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s;
  margin-bottom: -1px;
}

.login-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.login-body { padding: 24px 28px 28px; }

.login-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* ─── Product grid ───────────────────────────────────────── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 14px;
  background: var(--card);
  transition: box-shadow .15s;
  position: relative;
}

.product-card:hover { box-shadow: var(--shadow-md); }

.product-card.inactive { opacity: .55; }

.product-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.product-sku  { font-size: 11px; color: var(--text-3); margin-bottom: 8px; font-family: monospace; }
.product-price { font-weight: 700; font-size: 16px; color: var(--accent); }

.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

/* ─── Filter bar ─────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  transition: background .15s, color .15s;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Misc utils ─────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-3); }
.font-mono { font-family: monospace; }
.w-full { width: 100%; }

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform .25s;
  }
  #sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }

  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .mobile-menu-btn {
    display: flex !important;
  }

  .hours-row {
    grid-template-columns: 90px 50px 1fr;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: 6px;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

.mobile-overlay.open { display: block; }
