/* ===========================
   ORDEREK — Design System v2
   Kolory: Navy #1a2340 + Orange #f97316
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --navy:       #1a2340;
  --navy-light: #2d3a5f;
  --navy-dark:  #111827;
  --orange:     #f97316;
  --orange-light:#fb923c;
  --orange-dark: #ea6c00;
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --gray-900:   #0f172a;
  --status-new:       #3b82f6;
  --status-progress:  #f59e0b;
  --status-done:      #10b981;
  --status-delivered: #6366f1;
  --status-urgent:    #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;
  --transition:  0.2s ease;
  --font: 'Inter', sans-serif;
}

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

html { font-family: var(--font); font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button  { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); outline: none; }

.hidden { display: none !important; }

/* ===================================
   HEADER — Pasek górny (spójny dla wszystkich paneli)
   =================================== */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--gray-200);
}

/* Logo w headerze — wordmark styl Orderek */
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

/* Litera O z kreską — naśladuje logo z briefa */
.header-logo-o {
  width: 28px;
  height: 28px;
  border: 3px solid var(--navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.header-logo-o::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 3px;
  background: var(--orange);
  border-radius: 2px;
}

.header-logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.header-role-badge {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  border: none;
  cursor: pointer;
}
.btn-icon:hover { background: var(--gray-200); }

/* ===================================
   BUTTONS
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  min-height: 42px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: var(--font);
}
.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 2px 8px rgba(249,115,22,0.3);
}
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(249,115,22,0.35); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: var(--navy-light); transform: translateY(-1px); }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-lg  { padding: 14px 24px; font-size: 1rem; min-height: 50px; border-radius: var(--radius-lg); }
.btn-sm  { padding: 7px 13px; font-size: 0.8rem; min-height: 34px; }
.btn-full { width: 100%; }

/* ===================================
   WAITER LAYOUT
   =================================== */
.waiter-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
}

.waiter-sidebar {
  background: white;
  border-right: 1px solid var(--gray-200);
  padding: 20px 16px;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  margin-bottom: 10px;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.table-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  background: white;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  transition: var(--transition);
  cursor: pointer;
}
.table-btn:hover  { border-color: var(--orange); color: var(--orange); background: rgba(249,115,22,0.04); }
.table-btn.active { background: var(--navy); border-color: var(--navy); color: white; }
.table-btn.occupied { border-color: var(--orange); color: var(--orange); background: rgba(249,115,22,0.06); }

.waiter-main { padding: 20px 24px; overflow-y: auto; }

/* ===================================
   SECTION CARDS
   =================================== */
.section-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.section-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ===================================
   SEARCH + MENU
   =================================== */
.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--gray-50);
  transition: var(--transition);
}
.search-input:focus { border-color: var(--orange); background: white; box-shadow: 0 0 0 3px rgba(249,115,22,0.1); }

.category-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-tab {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: var(--transition);
  cursor: pointer;
}
.cat-tab:hover { border-color: var(--orange); color: var(--orange); }
.cat-tab.active { background: var(--orange); border-color: var(--orange); color: white; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.menu-item-btn {
  padding: 13px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: white;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.menu-item-btn:hover {
  border-color: var(--orange);
  background: rgba(249,115,22,0.03);
  transform: translateY(-1px);
}
.menu-item-name  { font-size: 0.82rem; font-weight: 600; color: var(--gray-800); margin-bottom: 3px; }
.menu-item-price { font-size: 0.78rem; color: var(--orange); font-weight: 700; }

/* ===================================
   CART
   =================================== */
.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: 7px;
  background: var(--gray-50);
}
.cart-item-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-800); flex: 1; }
.cart-item-mods { font-size: 0.73rem; color: var(--gray-500); margin-top: 2px; }
.cart-item-qty  { display: flex; align-items: center; gap: 7px; }
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--gray-300);
  background: white;
  font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); cursor: pointer;
}
.qty-btn:hover { border-color: var(--orange); color: var(--orange); }
.qty-count { font-weight: 700; min-width: 18px; text-align: center; }

/* ===================================
   MODIFIERS MODAL
   =================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 20px; }
.modifier-group { margin-bottom: 14px; }
.modifier-label { font-size: 0.78rem; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.modifier-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-chip {
  padding: 6px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  background: white;
  cursor: pointer;
  transition: var(--transition);
}
.mod-chip.selected { border-color: var(--navy); background: var(--navy); color: white; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ===================================
   ORDERS LIST
   =================================== */
.orders-list { display: flex; flex-direction: column; gap: 10px; }

.order-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.order-card:hover { box-shadow: var(--shadow-md); }

