/* ============================================================
   RestoBay Admin — Dark / Light Theme
   ============================================================ */

/* ── DARK (default) ─────────────────────────────────── */
:root {
  --bg:        #0b0d12;
  --surface:   #11141c;
  --surface2:  #181c27;
  --surface3:  #1e2330;
  --border:    #252a3a;
  --border2:   #2e3548;
  --accent:    #f97316;
  --accent-h:  #fb923c;
  --green:     #22c55e;
  --blue:      #3b82f6;
  --purple:    #a855f7;
  --yellow:    #eab308;
  --red:       #ef4444;
  --teal:      #14b8a6;
  --text:      #e2e6f0;
  --text2:     #8892a8;
  --text3:     #4a5168;
  --shadow:    0 4px 20px rgba(0,0,0,.4);
  --sidebar:   220px;
  --topbar:    58px;
  --radius:    10px;
  --radius-sm: 6px;
  --font-d:    'Syne', sans-serif;
  --font-b:    'DM Sans', sans-serif;
  --font-m:    'DM Sans', sans-serif;
  /* theme toggle icon */
  --theme-icon: '☀️';
}

/* ── LIGHT ───────────────────────────────────────────── */
html.light {
  --bg:        #f1f3f8;
  --surface:   #ffffff;
  --surface2:  #f5f6fa;
  --surface3:  #eceef5;
  --border:    #dde1ee;
  --border2:   #c8cfe0;
  --accent:    #ea6500;
  --accent-h:  #f97316;
  --green:     #16a34a;
  --blue:      #2563eb;
  --purple:    #7c3aed;
  --yellow:    #ca8a04;
  --red:       #dc2626;
  --teal:      #0d9488;
  --text:      #111827;
  --text2:     #4b5563;
  --text3:     #9ca3af;
  --shadow:    0 4px 20px rgba(0,0,0,.08);
  --theme-icon: '🌙';
}

/* ── SMOOTH TRANSITION ───────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color .2s, border-color .2s, color .15s;
}

/* Override: things that should NOT transition */
.flash, .modal, .nav-item, .floor-table, .kot-card,
.btn, table, tr, .stat-card { transition: none; }
/* Re-apply only color/bg transitions for these */
.nav-item        { transition: background .15s, color .15s; }
.floor-table     { transition: transform .2s, box-shadow .2s, border-color .15s, background .15s; }
.btn             { transition: background .15s, border-color .15s, color .15s; }

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── THEME TOGGLE BUTTON ─────────────────────────── */
.theme-toggle {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface3); border-color: var(--border2); }
/* Show correct icon per theme */
.theme-toggle .icon-dark  { display: block; }
.theme-toggle .icon-light { display: none;  }
html.light .theme-toggle .icon-dark  { display: none;  }
html.light .theme-toggle .icon-light { display: block; }

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto;
  transition: width .25s ease, background .2s, border-color .2s;
  position: relative; z-index: 100;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .logo-name,
.sidebar.collapsed .logo-tag,
.sidebar.collapsed .restaurant-pill,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .logout-btn span { display: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-flame { font-size: 22px; line-height: 1; }
.logo-name {
  font-family: var(--font-d);
  font-size: 17px; font-weight: 800; letter-spacing: -.5px; white-space: nowrap;
  color: var(--text);
}
.logo-tag {
  display: block;
  font-size: 9px; font-family: var(--font-m);
  color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px;
}
.sidebar-toggle {
  background: none; border: none; color: var(--text2);
  cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 4px; flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: var(--surface2); }

.restaurant-pill {
  margin: 10px 12px 4px;
  display: flex; align-items: center; gap: 7px;
  background: rgba(249,115,22,.08);
  border: 1px solid rgba(249,115,22,.18);
  padding: 6px 10px; border-radius: var(--radius-sm);
}
html.light .restaurant-pill {
  background: rgba(234,100,0,.06);
  border-color: rgba(234,100,0,.15);
}
.rest-dot {
  width: 7px; height: 7px;
  background: var(--green); border-radius: 50%; flex-shrink: 0;
  animation: pulse 2s infinite;
}
.rest-name { font-size: 12px; font-weight: 500; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.nav-menu { flex: 1; padding: 8px 8px 0; overflow-y: auto; }
.nav-section-label {
  display: block;
  font-size: 9.5px; font-family: var(--font-m);
  color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 8px 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; font-weight: 400;
  transition: background .15s, color .15s;
  position: relative; cursor: pointer; white-space: nowrap;
}
.nav-item i { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: rgba(249,115,22,.12);
  color: var(--accent); font-weight: 500;
}
html.light .nav-item.active { background: rgba(234,100,0,.1); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}

.sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.logout-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; background: none;
  color: var(--text2); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.logout-btn:hover { background: rgba(239,68,68,.1); color: var(--red); }
.logout-btn i { width: 16px; text-align: center; font-size: 13px; }

/* ── MAIN WRAP ───────────────────────────────────── */
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── TOPBAR ──────────────────────────────────────── */
.topbar {
  height: var(--topbar); min-height: var(--topbar);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.page-title { font-family: var(--font-d); font-size: 17px; font-weight: 700; color: var(--text); }
.breadcrumb-nav { font-size: 12px; color: var(--text3); }
.breadcrumb-nav a { color: var(--text3); }
.breadcrumb-nav a:hover { color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; transition: all .15s;
}
.topbar-icon-btn:hover { background: var(--surface3); color: var(--text); }
.topbar-time { font-family: var(--font-m); font-size: 12px; color: var(--text3); }
.topbar-user {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px; font-size: 12px; color: var(--text2);
}
.user-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }

/* ── FLASH ───────────────────────────────────────── */
.flash-zone { padding: 0 24px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px;
  animation: fadeSlide .3s ease;
}
.flash-success { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2); color: var(--green); }
.flash-error   { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.2);  color: var(--red);   }
html.light .flash-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
html.light .flash-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
@keyframes fadeSlide { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }

/* ── PAGE CONTENT ────────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }

/* ── CARDS ───────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title  { font-family: var(--font-d); font-size: 14px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: var(--font-m); }

/* ── STAT CARDS ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-color, var(--accent));
}
.stat-card:hover { border-color: var(--border2); }
.stat-label {
  font-size: 11px; color: var(--text3); font-family: var(--font-m);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px;
}
.stat-value { font-family: var(--font-m); font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text3); margin-top: 5px; }
.stat-icon  { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 28px; opacity: .06; }
html.light .stat-icon { opacity: .07; }

/* ── TABLES ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2); padding: 10px 14px;
  font-size: 11px; font-family: var(--font-m); color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px;
  text-align: left; font-weight: 500; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td { padding: 11px 14px; color: var(--text); font-size: 13px; vertical-align: middle; }
td .text-muted { color: var(--text3); font-size: 12px; }

/* ── BADGES ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-family: var(--font-m); font-weight: 500; white-space: nowrap;
}
.badge-green  { background: rgba(34,197,94,.12);  color: var(--green);  border: 1px solid rgba(34,197,94,.25);  }
.badge-orange { background: rgba(249,115,22,.12); color: var(--accent); border: 1px solid rgba(249,115,22,.25); }
.badge-blue   { background: rgba(59,130,246,.12); color: var(--blue);   border: 1px solid rgba(59,130,246,.25); }
.badge-purple { background: rgba(168,85,247,.12); color: var(--purple); border: 1px solid rgba(168,85,247,.25); }
.badge-red    { background: rgba(239,68,68,.12);  color: var(--red);    border: 1px solid rgba(239,68,68,.25);  }
.badge-yellow { background: rgba(234,179,8,.12);  color: var(--yellow); border: 1px solid rgba(234,179,8,.25);  }
.badge-gray   { background: var(--surface2);      color: var(--text2);  border: 1px solid var(--border);        }

html.light .badge-green  { background: #f0fdf4; color: #15803d; border-color: #86efac; }
html.light .badge-blue   { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
html.light .badge-orange { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
html.light .badge-red    { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
html.light .badge-yellow { background: #fefce8; color: #a16207; border-color: #fde047; }
html.light .badge-purple { background: #faf5ff; color: #6d28d9; border-color: #d8b4fe; }
html.light .badge-gray   { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); color: #fff; }
.btn-outline {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); }
html.light .btn-outline { color: var(--text2); border-color: var(--border); }
html.light .btn-outline:hover { background: var(--surface3); color: var(--text); }
.btn-danger  { background: rgba(239,68,68,.1);  color: var(--red);   border-color: rgba(239,68,68,.3);  }
.btn-danger:hover  { background: rgba(239,68,68,.2);  }
.btn-success { background: rgba(34,197,94,.1);  color: var(--green); border-color: rgba(34,197,94,.3);  }
.btn-success:hover { background: rgba(34,197,94,.2);  }
html.light .btn-danger  { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
html.light .btn-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.btn-sm { padding: 4px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px;  font-size: 11px; border-radius: 5px; }

/* ── FORMS ───────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 11px; font-family: var(--font-m); color: var(--text2);
  text-transform: uppercase; letter-spacing: .5px;
}
.form-control {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 12px; transition: border-color .15s, background .15s;
  width: 100%; box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control option { background: var(--surface2); color: var(--text); }
html.light .form-control { background: #fff; border-color: var(--border); }
html.light select.form-control option { background: #fff; color: #111; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; align-items: center; }

/* ── FILTER BAR ──────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .form-control { padding: 6px 12px; font-size: 13px; }
.filter-bar select.form-control { min-width: 130px; }
.search-box { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 12px; }
.search-box input { padding-left: 30px; width: 100%; }

/* ── PAGE HEADER ─────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-family: var(--font-d); font-size: 20px; font-weight: 700; color: var(--text); }
.page-header p  { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ── TABS ────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface2); padding: 4px;
  border-radius: var(--radius-sm); width: fit-content; margin-bottom: 20px;
}
.tab {
  padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text2); border: none; background: none;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.tab:hover:not(.active) { color: var(--text); }
html.light .tab.active { box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ── FLOOR PLAN ──────────────────────────────────── */
.table-floor-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(110px,1fr)); gap: 12px; margin-top: 16px; }
.floor-table {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
  cursor: pointer; position: relative;
}
.floor-table:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
html.light .floor-table:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.floor-table.occupied  { border-color: rgba(239,68,68,.4);  background: rgba(239,68,68,.05);  }
.floor-table.available { border-color: rgba(34,197,94,.3);  background: rgba(34,197,94,.04);  }
.floor-table.reserved  { border-color: rgba(234,179,8,.3);  background: rgba(234,179,8,.04);  }
html.light .floor-table.occupied  { background: #fef2f2; border-color: #fca5a5; }
html.light .floor-table.available { background: #f0fdf4; border-color: #86efac; }
html.light .floor-table.reserved  { background: #fefce8; border-color: #fde047; }
.floor-table .table-num    { font-family: var(--font-d); font-size: 20px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.floor-table .table-cap    { font-size: 10px; color: var(--text3); font-family: var(--font-m); }
.floor-table .table-status-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
}
.floor-table.occupied  .table-status-dot { background: var(--red);   }
.floor-table.available .table-status-dot { background: var(--green); }
.floor-table.reserved  .table-status-dot { background: var(--yellow);}

/* ── DETAIL PANEL ────────────────────────────────── */
.detail-2col { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: start; }
.detail-row  { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-key { font-size: 12px; color: var(--text2); font-family: var(--font-m); }
.detail-val { font-size: 13px; font-weight: 500; text-align: right; color: var(--text); }

/* ── KOT CARDS ───────────────────────────────────── */
.kot-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px; }
.kot-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kot-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface2); border-bottom: 1px solid var(--border);
}
.kot-card-body   { padding: 14px 16px; }
.kot-item-row    { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--text); }
.kot-qty {
  width: 24px; height: 24px; background: var(--surface2); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m); font-size: 12px; font-weight: 500; color: var(--accent); flex-shrink: 0;
}
.kot-card-footer {
  display: flex; gap: 8px; padding: 10px 16px;
  border-top: 1px solid var(--border); background: var(--surface2);
}

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state i  { font-size: 36px; margin-bottom: 12px; opacity: .3; }
.empty-state h3 { font-size: 15px; color: var(--text2); margin-bottom: 6px; font-family: var(--font-d); }
.empty-state p  { font-size: 13px; }

/* ── SECTION DIVIDER ─────────────────────────────── */
.section-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 16px; }
.section-divider h3 { font-family: var(--font-d); font-size: 13px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── MODAL ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  z-index: 200; display: none; align-items: center; justify-content: center;
}
html.light .modal-backdrop { background: rgba(0,0,0,.35); }
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow); animation: popIn .2s ease;
}
@keyframes popIn { from{opacity:0;transform:scale(.96)} to{opacity:1;transform:none} }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-family: var(--font-d); font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: 1px solid var(--border); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; color: var(--text3); font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { border-color: var(--red); color: var(--red); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media(max-width:900px) {
  .sidebar { width: 60px; }
  .logo-name,.logo-tag,.restaurant-pill,.nav-section-label,
  .nav-item span,.logout-btn span { display: none; }
  .detail-2col { grid-template-columns: 1fr; }
}
@media(max-width:600px) {
  .page-content { padding: 12px 14px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
}