/*
  Design tokens — extracted from the Figma screens (Overview, Ordering
  Screen, Checkout, Active Orders, Data Types, Create Event).
  Every future view should use these variables rather than hard-coded
  values, so the whole app stays visually consistent with the source
  designs without re-deriving colors screen by screen.
*/

:root {
  /* Brand / primary */
  --color-primary: #0f2a5c;       /* "POS" logo text, primary buttons, active nav */
  --color-primary-hover: #0c2248;
  --color-primary-light: #e8ecf3; /* selected chip/card backgrounds */

  /* Backgrounds */
  --color-bg: #f7f8f9;            /* page background */
  --color-surface: #ffffff;       /* cards, panels, slideovers */
  --color-surface-alt: #f3f4f6;   /* subtle secondary surface (totals bar, empty rows) */

  /* Borders */
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;

  /* Text */
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-text-faint: #9ca3af;

  /* Status */
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-success: #16a34a;
  --color-warning-bg: #fed7aa;
  --color-warning-text: #c2410c;

  /* Chips (flavor / preparation) */
  --color-chip-bg: #f3f4f6;
  --color-chip-text: #374151;
  --color-chip-active-bg: var(--color-primary);
  --color-chip-active-text: #ffffff;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.875rem;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadow (cards, slideovers) */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-panel: -4px 0 16px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-base);
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  transition: background-color 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* Top bar, shared across every screen in the Figma set */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.topbar .logo {
  font-weight: 700;
  color: var(--color-primary);
  font-size: var(--font-size-lg);
}

.topbar .page-title {
  font-weight: 700;
  color: var(--color-text);
}

/* Toast notifications (never use alert()/confirm() per spec §44) */
.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-card);
  animation: toast-in 0.2s ease;
}

.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Nav drawer toggle icon (next to the "POS" logo) ---- */
.nav-drawer-toggle {
  background: transparent;
  border: none;
  padding: 4px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.nav-drawer-toggle:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

/* ---- Main navigation drawer: fixed, off-canvas, floats over everything ---- */
#nav-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

#nav-drawer-root.open {
  pointer-events: auto;
}

.nav-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#nav-drawer-root.open .nav-drawer-overlay {
  opacity: 1;
}

.nav-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 280px;
  background: var(--color-surface);
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

#nav-drawer-root.open .nav-drawer-panel {
  transform: translateX(0);
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.nav-drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  padding: 0;
}

.nav-drawer-section {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.nav-drawer-label {
  padding: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  text-transform: uppercase;
}

.nav-drawer-link {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 10px var(--space-3);
  margin: 2px 0;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
}

.nav-drawer-link:hover {
  background: var(--color-surface-alt);
}

.nav-drawer-disabled {
  color: var(--color-text-faint);
  cursor: not-allowed;
}

.nav-drawer-footer {
  margin-top: auto;
  padding: var(--space-3);
}

/* Generic empty/loading state text — admin.css adds grid-specific overrides
   on top of this for pages that also load it. */
.empty-state,
.loading-text {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-text-muted);
}

.empty-state p:first-child {
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

/* Shared chip styles — used by Menu Management (flavors/prep methods)
   AND the POS Customize Drink modal (size/flavor/prep selection), so
   these live here rather than admin.css. */
.field-checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.field-checkbox-row input[type="checkbox"] {
  width: auto;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-chip-bg);
  color: var(--color-chip-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.chip.active {
  background: var(--color-chip-active-bg);
  color: var(--color-chip-active-text);
}

.chip-remove {
  font-weight: 700;
  cursor: pointer;
}

/* Icon buttons (edit/remove pencil/trash) — used on both admin pages
   and the POS cart sidebar / checkout order review. */
.icon-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--color-surface-alt);
}

.icon-btn-danger:hover {
  background: var(--color-danger-bg);
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