.priority-high   { border-left-color: var(--status-urgent) !important; }
.priority-vip    { border-left-color: #8b5cf6 !important; }
.priority-normal { border-left-color: var(--gray-300) !important; }

.order-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.order-table-info  { display: flex; align-items: center; gap: 10px; }
.order-table-num   { font-size: 1rem; font-weight: 800; color: var(--navy); }
.order-items-list  { font-size: 0.83rem; color: var(--gray-600); margin-bottom: 10px; }
.order-time        { font-size: 0.78rem; color: var(--gray-400); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}
.status-new       { background: rgba(59,130,246,0.1); color: var(--status-new); }
.status-progress  { background: rgba(245,158,11,0.1); color: var(--status-progress); }
.status-done      { background: rgba(16,185,129,0.12); color: var(--status-done); }
.status-delivered { background: rgba(99,102,241,0.1); color: var(--status-delivered); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-new .status-dot { animation: pulseDot 1.5s infinite; }
@keyframes pulseDot { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ===================================
   KITCHEN PANEL
   =================================== */
body.kitchen-theme { background: #0d1117; color: #e2e8f0; }

.kitchen-header {
  background: #161b22;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.kitchen-title { font-size: 1.2rem; font-weight: 800; color: white; }

.kitchen-stats { display: flex; gap: 24px; align-items: center; }
.kstat { text-align: center; }
.kstat-num { font-size: 1.5rem; font-weight: 900; color: var(--orange); line-height: 1; }
.kstat-label { font-size: 0.62rem; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.kitchen-main {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-content: start;
}

/* Kitchen Order Card */
.kitchen-order-card {
  background: #1c2231;
  border-radius: var(--radius-lg);
  border: 1.5px solid rgba(255,255,255,0.07);
  overflow: hidden;
  transition: var(--transition);
  animation: kCardIn 0.35s ease;
}
@keyframes kCardIn { from{opacity:0;transform:scale(0.96)} to{opacity:1;transform:scale(1)} }
.kitchen-order-card:hover { border-color: rgba(249,115,22,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

.status-new-card      { border-top: 3px solid var(--status-new); }
.status-progress-card { border-top: 3px solid var(--status-progress); }
.status-done-card     { border-top: 3px solid var(--status-done); }

.k-priority-bar { height: 3px; }
.k-priority-bar.normal { background: var(--status-new); }
.k-priority-bar.high   { background: var(--status-urgent); }
.k-priority-bar.vip    { background: #8b5cf6; }

.k-card-header {
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.k-table-num { font-size: 1.4rem; font-weight: 900; color: white; line-height: 1; }

.k-timer {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
}
.k-timer.warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.k-timer.urgent  { background: rgba(239,68,68,0.15); color: #f87171; animation: timerFlash 1s ease-in-out infinite; }
@keyframes timerFlash { 0%,100%{opacity:1} 50%{opacity:0.45} }

.k-card-body { padding: 14px 18px; }
.k-items-list { list-style: none; margin: 0; padding: 0; }
.k-items-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
}
.k-items-list li:last-child { border-bottom: none; }
.k-item-qty {
  background: rgba(249,115,22,0.2);
  color: var(--orange);
  font-size: 0.72rem; font-weight: 800;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.k-item-mods { font-size: 0.72rem; color: rgba(255,255,255,0.3); margin-top: 2px; }

.k-card-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-kitchen {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  border: none;
  transition: var(--transition);
  letter-spacing: 0.01em;
}
.btn-start  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1.5px solid rgba(59,130,246,0.25); }
.btn-start:hover  { background: rgba(59,130,246,0.25); }
.btn-finish { background: rgba(16,185,129,0.15); color: #34d399; border: 1.5px solid rgba(16,185,129,0.3); }
.btn-finish:hover { background: rgba(16,185,129,0.25); }

.kitchen-empty {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 12px;
  color: rgba(255,255,255,0.2);
  text-align: center;
}

/* ===================================
   MANAGER PANEL
   =================================== */
.manager-main { padding: 24px; max-width: 1400px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { font-size: 1.8rem; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 900; color: var(--navy); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.78rem; color: var(--gray-500); font-weight: 500; }
.stat-change { font-size: 0.72rem; margin-top: 4px; font-weight: 600; }
.change-up { color: var(--status-done); }

.manager-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.manager-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.manager-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Timeline */
.timeline-item { display: flex; gap: 12px; margin-bottom: 12px; align-items: flex-start; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.timeline-title { font-size: 0.83rem; font-weight: 600; color: var(--gray-800); }
.timeline-time  { font-size: 0.75rem; color: var(--gray-400); margin-top: 1px; }

/* Progress bars */
.progress-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress-label { font-size: 0.78rem; font-weight: 600; min-width: 80px; }
.progress-track { flex: 1; height: 8px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill  { height: 100%; border-radius: var(--radius-full); transition: width 0.5s ease; }
.progress-value { font-size: 0.78rem; font-weight: 700; color: var(--gray-600); min-width: 24px; text-align: right; }

/* Floor plan */
.floor-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.floor-table {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  transition: var(--transition);
}
.floor-table.occupied { border-color: var(--orange); background: rgba(249,115,22,0.06); color: var(--orange); }
.floor-table.ready    { border-color: #10b981; background: rgba(16,185,129,0.08); color: #10b981; }
.floor-table.free     { color: var(--gray-400); }
.floor-table-num      { font-size: 0.9rem; font-weight: 800; }
.floor-table-guests   { font-size: 0.6rem; color: var(--gray-400); margin-top: 2px; }

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15), 0 0 0 1px var(--gray-200);
  animation: toastIn 0.3s ease;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-800);
}

@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

.toast.success { border-left: 3px solid #10b981; }
.toast.default { border-left: 3px solid var(--orange); }
.toast-icon  { font-size: 1.2rem; }
.toast-text  { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); }
.toast-sub   { font-size: 0.75rem; color: var(--gray-500); margin-top: 1px; }

/* ===================================
   EMPTY STATES
   =================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 10px;
  text-align: center;
}
.empty-state-icon  { font-size: 3rem; opacity: 0.3; }
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--gray-600); }
.empty-state-desc  { font-size: 0.83rem; color: var(--gray-400); }

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  .waiter-layout { grid-template-columns: 1fr; }
  .waiter-sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .manager-grid { grid-template-columns: 1fr; }
  .kitchen-main { grid-template-columns: 1fr; }
  .floor-map { grid-template-columns: repeat(4, 1fr); }
}
