/* ==========================================================================
   Emoji Cafe -- Staff Admin Dashboard Stylesheet
   Professional, clean dashboard. Mobile-first for behind-the-counter use.
   ========================================================================== */

/* ---------- Design Tokens (synced with brand resource palette) ---------- */
:root {
  /* Brand palette (shared with public.css) */
  --color-gold:        #E8B923;
  --color-gold-light:  #F0CC55;
  --color-gold-dark:   #C99E1A;
  --color-terracotta:  #E07A5F;
  --color-brown:       #4A3F35;
  --color-brown-light: #6E625A;
  --color-brown-dark:  #352D26;
  --color-cream:       #F5EDE4;
  --color-cream-dark:  #EBE0D5;
  --color-latte:       #E0D4C8;
  --color-espresso:    #4A3F35;
  --color-white:       #FAF7F0;
  --color-pure-white:  #FFFFFF;
  --color-text:        #3A322B;
  --color-text-light:  #6E625A;
  --color-text-muted:  #A09489;

  /* Admin-specific palette */
  --color-bg:          #F3EDE6;
  --color-surface:     #FFFFFF;
  --color-border:      #E0D4C8;
  --color-border-light:#EDE7DF;

  /* Status colors */
  --status-pending:     #E5A100;
  --status-pending-bg:  #FFF8E1;
  --status-confirmed:   #2979FF;
  --status-confirmed-bg:#E3F2FD;
  --status-preparing:   #EF6C00;
  --status-preparing-bg:#FFF3E0;
  --status-ready:       #2E7D32;
  --status-ready-bg:    #E8F5E9;
  --status-collected:   #78909C;
  --status-collected-bg:#ECEFF1;
  --status-cancelled:   #C62828;
  --status-cancelled-bg:#FFEBEE;
  --status-unverified:  #8E8E93;
  --status-unverified-bg:#F5F5F5;

  /* Success/error */
  --color-success:     #5C9E6A;
  --color-success-bg:  #E8F5E9;
  --color-error:       #C24B3B;
  --color-error-bg:    #FFEBEE;

  /* Shadows — softer, warmer */
  --shadow-sm:   0 1px 4px rgba(74, 63, 53, 0.06);
  --shadow-md:   0 4px 14px rgba(74, 63, 53, 0.08);
  --shadow-lg:   0 8px 28px rgba(74, 63, 53, 0.10);

  /* Radii — rounder to match brand */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;

  /* Layout */
  --header-height: 56px;
  --tabs-height: 52px;
  --max-width: 1200px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 250ms var(--ease-out);
}


/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
table { border-collapse: collapse; width: 100%; }


/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--color-terracotta);
  color: var(--color-pure-white);
}
.btn-primary:hover { background: #c96a50; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
  background: var(--color-latte);
  color: var(--color-text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-brown);
  border: 1.5px solid var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-gold); background: var(--color-cream); }

.btn-ghost {
  color: var(--color-text-light);
  padding: 0.375rem 0.625rem;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); color: var(--color-text); }

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover { background: #B71C1C; }

.btn-success {
  background: var(--color-success);
  color: white;
}
.btn-success:hover { background: #1B5E20; }

.btn-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.btn-full { width: 100%; }


/* ---------- Auth Gate ---------- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--color-brown-dark) 0%, var(--color-brown) 50%, var(--color-brown-light) 100%);
  padding: var(--space-md);
}

.auth-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-brown);
  margin-bottom: var(--space-sm);
}

.auth-card > p {
  color: var(--color-text-light);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
}

.auth-field {
  margin-bottom: var(--space-md);
}

.auth-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--color-bg);
  transition: all var(--transition-fast);
}
.auth-field input:focus {
  outline: none;
  border-color: var(--color-gold);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.auth-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-lg);
}


/* ---------- Admin Header ---------- */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-brown);
  color: var(--color-cream);
  box-shadow: var(--shadow-md);
}

.admin-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-logo {
  font-size: 1.5rem;
}

.admin-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.admin-header-actions .btn-ghost {
  color: var(--color-cream);
  opacity: 0.8;
}
.admin-header-actions .btn-ghost:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  display: inline-block;
}
.connection-dot.error {
  background: var(--color-error);
}


/* ---------- Tab Navigation ---------- */
.admin-tabs {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 90;
  height: var(--tabs-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
}

.admin-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  height: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-light);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}
.admin-tab:hover {
  color: var(--color-text);
  background: var(--color-bg);
}
.admin-tab.active {
  color: var(--color-brown);
  border-bottom-color: var(--color-gold);
  font-weight: 600;
}

.tab-icon {
  font-size: 1.125rem;
}

.tab-badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 40px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--color-error);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}


/* ---------- Tab Panels ---------- */
.admin-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--header-height) + var(--tabs-height) + var(--space-md)) var(--space-md) var(--space-2xl);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}


