/* ═══════════════════════════════════════════
   KEBAB HOUSE DASHBOARD — RESPONSIVE PWA CSS
   Mobile-first, 375px base → Desktop
   ═══════════════════════════════════════════ */

/* ── Reset & Variables ── */
:root {
  --bg-primary: #000000;
  --bg-card: #121212;
  --bg-surface: #0a0a0a;
  --accent-yellow: #FFFF00;
  --accent-orange: #FF6B00;
  --accent-gold: #FFD700;
  --accent-green: #4CAF50;
  --accent-red: #FF3B30;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --glass-border: rgba(255,255,255,0.08);
  --font: 'Poppins', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 50px;
  --shadow-glow: 0 4px 20px rgba(255,255,0,0.15);
  --sidebar-w: 240px;
  --bottomnav-h: 72px;
  --topbar-h: 60px;
  --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Layout Shell ── */
.dash-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Sidebar (Desktop) ── */
.dash-sidebar {
  display: none;
  width: var(--sidebar-w);
  background: #080808;
  border-right: 1px solid var(--glass-border);
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.dash-sidebar .brand { margin-bottom: 32px; }
.dash-sidebar .brand-icon { font-size: 28px; margin-bottom: 6px; display: block; }
.dash-sidebar .brand h1 { color: var(--accent-yellow); font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.dash-sidebar .brand p { color: var(--text-secondary); font-size: 11px; letter-spacing: 2px; }

.nav-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition);
  margin-bottom: 4px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,0,0.08); color: var(--accent-yellow); }
.nav-item.active { font-weight: 700; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--glass-border); }
.sidebar-footer p { color: var(--text-secondary); font-size: 11px; }

/* ── Main Content Area ── */
.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Top Bar ── */
.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 16px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-title { font-size: 18px; font-weight: 800; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--glass-border);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Toggle Switch */
.toggle-sw { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.toggle-sw input { opacity: 0; width: 0; height: 0; }
.toggle-sw .slider { position: absolute; cursor: pointer; inset: 0; background: #333; border-radius: 22px; transition: var(--transition); }
.toggle-sw .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.toggle-sw input:checked + .slider { background: var(--accent-yellow); }
.toggle-sw input:checked + .slider::before { transform: translateX(20px); background: #000; }

/* ── Content Panel ── */
.dash-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--bottomnav-h) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom Navigation (Mobile) ── */
.dash-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--bottomnav-h);
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: stretch;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
  border: none;
  background: none;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item i { font-size: 20px; transition: transform var(--transition); }
.bnav-item.active { color: var(--accent-yellow); }
.bnav-item.active i { transform: scale(1.15); }
.bnav-item:active i { transform: scale(0.9); }

/* ── Stat Cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #141414, #0c0c0c);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.stat-card .label { color: var(--text-secondary); font-size: 11px; margin-bottom: 4px; font-weight: 500; }
.stat-card .value { font-size: 22px; font-weight: 800; }

/* ── Order Cards Grid ── */
.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.order-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}
.order-card.new-order { border-color: var(--accent-yellow); animation: cardPing 2s infinite; }

@keyframes cardPing {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,0,0.35); }
  70%  { box-shadow: 0 0 0 8px rgba(255,255,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,0,0); }
}

.order-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; margin-bottom: 12px; }
.order-id { font-size: 17px; font-weight: 700; color: var(--accent-yellow); }
.order-time { font-size: 13px; color: var(--text-secondary); }
.order-item { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }

.status-btn {
  background: var(--accent-yellow);
  color: #000;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
.status-btn:active { transform: scale(0.97); }
.status-btn.preparing { background: var(--accent-orange); }

/* ── Glass Panel ── */
.g-panel {
  background: rgba(18,18,18,0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* ── Utility ── */
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-gradient { background: linear-gradient(45deg, var(--accent-yellow), var(--accent-orange)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hidden { display: none !important; }

/* Toggle (settings) */
.toggle-switch { position: relative; display: inline-block; width: 56px; height: 30px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #333; border-radius: 30px; transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 22px; height: 22px; left: 4px; bottom: 4px; background: #fff; border-radius: 50%; transition: var(--transition); }
input:checked + .toggle-slider { background: var(--accent-yellow); }
input:checked + .toggle-slider::before { transform: translateX(26px); }

/* Menu manager toggles */
.toggle-sm { position: relative; display: inline-block; width: 40px; height: 20px; }
.toggle-sm input { display: none; }
.slider-sm { position: absolute; cursor: pointer; inset: 0; background: #333; transition: .4s; border-radius: 20px; }
.slider-sm::before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background: white; transition: .4s; border-radius: 50%; }
.toggle-sm input:checked + .slider-sm { background: var(--accent-green); }
.toggle-sm input:checked + .slider-sm::before { transform: translateX(20px); }

/* Menu item cards */
.menu-item-card { background: #111; border: 1px solid var(--glass-border); border-radius: var(--radius-md); overflow: hidden; display: flex; flex-direction: column; transition: transform var(--transition); }
.menu-item-card:hover { border-color: rgba(255,255,0,0.3); }
.menu-item-img { height: 140px; background-size: cover; background-position: center; background-color: #222; position: relative; }
.menu-item-content { padding: 14px; flex: 1; display: flex; flex-direction: column; }

.badge-stock { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.badge-stock.out { background: rgba(255,59,48,0.8); }

/* Category items (sidebar) */
.cat-item { padding: 11px 14px; cursor: pointer; border-radius: var(--radius-sm); margin-bottom: 3px; transition: all var(--transition); display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.cat-item:hover { background: rgba(255,255,255,0.04); }
.cat-item.active { background: rgba(255,255,0,0.08); color: var(--accent-yellow); font-weight: 600; }

/* ── Install Banner ── */
.install-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px);
  left: 12px; right: 12px;
  z-index: 200;
  background: linear-gradient(135deg, #1a1a00, #111);
  border: 1px solid rgba(255,255,0,0.25);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  animation: slideUp 0.4s ease;
}
.install-banner .ib-icon { font-size: 32px; flex-shrink: 0; }
.install-banner .ib-text h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.install-banner .ib-text p { font-size: 12px; color: var(--text-secondary); }
.install-banner .ib-btn { background: var(--accent-yellow); color: #000; border: none; padding: 10px 18px; border-radius: var(--radius-pill); font-weight: 700; font-size: 13px; cursor: pointer; flex-shrink: 0; font-family: var(--font); }
.install-banner .ib-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 16px; padding: 4px; position: absolute; top: 10px; right: 12px; }

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ── History Bulk Actions ── */
.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-bar .cb-all { width: 20px; height: 20px; accent-color: var(--accent-yellow); cursor: pointer; }
.bulk-bar .bulk-label { font-size: 13px; color: var(--text-secondary); flex: 1; }
.bulk-bar .bulk-del-btn {
  background: rgba(255,59,48,0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255,59,48,0.2);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}
.bulk-bar .bulk-del-btn:hover { background: rgba(255,59,48,0.25); }
.bulk-bar .bulk-del-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.order-card .card-cb { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; accent-color: var(--accent-yellow); cursor: pointer; z-index: 5; }

/* ── Header Manager ── */
.header-upload-zone { position: relative; border: 2px dashed rgba(255,255,255,0.12); border-radius: var(--radius-lg); padding: 36px 20px; text-align: center; cursor: pointer; transition: all 0.3s; background: rgba(18,18,18,0.5); }
.header-upload-zone:hover, .header-upload-zone.drag-over { border-color: var(--accent-yellow); background: rgba(255,215,0,0.03); }
.header-upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.header-upload-zone .upload-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.header-upload-zone .upload-title { font-size: 15px; font-weight: 600; }
.header-upload-zone .upload-subtitle { font-size: 12px; color: var(--text-secondary); }

.header-upload-progress { display: none; margin-top: 12px; }
.progress-bar-track { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-yellow), var(--accent-orange)); border-radius: 4px; transition: width 0.3s; width: 0; }
.progress-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; text-align: center; }

.header-cards-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 16px; }
.header-version-card { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: var(--radius-md); overflow: hidden; transition: all 0.3s; }
.header-version-card.is-active { border-color: rgba(76,175,80,0.4); }
.header-version-card .card-thumbnail { position: relative; width: 100%; height: 140px; overflow: hidden; background: #0a0a0a; }
.header-version-card .card-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.header-version-card .card-body { padding: 14px; }
.header-version-card .card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.header-version-card .thumbnail-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%); display: flex; align-items: flex-end; padding: 10px; opacity: 0; transition: opacity 0.3s; }
.header-version-card:hover .thumbnail-overlay { opacity: 1; }

.header-status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.status-active { background: rgba(76,175,80,0.12); color: var(--accent-green); }
.status-active::before { content: ''; width: 5px; height: 5px; background: var(--accent-green); border-radius: 50%; animation: statusPulse 2s infinite; }
.status-scheduled { background: rgba(33,150,243,0.12); color: #2196F3; }
.status-expired { background: rgba(255,59,48,0.08); color: var(--accent-red); }
.status-draft { background: rgba(255,255,255,0.04); color: var(--text-secondary); }

@keyframes statusPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.header-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.header-card-actions button { flex: 1; padding: 9px 6px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-weight: 600; font-size: 11px; font-family: var(--font); transition: all var(--transition); display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; }
.btn-go-live { background: linear-gradient(135deg, #4CAF50, #2E7D32); color: #fff; }
.btn-schedule { background: rgba(33,150,243,0.1); color: #2196F3; border: 1px solid rgba(33,150,243,0.2) !important; }
.btn-preview { background: rgba(255,215,0,0.08); color: var(--accent-gold); border: 1px solid rgba(255,215,0,0.15) !important; }
.btn-deactivate { background: rgba(255,59,48,0.08); color: var(--accent-red); border: 1px solid rgba(255,59,48,0.15) !important; }
.btn-delete { background: rgba(255,255,255,0.03); color: var(--text-secondary); border: 1px solid rgba(255,255,255,0.06) !important; flex: 0; padding: 9px 12px !important; }

/* Schedule Modal */
.schedule-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); padding: 16px; }
.schedule-modal { background: #111; border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 420px; }
.schedule-modal h3 { font-size: 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.schedule-modal label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.schedule-modal input[type="datetime-local"] { width: 100%; background: var(--bg-primary); border: 1px solid var(--glass-border); color: #fff; padding: 12px; border-radius: var(--radius-sm); font-family: var(--font); font-size: 14px; outline: none; margin-bottom: 16px; }
.schedule-modal input:focus { border-color: var(--accent-yellow); }
.schedule-modal input::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.schedule-modal .modal-actions { display: flex; gap: 10px; }
.schedule-modal .modal-actions button { flex: 1; padding: 12px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; cursor: pointer; font-family: var(--font); border: none; }

/* Mobile Preview */
.mobile-preview-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); padding: 16px; }
.mobile-preview-frame { width: 340px; max-width: 90vw; height: 620px; max-height: 85vh; background: #000; border-radius: 36px; border: 3px solid #333; overflow: hidden; position: relative; }
.mobile-preview-frame::before { content: ''; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 100px; height: 24px; background: #1a1a1a; border-radius: 16px; z-index: 10; }
.mobile-preview-content { height: 100%; overflow-y: auto; padding-top: 44px; }
.mobile-preview-content img { width: 100%; display: block; }
.mobile-preview-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); color: #fff; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; z-index: 210; }

/* ══════════════════════════════════════
   DESKTOP BREAKPOINT (768px+)
   ══════════════════════════════════════ */
@media (min-width: 768px) {
  .dash-sidebar { display: flex; }
  .dash-main { margin-left: var(--sidebar-w); }
  .dash-bottomnav { display: none; }
  .dash-content { padding: 24px 28px; padding-bottom: 40px; }
  .topbar-title { font-size: 22px; }

  .orders-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
  .stat-card .value { font-size: 28px; }
  .stats-row { gap: 16px; }

  .header-cards-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .header-version-card .card-thumbnail { height: 160px; }

  .install-banner { left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: 24px; }
}

@media (min-width: 1100px) {
  .orders-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
