/* ==========================================================================
   FORKIX PWA STYLE SYSTEM
   ========================================================================== */

/* Color Tokens & Reset */
:root {
  --bg-app: #16140F;
  --bg-surface: #221F17;
  --bg-surface-elevated: #2B271D;
  --bg-surface-glass: rgba(34, 31, 23, 0.7);
  --border-color: #3A3527;
  --border-color-hover: #5A533E;
  
  --text-primary: #FAF7F0;
  --text-secondary: #B9B2A2;
  --text-muted: #7E7867;
  
  --primary: #D4A94E;
  --primary-hover: #E8C87E;
  --primary-deep: #A87F2A;
  
  --success: #8FA57F;
  --success-bg: rgba(143, 165, 127, 0.12);
  --error: #C96A5B;
  --error-bg: rgba(201, 106, 91, 0.12);
  --warning: #D4A94E;
  --warning-bg: rgba(212, 169, 78, 0.12);
  --info: #4ea9d4;
  --info-bg: rgba(78, 169, 212, 0.12);

  --font-family-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 24px;
  --border-radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 16px rgba(212, 169, 78, 0.3);
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
  --bg-app: #F9F8F3;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F2ECE0;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --border-color: #E5DFD3;
  --border-color-hover: #C5BFB3;
  
  --text-primary: #1E1A12;
  --text-secondary: #6B6354;
  --text-muted: #9A9280;
  
  --primary: #A37E2A;
  --primary-hover: #C29F52;
  --primary-deep: #7A5A12;
  
  --success: #5F7355;
  --success-bg: rgba(95, 115, 85, 0.1);
  --error: #B55446;
  --error-bg: rgba(181, 84, 70, 0.1);
  --warning: #A37E2A;
  --warning-bg: rgba(163, 126, 42, 0.08);
  --info: #2a7ea3;
  --info-bg: rgba(42, 126, 163, 0.08);

  --shadow-sm: 0 2px 8px rgba(30, 26, 18, 0.05);
  --shadow-md: 0 8px 24px rgba(30, 26, 18, 0.1);
  --shadow-glow: 0 0 16px rgba(163, 126, 42, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-title);
  font-weight: 700;
  letter-spacing: -0.01em;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--border-radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Helpers */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.flex-row { display: flex; align-items: center; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.gap-16 { gap: 16px; }
.btn-block { width: 100%; display: flex !important; }
.max-width-600 { max-width: 600px; margin: 0 auto; }
.divider { height: 1px; background-color: var(--border-color); margin: 24px 0; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
}
.screen.active {
  display: flex;
}

/* Header */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.restaurant-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.user-role-badge {
  font-size: 0.75rem;
  background-color: var(--border-color);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 4px;
  display: inline-block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  padding: 24px;
  padding-bottom: 96px; /* Safe space for tab bar */
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Bottom Tab Bar */
.role-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  width: 20%;
  transition: var(--transition-fast);
}

.tab-btn ion-icon {
  font-size: 1.35rem;
}

.tab-btn:hover, .tab-btn.active {
  color: var(--primary);
}

.tab-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  gap: 8px;
  text-decoration: none;
}

/* Tactile press feedback - :hover alone does nothing on touch devices,
   which is how most waiter/kitchen staff will actually use this */
.btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #000000;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--border-color-hover);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(201, 106, 91, 0.2);
}
.btn-danger:hover {
  background: var(--error);
  color: #FFFFFF;
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--border-radius-sm);
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--border-radius-md);
}
.btn-icon-only ion-icon {
  font-size: 1.25rem;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group select, .form-group textarea {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 169, 78, 0.15);
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-group-inline label {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.form-group-inline input {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  outline: none;
}

/* ==========================================================================
   SETUP / LOGIN COMPONENT
   ========================================================================== */
.setup-screen {
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
  background-image: radial-gradient(circle at 50% 20%, rgba(212, 169, 78, 0.05) 0%, transparent 60%);
}

.setup-container {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
}

.setup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  background: var(--warning-bg);
  border: 1px solid rgba(212, 169, 78, 0.3);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand-badge ion-icon {
  font-size: 1.75rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--primary);
  text-transform: uppercase;
}

.setup-container h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

.setup-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.setup-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 36px;
}

.quick-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.quick-card ion-icon {
  font-size: 1.5rem;
  color: var(--primary);
}

.alert-message {
  padding: 12px 16px;
  background-color: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(201, 106, 91, 0.2);
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
}
.alert-message.success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: rgba(143, 165, 127, 0.2);
}

/* ==========================================================================
   CARDS & TABLES
   ========================================================================== */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 1.25rem;
}

.split-section {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  align-items: start;
}

