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

:root {
  --bg-primary: #0D0D0D;
  --bg-secondary: #161616;
  --bg-card: #1E1E1E;
  --bg-elevated: #252525;
  --accent: #E8C44A;
  --accent-dim: #B8962A;
  --text-primary: #F0F0F0;
  --text-secondary: #9A9A9A;
  --text-muted: #555;
  --border: #2A2A2A;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font-ui: 'Exo 2', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

[data-theme="light"] {
  --bg-primary: #F5F5F0;
  --bg-secondary: #EBEBEB;
  --bg-card: #FFFFFF;
  --bg-elevated: #F0EFE8;
  --accent: #C9960A;
  --accent-dim: #A07808;
  --text-primary: #1A1A1A;
  --text-secondary: #555;
  --text-muted: #999;
  --border: #DEDEDE;
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Top Bar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
[data-theme="light"] .topbar { background: rgba(245,245,240,0.9); }

.topbar-brand { font-weight: 700; font-size: 1.1rem; color: var(--accent); letter-spacing: 1px; }
.topbar-info { font-size: 0.75rem; color: var(--text-secondary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 1.2rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.2s;
}
.btn-icon:hover { background: var(--bg-elevated); }

/* ── Cart Badge ── */
.cart-btn { position: relative; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--accent); color: #0D0D0D;
  font-size: 0.65rem; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}

/* ── Category Tabs ── */
.category-tabs {
  display: flex; gap: 8px;
  overflow-x: auto; padding: 12px 16px;
  scrollbar-width: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 56px; z-index: 90;
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.cat-pill.active, .cat-pill:hover {
  background: var(--accent); color: #0D0D0D;
  border-color: var(--accent);
}

/* ── Menu Grid ── */
.menu-section { padding: 16px; }
.section-title {
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 12px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Menu Card ── */
.menu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
}
.menu-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.menu-card.unavailable { opacity: 0.5; pointer-events: none; }

.card-img {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 10px; }
.card-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.card-desc { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4; }
.card-price { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); font-weight: 700; }

.card-footer { padding: 0 10px 10px; display: flex; align-items: center; justify-content: space-between; }

.badge-time {
  font-size: 0.65rem; background: var(--warning);
  color: #000; padding: 2px 6px; border-radius: 4px; font-weight: 600;
}

/* ── Qty Control ── */
.qty-control {
  display: flex; align-items: center; gap: 8px;
}
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--accent); background: transparent;
  color: var(--accent); font-size: 1rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qty-btn:hover { background: var(--accent); color: #0D0D0D; }
.qty-num { font-family: var(--font-mono); font-size: 0.9rem; min-width: 20px; text-align: center; }

.btn-add {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #0D0D0D;
  border: none; font-size: 1.2rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.btn-add:hover { transform: scale(1.1); background: var(--accent-dim); }

/* ── Floating Cart ── */
.cart-float {
  position: fixed; bottom: 24px; right: 20px; z-index: 200;
  background: var(--accent); color: #0D0D0D;
  border: none; border-radius: 28px;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.9rem;
  box-shadow: 0 8px 32px rgba(232,196,74,0.4);
  cursor: pointer; transition: transform 0.2s;
}
.cart-float:hover { transform: scale(1.03); }
.cart-float.hidden { display: none; }
.cart-float-total { font-family: var(--font-mono); }

/* ── Bottom Sheet ── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: all; }

.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 301;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--border);
  max-height: 85vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 0;
}
.sheet-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sheet-title { font-size: 1rem; font-weight: 700; }
.sheet-body { padding: 16px 20px; }
.sheet-footer { padding: 16px 20px; border-top: 1px solid var(--border); }

/* ── Cart Items ── */
.cart-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 0.9rem; font-weight: 600; }
.cart-item-price { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.cart-item-note { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #0D0D0D; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-ghost { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-ghost:hover { background: var(--accent); color: #0D0D0D; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font-ui); font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Cards (generic) ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

/* ── Payment Method Selector ── */
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-method {
  padding: 16px; border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer; text-align: center;
  transition: all 0.2s;
}
.pay-method:hover, .pay-method.selected {
  border-color: var(--accent); background: rgba(232,196,74,0.08);
}
.pay-method-icon { font-size: 1.8rem; margin-bottom: 6px; }
.pay-method-label { font-size: 0.8rem; font-weight: 600; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px; text-align: center;
  cursor: pointer; transition: border-color 0.2s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); }
.upload-zone input[type=file] { display: none; }
.upload-preview { max-width: 100%; border-radius: var(--radius-sm); margin-top: 12px; }

/* ── Status Badge ── */
.status-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.status-pending   { background: rgba(255,152,0,0.15); color: var(--warning); }
.status-confirmed { background: rgba(33,150,243,0.15); color: #2196F3; }
.status-preparing { background: rgba(156,39,176,0.15); color: #9C27B0; }
.status-ready     { background: rgba(76,175,80,0.15); color: var(--success); }
.status-served    { background: rgba(76,175,80,0.1); color: var(--success); }
.status-cancelled { background: rgba(244,67,54,0.15); color: var(--danger); }
.status-verified  { background: rgba(76,175,80,0.15); color: var(--success); }
.status-uploaded  { background: rgba(255,152,0,0.15); color: var(--warning); }
.status-rejected  { background: rgba(244,67,54,0.15); color: var(--danger); }

/* ── Admin Layout ── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: transform 0.3s;
}
.sidebar-logo {
  padding: 20px 16px;
  font-size: 1.2rem; font-weight: 700; color: var(--accent);
  border-bottom: 1px solid var(--border);
  letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  color: var(--text-primary); background: var(--bg-elevated);
  border-left-color: var(--accent);
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-section { padding: 8px 16px 4px; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; }

.admin-main {
  margin-left: 220px; flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}
.admin-topbar {
  height: 56px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 40;
}
.admin-content { padding: 24px; flex: 1; }
.page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.stat-value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-icon { font-size: 1.5rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-elevated); }

/* ── Toggle Switch ── */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border); border-radius: 22px; transition: 0.3s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Order Kanban ── */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col {
  flex-shrink: 0; width: 260px;
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.kanban-col-header {
  padding: 12px 16px; font-size: 0.8rem; font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 100px; }
.order-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  cursor: pointer; transition: border-color 0.2s;
}
.order-card:hover { border-color: var(--accent); }
.order-card-id { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.order-card-table { font-weight: 700; font-size: 0.9rem; }
.order-card-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.order-card-total { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); margin-top: 6px; }

/* ── Addon Checkboxes ── */
.addon-list { display: flex; flex-direction: column; gap: 8px; }
.addon-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg-elevated);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  cursor: pointer; transition: border-color 0.2s;
}
.addon-item:hover { border-color: var(--accent); }
.addon-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.addon-name { font-size: 0.875rem; }
.addon-price { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast ── */
.toast-container { position: fixed; top: 70px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 0.875rem; min-width: 220px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }

/* ── Misc ── */
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile sidebar toggle ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
  .kanban { flex-direction: column; }
  .kanban-col { width: 100%; }
}

/* ── QR Print ── */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
}
