/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --bg: #0d0f1a;
  --bg2: #141726;
  --bg3: #1c2038;
  --border: #2a2f4a;
  --accent: #5b8dee;
  --accent2: #8b5cf6;
  --patio: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --text: #e8eaf6;
  --text2: #8892b0;
  --text3: #4a5270;
  --panel-w: 320px;
  --hud-h: 64px;

  /* server colors */
  --s0: #5b8dee; --s1: #a855f7; --s2: #f59e0b;
  --s3: #22c55e; --s4: #ef4444; --s5: #06b6d4;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ── HUD ─────────────────────────────────────────────────────── */
.hud {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--hud-h);
  background: rgba(13,15,26,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; z-index: 100;
}

#flipside-logo { height: 32px; filter: brightness(0) invert(1); }

.hud-stats { display: flex; gap: 8px; }
.chip {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 600; color: var(--text2);
  white-space: nowrap;
}
.chip-patio { border-color: rgba(34,197,94,.4); color: var(--patio); }
.chip-bar { border-color: rgba(91,141,238,.4); color: var(--accent); }

.hud-servers { display: flex; gap: 8px; flex: 1; justify-content: center; }
.server-token {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; cursor: pointer;
  transition: all .2s;
}
.server-token:hover { transform: translateY(-2px); }
.server-dot { width: 10px; height: 10px; border-radius: 50%; }
.server-name { font-size: 11px; font-weight: 600; }

.hud-clock {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--accent); letter-spacing: 2px;
  min-width: 80px; text-align: right;
}

/* ── FLOOR ───────────────────────────────────────────────────── */
.floor-wrap {
  position: fixed; top: var(--hud-h); left: 0; right: 0; bottom: 0;
  overflow: auto; background: var(--bg);
  display: flex; align-items: flex-start;
}

/* The inline SVG scales to fill width, preserving aspect ratio */
#floor-svg {
  width: 100%;
  height: auto;
  min-height: calc(100vh - var(--hud-h));
  display: block;
}

/* ── SVG INTERACTIVE OVERLAY ─────────────────────────────────── */

/* Entity overlay group */
.ov-entity { cursor: pointer; }
.ov-entity:hover .ov-ring { r: 22; }

/* Status ring — the coloured outer circle */
.ov-ring {
  fill: none;
  stroke-width: 3;
  transition: r .15s;
  r: 20;
}
.ov-halo {
  fill: none;
  stroke-width: 6;
  opacity: .28;
  r: 26;
}

