:root {
  --primary: #e0562f;
  --primary-dark: #b8401f;
  --dark: #1f2430;
  --grey: #6b7280;
  --light-grey: #f4f4f6;
  --border: #e5e5ea;
  --green: #1a9e5c;
  --blue: #2563eb;
  --orange: #d97706;
  --purple: #7c3aed;
  --red: #dc2626;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #fafafa;
  color: var(--dark);
}
a { color: var(--primary); text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Top bar (sticky so it stays visible while scrolling) */
.topbar {
  background: var(--dark);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 60;
}

/* Search bar (marketplace pages) */
.search-bar-wrap {
  position: sticky;
  top: 58px;
  z-index: 55;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.search-bar-wrap form { display: flex; gap: 8px; max-width: 600px; margin: 0 auto; }
.search-bar-wrap input[type="search"] {
  flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.95rem;
}
.search-bar-wrap button {
  background: var(--primary); color: #fff; border: none; padding: 0 20px; border-radius: 999px; cursor: pointer; font-weight: 600;
}

/* Category icon row, just under search */
.category-icon-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 16px 0 4px; max-width: 700px; margin: 0 auto;
}
.category-icon-row a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0;
  text-decoration: none; color: var(--dark); width: 72px; text-align: center;
}
.category-icon-row .icon-circle {
  width: 52px; height: 52px; border-radius: 50%; background: var(--light-grey);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.category-icon-row a:hover .icon-circle { background: #ffe6da; }
.category-icon-row span.label { font-size: 0.75rem; font-weight: 600; }

/* Address widget, sits above the sidebar */
.address-widget-wrap { padding: 12px 0; background: #fff8f5; border-bottom: 1px solid #ffe0d0; }
.address-widget {
  font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.address-widget a { font-weight: 600; flex-shrink: 0; }

/* Restaurant sidebar (logo + that restaurant's own categories) */
.restaurant-sidebar-header { text-align: center; padding: 8px 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.restaurant-sidebar-header img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); margin-bottom: 8px; }
.restaurant-sidebar-header h3 { margin: 0; font-size: 1rem; }

/* Item customize modal (flavours, servings, size options) */
.customize-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 420px; max-width: 92vw; max-height: 85vh; background: #fff; border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25); z-index: 110; display: none; flex-direction: column;
}
.customize-modal.open { display: flex; }
#customizeOverlay.open { z-index: 105; }
.customize-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.customize-body { padding: 16px; overflow-y: auto; flex: 1; }
.customize-group { margin-bottom: 16px; }
.customize-group h4 { margin: 0 0 8px; font-size: 0.95rem; }
.customize-group .req-tag { color: var(--red); font-size: 0.75rem; font-weight: 400; }
.customize-option { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 0.9rem; }
.customize-option label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.customize-footer { padding: 16px; border-top: 1px solid var(--border); }

/* Cart lines with customizations show a small options note under the item name */
.cart-item .options-note { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }

.marketplace-layout { display: flex; align-items: flex-start; gap: 0; }
.category-sidebar {
  width: 210px; flex-shrink: 0; position: sticky; top: 130px;
  max-height: calc(100vh - 130px); overflow-y: auto;
  padding: 20px 12px; border-right: 1px solid var(--border);
}
.category-sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--dark); text-decoration: none; font-size: 0.92rem; font-weight: 500;
}
.category-sidebar a:hover, .category-sidebar a.active { background: var(--light-grey); }
.category-sidebar a.hot-deals { color: var(--primary); font-weight: 700; }
.marketplace-content { flex: 1; min-width: 0; padding: 20px 16px; }

@media (max-width: 820px) {
  .category-sidebar { display: none; }
}

.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.topbar .brand { font-weight: 700; font-size: 1.2rem; color: #fff; }
.topbar .cart-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}

/* Menu */
html { scroll-behavior: smooth; }
.category-title { scroll-margin-top: 145px; margin: 28px 0 12px; font-size: 1.3rem; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.menu-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menu-card h3 { margin: 0; font-size: 1.05rem; }
.menu-card p { margin: 0; color: var(--grey); font-size: 0.9rem; flex-grow: 1; }
.menu-card .row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { font-weight: 700; }
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--light-grey); color: var(--dark); }
.btn.danger { background: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cart drawer */
.cart-drawer {
  position: fixed; top: 0; right: -420px; width: 380px; max-width: 92vw; height: 100vh;
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.15); transition: right 0.25s ease;
  z-index: 100; display: flex; flex-direction: column;
}
.cart-drawer.open { right: 0; }
.cart-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .qty-controls { display: flex; align-items: center; gap: 8px; }
.cart-item .qty-controls button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.cart-footer { padding: 16px; border-top: 1px solid var(--border); }
.cart-footer .total-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 99; display: none; }
.overlay.open { display: block; }

/* Forms */
.form-page { max-width: 560px; margin: 30px auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem;
}
.radio-row { display: flex; gap: 16px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; }
.alert-error { background: #fde8e8; color: var(--red); }
.alert-success { background: #e6f7ee; color: var(--green); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-grey { background: #e5e7eb; color: #374151; }
.badge-blue { background: #dbeafe; color: var(--blue); }
.badge-orange { background: #fef3c7; color: var(--orange); }
.badge-purple { background: #ede9fe; color: var(--purple); }
.badge-green { background: #d1fae5; color: var(--green); }
.badge-red { background: #fee2e2; color: var(--red); }

/* Admin layout */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--dark); color: #fff; flex-shrink: 0; }
.admin-sidebar .brand { padding: 18px 20px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); }
.admin-sidebar nav a { display: block; padding: 12px 20px; color: #d1d5db; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,0.08); color: #fff; }
.admin-main { flex: 1; padding: 24px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

table.data-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table.data-table th { background: var(--light-grey); font-weight: 700; }
table.data-table tr:last-child td { border-bottom: none; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 1.6rem; font-weight: 700; }
.stat-card .label { color: var(--grey); font-size: 0.85rem; }

#map { width: 100%; height: 320px; border-radius: var(--radius); border: 1px solid var(--border); }

.footer-note { text-align: center; color: var(--grey); font-size: 0.85rem; margin: 30px 0; }