/* ============================================================
   FoodSaaS Dashboard — Styles v3 FINAL
   Palette : orange #FF6B35 + noir #1A1A2E + gris #F0F2F5
   ============================================================ */

:root {
  --primary:    #FF6B35;
  --primary-dk: #e55a25;
  --bg:         #F0F2F5;
  --surface:    #FFFFFF;
  --border:     #E0E0E0;
  --text:       #1A1A2E;
  --text-muted: #6B7280;
  --danger:     #EF4444;
  --warning:    #F59E0B;
  --success:    #10B981;
  --info:       #3B82F6;
  --radius:     10px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:  0 4px 20px rgba(0,0,0,.12);
  --sidebar-w:  240px;
  --topbar-h:   60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── App shell ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: #fff;
}
.sidebar-logo span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,107,53,.15);
  color: #fff;
}
.nav-item.active { border-left: 3px solid var(--primary); }
.nav-item svg { flex-shrink: 0; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}
.sidebar-footer strong { display: block; color: rgba(255,255,255,.85); margin-bottom: 2px; }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.burger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* ── Pages génériques ─────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.page.active { display: block; }

/* ══════════════════════════════════════════════════════════
   PAGE CUISINE — occupe tout l'espace restant
══════════════════════════════════════════════════════════ */
.page.kitchen-mode {
  display: none;
  padding: 14px;
  gap: 12px;
  overflow: hidden;
}
.page.kitchen-mode.active {
  display: flex !important;
  flex-direction: column;
  flex: 1;
}

/* ── Stats mini ───────────────────────────────────────────── */
.kitchen-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex-shrink: 0;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.stat-card.blue   { border-color: var(--info); }
.stat-card.green  { border-color: var(--success); }
.stat-card.yellow { border-color: var(--warning); }
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .7rem; color: var(--text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Kanban board ─────────────────────────────────────────── */
.kanban-board {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
}

/* ── Colonne kanban ───────────────────────────────────────── */
.kanban-col {
  flex: 1;
  min-width: 220px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.kanban-col-header {
  padding: 12px 14px;
  font-weight: 700;
  font-size: .9rem;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.kanban-col[data-status="NEW"]       .kanban-col-header { border-color: var(--info);    background: rgba(59,130,246,.06); }
.kanban-col[data-status="PREPARING"] .kanban-col-header { border-color: var(--warning); background: rgba(245,158,11,.06); }
.kanban-col[data-status="READY"]     .kanban-col-header { border-color: var(--success); background: rgba(16,185,129,.06); }

.kanban-count {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .72rem;
  font-weight: 700;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Order Card ───────────────────────────────────────────── */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
  cursor: pointer;
  flex-shrink: 0;
}
.order-card:hover { box-shadow: var(--shadow-lg); }
.order-card.warn  { border-color: var(--warning); background: #fffbeb; }
.order-card.alert { border-color: var(--danger); animation: blink 1s step-start infinite; }

@keyframes blink {
  0%, 100% { background: #fff; }
  50%       { background: #fee2e2; }
}

.card-header   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card-ref      { font-weight: 700; font-size: .92rem; }
.card-customer { font-size: .82rem; color: var(--text-muted); margin-bottom: 4px; }
.card-items    { font-size: .8rem; }
.card-item     { padding: 1px 0; display: flex; gap: 6px; align-items: baseline; }
.card-item .qty { font-weight: 600; color: var(--primary); min-width: 20px; }
.card-total    { margin-top: 6px; font-weight: 600; font-size: .85rem; text-align: right; }
.card-actions  { margin-top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }

/* ── Timer badge ──────────────────────────────────────────── */
.timer-badge {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.timer-badge.warn  { background: #fef3c7; color: #92400e; }
.timer-badge.alert { background: #fee2e2; color: #991b1b; }

/* ── Status badge ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-NEW           { background: #dbeafe; color: #1d4ed8; }
.status-ACCEPTED      { background: #ede9fe; color: #6d28d9; }
.status-PREPARING     { background: #fef3c7; color: #92400e; }
.status-READY         { background: #d1fae5; color: #065f46; }
.status-PICKED_UP     { background: #d1fae5; color: #065f46; }
.status-NOT_PICKED_UP { background: #fee2e2; color: #991b1b; }
.status-CANCELLED     { background: #f3f4f6; color: #6b7280; }
.status-REFUNDED      { background: #fce7f3; color: #9d174d; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-success  { background: var(--success); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm       { padding: 4px 9px; font-size: .75rem; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th { padding: 12px 14px; text-align: left; font-weight: 600; background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* ── Filters bar ──────────────────────────────────────────── */
.filters-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.form-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); }
label { font-size: .82rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }

/* ── Scanner ──────────────────────────────────────────────── */
.scan-container { max-width: 500px; margin: 0 auto; background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-lg); }
#qr-video { width: 100%; border-radius: 8px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.scan-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: .82rem; }
.scan-divider::before, .scan-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Login ────────────────────────────────────────────────── */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--text); }
.login-card { background: var(--surface); border-radius: 14px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 28px; font-size: 1.4rem; font-weight: 800; }
.login-logo span { color: var(--primary); }
.form-group { margin-bottom: 16px; }
.form-group .form-control { width: 100%; }
.login-err { background: #fee2e2; color: #991b1b; border-radius: 7px; padding: 10px 14px; font-size: .85rem; margin-bottom: 14px; display: none; }

/* ── Toasts ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: .84rem;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: all;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px;
  width: min(90vw, 520px);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ── Notif dot ────────────────────────────────────────────── */
.notif-dot { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(1.4); } }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (< 768px)
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html, body { overflow: auto; height: auto; }
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .main-content { height: auto; overflow: visible; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .burger-btn { display: flex; }

  .kitchen-stats { grid-template-columns: repeat(2, 1fr); }

  .page.kitchen-mode.active {
    overflow-y: auto;
    height: auto;
    flex: none;
  }
  .kanban-board {
    flex-direction: column;
    overflow: visible;
    flex: none;
  }
  .kanban-col {
    width: 100%;
    height: auto;
    max-height: 60vh;
    overflow: hidden;
  }
  .kanban-cards { overflow-y: auto; }
}

@media (max-width: 480px) {
  .page { padding: 10px; }
  .page.kitchen-mode { padding: 8px; gap: 8px; }
  .topbar { padding: 0 12px; }
  table { font-size: .76rem; }
  thead th, tbody td { padding: 7px 8px; }
  .kitchen-stats { gap: 6px; }
  .stat-value { font-size: 1rem; }
  .stat-label { font-size: .62rem; }
}