/* Status colours (applied via JS as data-status attr on the <g>) */
.ov-entity[data-status="open"]    .ov-ring { stroke: #22c55e; filter: drop-shadow(0 0 6px #22c55e88); }
.ov-entity[data-status="seated"]  .ov-ring { stroke: #f59e0b; filter: drop-shadow(0 0 6px #f59e0b88); }
.ov-entity[data-status="ordered"] .ov-ring { stroke: #5b8dee; filter: drop-shadow(0 0 6px #5b8dee88); }
.ov-entity[data-status="bill"]    .ov-ring { stroke: #ef4444; filter: drop-shadow(0 0 8px #ef444488); }
.ov-entity[data-status="reserved"].ov-ring { stroke: #c084fc; filter: drop-shadow(0 0 8px #c084fc88); }
.ov-entity[data-status="active"]  .ov-ring { stroke: #a855f7; filter: drop-shadow(0 0 10px #a855f7aa); }
.ov-entity[data-status="ok"]      .ov-ring { stroke: #22c55e; }
.ov-entity[data-status="outofservice"] .ov-ring { stroke: #ef4444; filter: drop-shadow(0 0 8px #ef444488); }

/* Stool rings are smaller */
.ov-entity[data-type="stool"] .ov-ring { r: 14; }
.ov-entity[data-type="stool"]:hover .ov-ring { r: 16; }
.ov-entity[data-type="stool"] .ov-halo { r: 18; }

/* Fixture rings */
.ov-entity[data-type="fixture"] .ov-ring { r: 12; }
.ov-entity[data-type="fixture"]:hover .ov-ring { r: 14; }
.ov-entity[data-type="fixture"] .ov-halo { r: 16; }

/* Label pill */
.ov-label-bg { fill: rgba(13,15,26,.82); rx: 5; }
.ov-label-text {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 700;
  fill: #e8eaf6;
  dominant-baseline: middle;
  text-anchor: middle;
}

/* Reserved badge */
.ov-badge-bg { fill: #ef4444; rx: 6; }
.ov-badge-text {
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 900;
  fill: #fff;
  dominant-baseline: middle;
  text-anchor: middle;
}

/* Server halo colours */
.ov-entity[data-server="0"] .ov-halo { stroke: #5b8dee; opacity: .35; }
.ov-entity[data-server="1"] .ov-halo { stroke: #a855f7; opacity: .35; }
.ov-entity[data-server="2"] .ov-halo { stroke: #f59e0b; opacity: .35; }
.ov-entity[data-server="3"] .ov-halo { stroke: #22c55e; opacity: .35; }
.ov-entity[data-server="4"] .ov-halo { stroke: #ef4444; opacity: .35; }
.ov-entity[data-server="5"] .ov-halo { stroke: #06b6d4; opacity: .35; }

/* ── SIDE PANEL ──────────────────────────────────────────────── */
.side-panel {
  position: fixed; top: var(--hud-h); right: 0; bottom: 0;
  width: var(--panel-w);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 200; overflow-y: auto;
  padding: 20px 16px 40px;
}
.side-panel.open { transform: translateX(0); }

.panel-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: 8px;
  width: 28px; height: 28px; cursor: pointer; font-size: 12px;
  transition: all .15s;
}
.panel-close:hover { color: var(--text); background: var(--border); }

.panel-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; padding-right: 32px;
}
/* Entity icon in panel: coloured dot matching status */
.panel-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; transition: border-color .2s;
}
.panel-icon-wrap[data-status="open"]    { border-color: #22c55e; box-shadow: 0 0 12px #22c55e44; }
.panel-icon-wrap[data-status="seated"]  { border-color: #f59e0b; box-shadow: 0 0 12px #f59e0b44; }
.panel-icon-wrap[data-status="ordered"] { border-color: #5b8dee; box-shadow: 0 0 12px #5b8dee44; }
.panel-icon-wrap[data-status="bill"]    { border-color: #ef4444; box-shadow: 0 0 12px #ef444444; }
.panel-icon-wrap[data-status="reserved"]{ border-color: #c084fc; box-shadow: 0 0 12px #c084fc44; }
.panel-icon-wrap[data-status="active"]  { border-color: #a855f7; box-shadow: 0 0 12px #a855f744; }
.panel-icon-wrap[data-status="ok"]      { border-color: #22c55e; }
.panel-icon-wrap[data-status="outofservice"] { border-color: #ef4444; }

.panel-title { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; }
.panel-zone { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }

.panel-section { margin-bottom: 20px; }
.section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text3); margin-bottom: 8px;
}

/* status buttons */
.status-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.status-btn {
  flex: 1; min-width: 80px;
  padding: 7px 6px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3); color: var(--text2);
  cursor: pointer; font-size: 11px; font-weight: 600;
  transition: all .15s; text-align: center;
}
.status-btn:hover { border-color: var(--accent); color: var(--text); }
.status-btn.active { border-color: var(--accent); background: rgba(91,141,238,.15); color: var(--accent); }
.status-btn[data-s="open"].active    { border-color: #22c55e; background: rgba(34,197,94,.15); color: #22c55e; }
.status-btn[data-s="seated"].active  { border-color: #f59e0b; background: rgba(245,158,11,.15); color: #f59e0b; }
.status-btn[data-s="ordered"].active { border-color: #5b8dee; background: rgba(91,141,238,.15); color: #5b8dee; }
.status-btn[data-s="bill"].active    { border-color: #ef4444; background: rgba(239,68,68,.15); color: #ef4444; }

.panel-select {
  width: 100%; padding: 9px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
  cursor: pointer; outline: none;
  transition: border-color .15s;
}
.panel-select:focus { border-color: var(--accent); }

.reserve-btn {
  width: 100%; padding: 9px;
  background: rgba(192,132,252,.1); border: 1px solid rgba(192,132,252,.3);
  border-radius: 8px; color: #c084fc;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.reserve-btn:hover { background: rgba(192,132,252,.2); }
.reserve-btn.active { background: rgba(192,132,252,.25); border-color: #c084fc; }

/* order quick */
.order-quick-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.order-btn {
  padding: 6px 10px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: 11px; cursor: pointer;
  transition: all .15s;
}
.order-btn:hover { border-color: var(--accent); transform: scale(1.04); }
.order-btn:active { transform: scale(.96); }

.order-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; margin-bottom: 8px; }
.order-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg3); border-radius: 6px; padding: 5px 8px;
  font-size: 12px; animation: fadeIn .2s ease;
}
.order-item-remove { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.order-item-remove:hover { color: var(--danger); }

.clear-order-btn {
  width: 100%; padding: 7px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
  border-radius: 8px; color: #ef4444; font-size:11px; cursor: pointer; transition: all .15s;
}
.clear-order-btn:hover { background: rgba(239,68,68,.2); }

.panel-notes {
  width: 100%; min-height: 72px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
  padding: 8px 10px; resize: vertical; outline: none;
  transition: border-color .15s;
}
.panel-notes:focus { border-color: var(--accent); }

.overlay {
  position: fixed; inset: 0; z-index: 190;
  display: none; background: rgba(0,0,0,.3); backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* ── BATHROOM DOCK ───────────────────────────────────────────── */
.bath-dock {
  position: fixed; bottom: 16px; left: 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; z-index: 50;
  min-width: 150px;
}
.bath-title { font-size: 11px; font-weight: 700; color: var(--text3); margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.bath-fixture {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; cursor: pointer; border-radius: 6px;
  transition: background .15s;
}
.bath-fixture:hover { background: var(--bg3); padding: 5px 6px; margin: 0 -6px; }
.bath-fixture-icon { font-size: 16px; }
.bath-fixture-name { font-size: 11px; color: var(--text2); flex: 1; }
.bath-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 6px #22c55e88;
  transition: all .2s; flex-shrink: 0;
}
.bath-status-dot.out { background: #ef4444; box-shadow: 0 0 6px #ef444488; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--text);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: all .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

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