/* Data Tables */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.data-table th {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Empty states - used across reservations, invites, draft orders, kitchen
   queue, chat and notifications, so it needs to carry real visual weight
   rather than reading as unstyled leftover text */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Status Tags */
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tag-new { background-color: var(--error-bg); color: var(--error); }
.tag-preparing { background-color: var(--warning-bg); color: var(--warning); }
.tag-ready { background-color: var(--success-bg); color: var(--success); }
.tag-served { background-color: var(--info-bg); color: var(--info); }
.tag-completed { background-color: var(--border-color); color: var(--text-muted); }
.tag-offline { background-color: var(--bg-surface-elevated); color: var(--text-secondary); border: 1px dashed var(--text-muted); }

/* Live Indicators */
.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--error);
}
.live-pulse::before {
  content: '';
  width: 8px;
  height: 8px;
  background-color: var(--error);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.4; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* Metrics Dashboard grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.metric-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-family-title);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.metric-icon.gold { background: var(--warning-bg); color: var(--primary); }
.metric-icon.negative { background: var(--error-bg); color: var(--error); }
.metric-icon.warning { background: var(--warning-bg); color: var(--warning); }
.metric-icon.positive { background: var(--success-bg); color: var(--success); }

/* Reservations Feed */
.reservations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reservation-item {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.res-meta h5 {
  font-size: 0.95rem;
  font-weight: 700;
}
.res-meta p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.res-table {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.9rem;
  background-color: var(--warning-bg);
  padding: 2px 8px;
  border-radius: var(--border-radius-sm);
}

/* ==========================================================================
   WAITER - TABLES GRID
   ========================================================================== */
.tables-scroll-container {
  padding: 10px 0;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 20px;
}

.table-card {
  aspect-ratio: 1;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.table-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.table-card:active {
  transform: scale(0.96);
  border-color: var(--primary);
}

.table-label {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-family-title);
  margin-bottom: 4px;
}

.table-status-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 1px 8px;
  border-radius: var(--border-radius-full);
}

.table-total {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 6px;
}

/* Table states tones */
.table-card.free {
  border-color: var(--border-color);
}
.table-card.busy {
  border-color: var(--error);
  background-image: radial-gradient(circle at center, rgba(201, 106, 91, 0.05) 0%, transparent 80%);
}
.table-card.busy .table-status-label {
  background-color: var(--error-bg);
  color: var(--error);
}

.table-card.preparing {
  border-color: var(--warning);
  background-image: radial-gradient(circle at center, rgba(212, 169, 78, 0.05) 0%, transparent 80%);
}
.table-card.preparing .table-status-label {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.table-card.ready {
  border-color: var(--success);
  background-image: radial-gradient(circle at center, rgba(143, 165, 127, 0.05) 0%, transparent 80%);
  animation: glow-ready 2s infinite alternate;
}
.table-card.ready .table-status-label {
  background-color: var(--success-bg);
  color: var(--success);
}

@keyframes glow-ready {
  0% { box-shadow: 0 0 4px rgba(143, 165, 127, 0.1); }
  100% { box-shadow: 0 0 16px rgba(143, 165, 127, 0.4); }
}

.table-card.queued {
  border-color: var(--text-muted);
  border-style: dashed;
}
.table-card.queued .table-status-label {
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
}

.table-badge-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-item .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--border-color);
}
.legend-item .dot.free { background-color: var(--bg-surface); }
.legend-item .dot.busy { background-color: var(--bg-surface); border-color: var(--error); }
.legend-item .dot.preparing { background-color: var(--bg-surface); border-color: var(--warning); }
.legend-item .dot.ready { background-color: var(--bg-surface); border-color: var(--success); }
.legend-item .dot.queued { background-color: var(--bg-surface); border-color: var(--text-muted); border-style: dashed; }

/* ==========================================================================
   WAITER - ORDER LAYOUT (Split)
   ========================================================================== */
.order-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  height: calc(100vh - 180px);
  align-items: stretch;
}

.order-menu-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-category-row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.chip {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--border-radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.chip:hover, .chip.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #000000;
}

.chip:active {
  transform: scale(0.94);
}

.menu-dishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
}

.dish-item-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 120px;
  transition: var(--transition-fast);
}

.dish-item-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.dish-item-card:active {
  transform: scale(0.97);
  border-color: var(--primary);
}

.dish-meta h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.25;
}
.dish-meta p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.dish-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.95rem;
}

.dish-tag {
  font-size: 0.7rem;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.dish-item-card.limited {
  border-color: var(--warning);
}
.dish-item-card.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Order Summary Box */
.order-summary-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.summary-header h3 {
  font-size: 1.35rem;
}

.draft-items-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.draft-item-meta h5 {
  font-size: 0.9rem;
  font-weight: 700;
}
.draft-item-meta p {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
}

.draft-item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  padding: 2px;
}

.qty-btn {
  background: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}
.qty-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.qty-val {
  font-size: 0.85rem;
  font-weight: 700;
  width: 18px;
  text-align: center;
}

.order-addons {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-bottom: 16px;
}

.summary-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.total-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-family-title);
}

.summary-actions {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   KITCHEN - ORDERS QUEUE
   ========================================================================== */
.stats-mini-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-bubble {
  background-color: var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--border-radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}
.stat-bubble.preparing { background-color: var(--warning-bg); color: var(--warning); }
.stat-bubble.ready { background-color: var(--success-bg); color: var(--success); }

.station-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.kitchen-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

.kitchen-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.kitchen-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.kitchen-table-name {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-family-title);
}