/* ---------- Spinner ---------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin: 0 auto var(--space-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.orders-loading,
.menu-loading,
.stock-loading {
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--color-text-muted);
}


/* ---------- Orders Tab ---------- */
.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.status-filters {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.status-pill {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.status-pill:hover {
  border-color: var(--color-gold);
  color: var(--color-text);
}
.status-pill.active {
  background: var(--color-brown);
  color: var(--color-cream);
  border-color: var(--color-brown);
}

.orders-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.refresh-icon {
  display: inline-block;
  transition: transform 300ms ease;
}
.refresh-icon.spinning {
  animation: spin 600ms linear;
}

.auto-refresh-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.orders-empty {
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--color-text-muted);
}
.empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}


/* ---------- Order Cards ---------- */
.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.order-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}
.order-card:hover {
  box-shadow: var(--shadow-md);
}
.order-card.new-order {
  animation: highlightNew 2s ease-out;
}

@keyframes highlightNew {
  0% { box-shadow: 0 0 0 3px var(--status-pending); }
  100% { box-shadow: var(--shadow-sm); }
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  gap: var(--space-sm);
}

.order-card-id {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-brown);
}

.order-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-pending    { background: var(--status-pending-bg); color: var(--status-pending); }
.badge-confirmed  { background: var(--status-confirmed-bg); color: var(--status-confirmed); }
.badge-preparing  { background: var(--status-preparing-bg); color: var(--status-preparing); }
.badge-ready      { background: var(--status-ready-bg); color: var(--status-ready); }
.badge-collected  { background: var(--status-collected-bg); color: var(--status-collected); }
.badge-cancelled  { background: var(--status-cancelled-bg); color: var(--status-cancelled); }
.badge-unverified { background: var(--status-unverified-bg); color: var(--status-unverified); }

.order-card-body {
  padding: var(--space-md);
}

.order-customer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
}

.order-customer-name {
  font-weight: 600;
}

.order-customer-detail {
  color: var(--color-text-light);
}

.order-items-list {
  margin-bottom: var(--space-md);
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-xs) 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border-light);
}
.order-item-row:last-child {
  border-bottom: none;
}

.order-item-qty {
  font-weight: 600;
  color: var(--color-brown);
  min-width: 24px;
}

.order-item-name {
  flex: 1;
  margin: 0 var(--space-sm);
}

.order-item-addons {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.order-item-price {
  font-weight: 600;
  white-space: nowrap;
}

.order-notes {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  background: var(--color-bg);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  font-style: italic;
}

.order-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg);
  gap: var(--space-sm);
}

.order-total {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-brown);
}

.order-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.order-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.order-payment-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--color-text-light);
}
.order-payment-toggle .paid-label {
  font-weight: 600;
  color: var(--color-success);
}

/* ---------- Pagination ---------- */
.orders-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
}

