/* iBartender Patron CSS */
:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface2: #2a2a2a;
  --primary: #e6b530;
  --primary-dark: #c99a1a;
  --text: #f0f0f0;
  --text-muted: #888;
  --danger: #e53935;
  --amber: #ff8f00;
  --green: #43a047;
  --radius: 12px;
  --header-h: 56px;
  --tab-h: 48px;
}

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

body.ibt-body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ─────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ── Reserved ────────────────────────────────────────────── */
.reserved-icon { font-size: 3.5rem; }
.reserved-title { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.reserved-msg { color: var(--text-muted); font-size: 0.95rem; text-align: center; line-height: 1.6; }

/* ── Welcome ─────────────────────────────────────────────── */
.welcome-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 24px;
  text-align: center;
}

#venue-logo { max-width: 160px; max-height: 100px; object-fit: contain; border-radius: 8px; }
.venue-name { font-size: 2rem; font-weight: 700; color: var(--primary); }
.table-label { font-size: 1.25rem; color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #111;
  border: none;
  border-radius: var(--radius);
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 8px 0;
}

.link-secondary {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 16px;
}

/* ── Menu Header ─────────────────────────────────────────── */
.menu-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: var(--header-h);
  gap: 10px;
  border-bottom: 1px solid var(--surface2);
}
.header-logo { height: 36px; width: auto; border-radius: 4px; }
.table-badge {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}
.cart-icon-btn {
  background: var(--surface2);
  border: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  position: relative;
}
.cart-count {
  background: var(--primary);
  color: #111;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 5px;
}

/* ── Category Tabs ───────────────────────────────────────── */
.category-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: var(--surface);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  height: var(--tab-h);
  border-bottom: 1px solid var(--surface2);
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  background: var(--surface2);
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.cat-tab.active { background: var(--primary); color: #111; font-weight: 600; }

/* ── Menu Sections ───────────────────────────────────────── */
.menu-sections {
  padding: 16px 12px 100px;
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 16px 0 10px;
  color: var(--primary);
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.item-card:active { transform: scale(0.97); }
.item-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.item-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  background: var(--surface2);
  overflow: hidden;
}
.item-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder { width: 100%; height: 100%; background: var(--surface2); }
.unavailable-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.item-info {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-name { font-size: 0.85rem; font-weight: 500; line-height: 1.2; }
.item-price { font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* ── Cart FAB ────────────────────────────────────────────── */
.cart-fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #111;
  border: none;
  border-radius: 32px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  white-space: nowrap;
  z-index: 100;
}

/* ── Special Popup ───────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}
.bottom-sheet {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  margin-bottom: 8px;
}
.popup-items {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}
.popup-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 130px;
}
.popup-item-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface2);
}
.popup-item-img--placeholder {
  background: var(--surface2);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
}
.popup-item-name {
  font-size: 0.85rem;
  text-align: center;
  color: var(--text);
}
.popup-plus {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  align-self: center;
  flex-shrink: 0;
}
.popup-price { color: var(--primary); font-size: 1.2rem; font-weight: 700; }

/* ── Screen Header ───────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface2);
}
.screen-header h2 { font-size: 1.1rem; font-weight: 600; flex: 1; }
.btn-refresh-status {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-refresh-status:active { opacity: 0.7; }

/* ── Cart ────────────────────────────────────────────────── */
.cart-items { padding: 12px 16px; flex: 1; overflow-y: auto; }
.cart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface2);
}
.cart-item-name { flex: 1; font-size: 0.9rem; }
.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-controls button {
  background: var(--surface2);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}
.cart-line-price { font-size: 0.85rem; color: var(--primary); min-width: 60px; text-align: right; }
.cart-remove { background: none; border: none; cursor: pointer; font-size: 1rem; }
.cart-subtotal {
  padding: 10px 16px;
  text-align: right;
  font-weight: 600;
  color: var(--primary);
  border-top: 1px solid var(--surface2);
}
.cart-extras { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.cart-extras textarea {
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
  resize: none;
  font-size: 0.9rem;
  width: 100%;
}
.waiter-check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; cursor: pointer; }
.waiter-check input { margin-top: 2px; accent-color: var(--primary); }
.btn-checkout { margin: 12px 16px; max-width: none; }
.btn-add-more { margin: 0 16px 4px; max-width: none; }
.empty-cart { color: var(--text-muted); text-align: center; padding: 40px 0; }

/* ── Checkout ────────────────────────────────────────────── */
.payment-methods { padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.payment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.payment-card:hover { border-color: var(--primary); }
.pm-icon { font-size: 2rem; }
.payment-card strong { font-size: 1rem; display: block; }
.payment-card p { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

/* ── Status ──────────────────────────────────────────────── */
.status-order-id {
  padding: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}
.status-departments { padding: 8px 16px; display: flex; flex-direction: column; gap: 12px; }
.dept-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.dept-icon { font-size: 1.5rem; }
.dept-name { flex: 1; font-weight: 600; }
.dept-status { font-size: 0.85rem; color: var(--text-muted); }
.status-notes {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--surface2);
}
.status-countdown {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--amber);
  text-align: center;
}
.complete-banner {
  margin: 24px 16px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.btn-order-again {
  display: inline-block;
  background: #fff;
  color: var(--green);
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 30px;
  text-decoration: none;
}
.cancelled-banner {
  margin: 24px 16px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.95rem;
  text-align: center;
}

/* ── Return to Menu bar ──────────────────────────────────── */
#status-return-bar {
  padding: 8px 16px 24px;
  text-align: center;
}
.btn-return-menu {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 30px;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.btn-return-menu:active { opacity: 0.85; }

/* ── Re-order ────────────────────────────────────────────── */
.reorder-inner {
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.reorder-inner h2 { font-size: 1.4rem; font-weight: 700; }
.reorder-inner .sub { color: var(--text-muted); font-size: 0.9rem; }
.reorder-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
}
.reorder-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  flex: 1;
  min-width: 160px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reorder-dept-header { font-weight: 700; font-size: 1rem; color: var(--primary); }
.reorder-item-list { list-style: none; color: var(--text-muted); font-size: 0.85rem; }
.btn-reorder {
  background: var(--surface2);
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: auto;
}