.kitchen-card-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--border-radius-sm);
}

.kitchen-card-waiter {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.kitchen-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
}

.kitchen-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.kitchen-item-name {
  font-weight: 600;
}
.kitchen-item-qty {
  font-weight: 800;
  color: var(--primary);
  margin-right: 8px;
}

.kitchen-card-notes {
  font-size: 0.8rem;
  background-color: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  border-left: 2px solid var(--error);
  color: var(--text-secondary);
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.recipe-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
}

.recipe-card h4 {
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--primary);
}

.recipe-card p {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ==========================================================================
   MODALS AND OVERLAYS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: var(--transition-normal);
  padding: 20px;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Team Chat specific styling */
.chat-messages-container {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: rgba(0,0,0,0.1);
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
}

.chat-bubble.sent {
  align-self: flex-end;
  background-color: var(--primary-deep);
  color: #FFFFFF;
  border-bottom-right-radius: 2px;
}
.chat-bubble.received {
  align-self: flex-start;
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.bubble-sender {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}
.chat-bubble.sent .bubble-sender {
  color: #FFE6A3;
}

.bubble-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}
.chat-bubble.sent .bubble-time {
  color: rgba(255,255,255,0.6);
}

.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}
.chat-input-bar input {
  flex: 1;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  outline: none;
}
.chat-input-bar input:focus {
  border-color: var(--primary);
}

/* Service alerts list */
.alert-item-row {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.alert-item-row.unread {
  border-left: 3px solid var(--primary);
}

.alert-meta h5 {
  font-size: 0.9rem;
  font-weight: 700;
}
.alert-meta p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  box-shadow: var(--shadow-md);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.toast-text {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ==========================================================================
   THERMAL RECEIPT PRINTING MOCK
   ========================================================================== */
.receipt-card {
  max-width: 400px;
}

.receipt-paper {
  background-color: #FFFFFF;
  color: #000000;
  padding: 24px 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
  margin-bottom: 20px;
  max-height: 50vh;
  overflow-y: auto;
}

.receipt-header {
  text-align: center;
}
.receipt-header h4 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 2px;
  font-family: 'Courier New', Courier, monospace;
}
.receipt-header p {
  font-size: 0.75rem;
}

.divider-dashed {
  border-top: 1px dashed #000000;
  margin: 10px 0;
}

.receipt-meta p {
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.receipt-items-table {
  width: 100%;
}
.receipt-item-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.receipt-totals {
  font-size: 0.9rem;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.total-grand {
  font-size: 1.05rem;
  font-weight: 900;
  border-top: 1px solid #000000;
  padding-top: 6px;
  margin-top: 6px;
}

.receipt-footer {
  text-align: center;
  font-size: 0.75rem;
  margin-top: 16px;
}

/* Print CSS to only print the receipt */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-receipt, #modal-receipt * {
    visibility: hidden;
  }
  #receipt-print-area, #receipt-print-area * {
    visibility: visible;
  }
  #receipt-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm; /* Standard receipt width */
    max-height: none;
    overflow: visible;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */
@media (max-width: 992px) {
  .split-section {
    grid-template-columns: 1fr;
  }
  
  .order-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  
  .order-summary-panel {
    height: auto;
    max-height: none;
  }
  
  .menu-dishes-grid {
    overflow-y: visible;
    flex: none;
  }
}

@media (max-width: 600px) {
  .dashboard-content {
    padding: 16px 12px;
  }
  
  .app-header {
    padding: 12px 16px;
  }
  
  .setup-container {
    padding: 24px 18px;
  }
  
  .tables-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
  }
  
  .table-label {
    font-size: 1.1rem;
  }
  
  .chip {
    /* Touch targets should grow, not shrink, on the small screens waiter/
       kitchen staff actually use day to day - keep this at least ~40px tall */
    padding: 10px 16px;
    font-size: 0.8rem;
  }

  .dish-item-card {
    height: 110px;
    padding: 12px;
  }

  .dish-meta h4 {
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   QR CODE SCANNER
   ========================================================================== */
#modal-qr-scanner {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  z-index: 2000;
}

.qr-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  z-index: 1;
}

.qr-scanner-header h3 {
  color: #fff;
  font-size: 1rem;
}

#qr-scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-target-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(70vw, 280px);
  height: min(70vw, 280px);
  pointer-events: none;
}

.qr-target-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--primary);
  border-style: solid;
}

.qr-corner-tl { top: 0; left: 0; border-width: 4px 0 0 4px; border-top-left-radius: 8px; }
.qr-corner-tr { top: 0; right: 0; border-width: 4px 4px 0 0; border-top-right-radius: 8px; }
.qr-corner-bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-bottom-left-radius: 8px; }
.qr-corner-br { bottom: 0; right: 0; border-width: 0 4px 4px 0; border-bottom-right-radius: 8px; }

.qr-scanner-status {
  position: absolute;
  bottom: max(32px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 0.85rem;
  padding: 0 20px;
}