.page-btn {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}
.page-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-text);
}
.page-btn.active {
  background: var(--color-brown);
  color: var(--color-cream);
  border-color: var(--color-brown);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ---------- Menu Tab ---------- */
.menu-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.menu-toolbar-left {
  flex: 1;
  min-width: 200px;
}

.menu-toolbar-right {
  display: flex;
  gap: var(--space-sm);
}

.menu-category-filter {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 0.875rem;
  min-width: 200px;
  transition: border-color var(--transition-fast);
}
.menu-category-filter:focus {
  outline: none;
  border-color: var(--color-gold);
}


/* ---------- Menu Table ---------- */
.menu-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-table {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.menu-table thead th {
  background: var(--color-bg);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.menu-table tbody td {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}
.menu-table tbody tr:last-child td {
  border-bottom: none;
}
.menu-table tbody tr:hover {
  background: var(--color-bg);
}

.menu-table .cell-id {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.menu-table .cell-name {
  font-weight: 600;
}

.menu-table .cell-price {
  font-weight: 600;
  color: var(--color-brown);
}

.menu-table .cell-actions {
  display: flex;
  gap: var(--space-xs);
  white-space: nowrap;
}


/* ---------- Section Title ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-brown);
  margin: var(--space-xl) 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-gold-light);
}


/* ---------- Toggle Switch (CSS-only) ---------- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--color-white);
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.2);
}

/* Large toggle for stock tab */
.toggle-switch.toggle-lg {
  width: 56px;
  height: 30px;
}

.toggle-switch.toggle-lg .toggle-slider::before {
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
}

.toggle-switch.toggle-lg input:checked + .toggle-slider::before {
  transform: translateX(26px);
}

/* Unavailable styling */
.toggle-switch input:not(:checked) + .toggle-slider {
  background: var(--color-error);
  opacity: 0.7;
}


/* ---------- Stock Tab ---------- */
.stock-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.stock-category {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.stock-category-header {
  padding: var(--space-md);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-brown);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.stock-category-count {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.stock-items-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-fast);
  gap: var(--space-md);
}
.stock-item:last-child {
  border-bottom: none;
}
.stock-item:hover {
  background: var(--color-bg);
}

.stock-item-info {
  flex: 1;
  min-width: 0;
}

.stock-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.stock-item-price {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.stock-item.unavailable .stock-item-name {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.stock-item-status {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 75px;
  text-align: center;
}
.stock-item-status.available {
  color: var(--color-success);
}
.stock-item-status.unavailable {
  color: var(--color-error);
}


/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(44, 24, 16, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.modal-overlay.visible {
  opacity: 1;
}

.modal-card {
  background: var(--color-white);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.visible .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-brown);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}


/* ---------- Form Styles (inside modal) ---------- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-gold);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

.form-error-msg {
  color: var(--color-error);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: var(--space-sm);
  background: var(--color-error-bg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}


/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  right: var(--space-md);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: 360px;
}

.toast {
  background: var(--color-espresso);
  color: var(--color-cream);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 300ms var(--ease-out), toastSlideOut 300ms var(--ease-out) 2.7s forwards;
  pointer-events: auto;
}
.toast.toast-success { background: var(--color-success); color: white; }
.toast.toast-error { background: var(--color-error); color: white; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}


/* ---------- Confirm Dialog (inline in order card) ---------- */
.confirm-inline {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--color-error-bg);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-top: var(--space-sm);
}

.confirm-inline span {
  flex: 1;
  color: var(--color-error);
  font-weight: 500;
}


/* ============================================================ */
/* RESPONSIVE: TABLET (768px+)                                   */
/* ============================================================ */
@media (min-width: 768px) {
  .orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stock-items-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .stock-item:nth-child(odd) {
    border-right: 1px solid var(--color-border-light);
  }

  .admin-tabs {
    left: 0;
    right: 0;
  }
}


/* ============================================================ */
/* RESPONSIVE: DESKTOP (1024px+)                                 */
/* ============================================================ */
@media (min-width: 1024px) {
  .orders-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stock-items-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .stock-item:nth-child(3n+1),
  .stock-item:nth-child(3n+2) {
    border-right: 1px solid var(--color-border-light);
  }
  /* Remove odd rule from tablet */
  .stock-item:nth-child(odd) {
    border-right: none;
  }
  .stock-item:nth-child(3n+1),
  .stock-item:nth-child(3n+2) {
    border-right: 1px solid var(--color-border-light);
  }
}


/* ============================================================ */
/* RESPONSIVE: MOBILE-ONLY (< 768px) -- card layout for menu    */
/* ============================================================ */
@media (max-width: 767px) {
  /* Transform menu table to card layout on mobile */
  .menu-table-wrap .menu-table thead {
    display: none;
  }

  .menu-table-wrap .menu-table,
  .menu-table-wrap .menu-table tbody,
  .menu-table-wrap .menu-table tbody tr,
  .menu-table-wrap .menu-table tbody td {
    display: block;
  }

  .menu-table-wrap .menu-table tbody tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    padding: var(--space-md);
    position: relative;
  }

  .menu-table-wrap .menu-table tbody td {
    padding: var(--space-xs) 0;
    border-bottom: none;
    font-size: 0.875rem;
  }

  .menu-table-wrap .menu-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 2px;
  }

  .menu-table-wrap .menu-table .cell-actions {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border-light);
  }

  /* Addons table same treatment */
  #addonsSection .menu-table thead {
    display: none;
  }
  #addonsSection .menu-table,
  #addonsSection .menu-table tbody,
  #addonsSection .menu-table tbody tr,
  #addonsSection .menu-table tbody td {
    display: block;
  }
  #addonsSection .menu-table tbody tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    padding: var(--space-md);
  }
  #addonsSection .menu-table tbody td {
    padding: var(--space-xs) 0;
    border-bottom: none;
  }
  #addonsSection .menu-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 2px;
  }

  /* Status filters scroll horizontally on mobile */
  .status-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: var(--space-xs);
  }
  .status-filters::-webkit-scrollbar { display: none; }

  .orders-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .orders-actions {
    justify-content: space-between;
  }
}


/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ---------- Print (order receipts) ---------- */
@media print {
  .admin-header,
  .admin-tabs,
  .orders-toolbar,
  .order-actions,
  .orders-pagination,
  .modal-overlay,
  .toast-container,
  .auth-gate,
  .btn {
    display: none !important;
  }

  .admin-main {
    padding: 0;
  }

  .tab-panel {
    display: block !important;
  }

  #panel-menu,
  #panel-stock {
    display: none !important;
  }

  .order-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
    margin-bottom: 1rem;
  }

  .order-card-footer {
    background: none;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
}
