/* ─── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy:   #000d9b;
  --lblue:  #bcd6f1;
  --rose:   #e6a1b2;
  --cyan:   #00b6ce;
  --lime:   #f1ff9a;
  --white:  #ffffff;
  --off:    #f6f8fc;
  --text:   #1a1a2e;
  --muted:  #6b7280;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success:#16a34a;
  --header-h: 110px;
  --radius: 12px;
}
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--off);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body.has-header { padding-top: var(--header-h); }
body.has-header.admin-mode { padding-top: 57px; } /* header-top only, sans la nav client */
body > main { flex: 1; }
a { color: var(--navy); }

/* ─── HEADER ───────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,13,155,0.12);
}
.header-top {
  background: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 56px;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name  { font-weight: 700; font-size: 15px; color: var(--navy); }
.logo-sub   { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--lblue);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--navy);
}
.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user-info a { color: var(--muted); text-decoration: none; }
.user-info a:hover { color: var(--navy); }
.search-box {
  display: flex; align-items: center; background: var(--off);
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 0 12px; height: 34px; gap: 8px; transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--navy); }
.search-box input {
  border: none; outline: none; background: transparent;
  font-size: 13px; font-family: inherit; width: 180px; color: var(--text);
}
.search-box input::placeholder { color: var(--muted); }
.cart-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent; color: var(--navy);
  border: 1.5px solid var(--navy); cursor: pointer; border-radius: 8px;
  padding: 0 16px; height: 34px; font-size: 13px; font-family: inherit;
  font-weight: 500; transition: background .15s ease, color .15s ease; position: relative;
  text-decoration: none;
}
.cart-btn:hover { background: var(--navy); color: var(--white); }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--lime); color: var(--navy);
  font-size: 10px; font-weight: 700; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.cart-badge.hidden { display: none; }

/* ─── NAV BAR ──────────────────────────────────────────────── */
.header-nav {
  background: var(--navy); display: flex; align-items: center;
  padding: 0 32px; height: 54px; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px; height: 38px; border-radius: 8px;
  color: rgba(255,255,255,.75); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s; text-decoration: none;
  border: none; background: transparent; font-family: inherit; white-space: nowrap;
}
.nav-item:hover  { background: rgba(255,255,255,.12); color: var(--white); }
.nav-item.active { background: var(--white); color: var(--navy); font-weight: 600; }
.nav-sep { width: 1px; height: 20px; background: rgba(255,255,255,.2); margin: 0 4px; }
.nav-spacer { flex: 1; }
.nav-util { display: flex; align-items: center; gap: 4px; }
.nav-util-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 0 12px; height: 32px; border-radius: 6px;
  color: rgba(255,255,255,.75); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .2s; border: none; background: transparent;
  font-family: inherit; text-decoration: none;
}
.nav-util-btn:hover { background: rgba(255,255,255,.1); color: var(--white); }
.nav-util-btn.active { color: var(--lime); }

/* ─── STEP PROGRESS ────────────────────────────────────────── */
.steps-bar {
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; justify-content: center; padding: 10px 32px;
}
.step { display: flex; align-items: center; flex: 1; max-width: 200px; }
.step-content { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.step-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.step-sub   { font-size: 10px; color: var(--muted); }
.step.active .step-label { color: var(--navy); font-weight: 600; }
.step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--border); margin-top: 2px;
}
.step.active .step-dot { background: var(--cyan); border-color: var(--cyan); }
.step.done   .step-dot { background: var(--navy); border-color: var(--navy); }
.step-line  { flex: 0 0 40px; height: 1px; background: var(--border); margin-top: -12px; }

/* ─── LAYOUT ───────────────────────────────────────────────── */
.layout {
  display: flex; max-width: 1280px; margin: 0 auto;
  padding: 24px 24px 60px; gap: 24px;
  min-height: calc(100vh - var(--header-h) - 60px);
}
.main { flex: 1; min-width: 0; }

/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar { flex: 0 0 220px; }
.sidebar-inner {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  position: sticky; top: calc(var(--header-h) + 24px);
}
.sidebar-title {
  padding: 14px 18px; font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--off);
}
.sidebar-group-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s;
  user-select: none;
}
.sidebar-group-label:hover { background: var(--off); }
.sidebar-group-label .chevron { font-size: 10px; color: var(--muted); transition: transform .2s; }
.sidebar-group.open .chevron { transform: rotate(180deg); }
.sidebar-items { display: none; }
.sidebar-group.open .sidebar-items { display: block; }
.sidebar-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px 9px 28px; font-size: 13px; color: var(--muted);
  cursor: pointer; border-bottom: 1px solid var(--border);
  transition: all .15s; text-decoration: none; position: relative;
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item:hover { background: rgba(188,214,241,.2); color: var(--navy); }
.sidebar-item.active { background: rgba(0,13,155,.06); color: var(--navy); font-weight: 600; }
.sidebar-item.active::before {
  content:''; position: absolute; left: 0; width: 3px; height: 100%;
  background: var(--navy); border-radius: 0 3px 3px 0;
}
.item-count {
  font-size: 11px; font-weight: 600; background: var(--lblue);
  color: var(--navy); padding: 2px 7px; border-radius: 20px;
}
.sidebar-item.active .item-count { background: var(--navy); color: var(--white); }

/* ─── PRODUCT GRID ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -.5px; }
.page-count { font-size: 13px; color: var(--muted); margin-top: 2px; }

.catalogue-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.catalogue-label { font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.cat-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 30px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1.5px solid var(--border); transition: all .2s;
  background: var(--white); color: var(--muted); text-decoration: none;
}
.cat-pill:hover { border-color: var(--lblue); color: var(--navy); background: rgba(188,214,241,.15); }
.cat-pill.active {
  background: var(--navy); border-color: var(--navy); color: var(--white);
  font-weight: 600; box-shadow: 0 4px 14px rgba(0,13,155,.25);
}
.pill-count { font-size: 11px; font-weight: 700; background: var(--lblue); color: var(--navy); padding: 1px 7px; border-radius: 20px; }
.cat-pill.active .pill-count { background: rgba(255,255,255,.25); color: var(--white); }

.product-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.product-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: 0 8px 30px rgba(0,13,155,.1); transform: translateY(-2px); }
.product-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; border-bottom: 1px solid var(--border); background: var(--off);
}
.product-ref { font-size: 10px; font-weight: 600; letter-spacing: .5px; color: var(--muted); }
.product-ref span { color: var(--navy); font-weight: 700; }
.stock-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.stock-ok   { background: rgba(0,182,206,.12); color: #007a8e; }
.stock-low  { background: rgba(230,161,178,.2); color: #a0405a; }
.stock-zero { background: var(--border); color: var(--muted); }
.product-img-wrap {
  height: 170px; cursor: pointer; overflow: hidden;
}
.product-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--muted); font-size: 11px;
  background: var(--off);
}
.product-info { padding: 10px 14px; flex: 1; }
.product-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.3; }
.product-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.stock-warn { font-size: 12px; color: var(--warning, #f59e0b); margin-left: 4px; cursor: default; }
.product-meta .meta-item { display: flex; align-items: center; gap: 4px; }
.meta-val { font-weight: 600; color: var(--text); }
.meta-val.max-val { color: var(--navy); }
.product-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--off); gap: 8px;
}
.qty-wrap {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--white);
}
.qty-btn {
  width: 30px; height: 30px; border: none; background: transparent;
  cursor: pointer; font-size: 16px; color: var(--navy); font-weight: 600;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.qty-btn:hover { background: var(--lblue); }
.qty-input {
  width: 58px; height: 30px; border: none; outline: none; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--text); font-family: inherit;
  background: var(--white); border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.add-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; color: var(--navy); border: 1.5px solid var(--navy); cursor: pointer;
  border-radius: 8px; padding: 0 14px; height: 32px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  transition: background .15s ease, color .15s ease; flex: 1;
}
.add-btn:hover    { background: var(--navy); color: var(--white); }
.add-btn:disabled { background: transparent; border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.unavailable-label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; width: 100%; }

/* ─── TOAST / FLASH ────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--text); color: var(--white); padding: 12px 20px;
  border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: slideIn .3s ease; max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } }

/* ─── MODAL IMAGE ──────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75);
  z-index: 9000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-img-box {
  position: relative; max-width: 90vw;
  display: flex; flex-direction: column; align-items: center;
}
.modal-img-box img { max-width: 88vw; max-height: 78vh; object-fit: contain; display: block; border-radius: 6px; }
.modal-caption { text-align: center; padding: 12px 0 0; }
.modal-caption-name { font-size: 15px; font-weight: 600; color: var(--white); }
.modal-caption-ref  { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 3px; }
.modal-close {
  position: absolute; top: -14px; right: -14px; width: 30px; height: 30px;
  background: var(--navy); color: var(--white); border: none; border-radius: 50%;
  cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
  z-index: 1;
}

/* ─── FORM ELEMENTS ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--white); transition: border-color .2s; outline: none;
}
.form-control:focus { border-color: var(--navy); }
textarea.form-control { resize: vertical; min-height: 80px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 8px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; text-decoration: none;
  background: transparent; border: 1.5px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { border-color: var(--navy); color: var(--navy); }
.btn-primary:hover { background: var(--navy); color: var(--white); }
.btn-outline { border-color: var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ─── CARD ─────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 24px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }

/* ─── TABLE ────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  border-bottom: 2px solid var(--border); background: var(--off);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(188,214,241,.1); }
.data-table a { color: var(--navy); text-decoration: none; font-weight: 500; }
.data-table a:hover { text-decoration: underline; }

/* ─── STATUT BADGES ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-pending  { background: rgba(241,255,154,.5); color: #555200; }
.badge-waiting  { background: rgba(0,182,206,.12); color: #007a8e; }
.badge-done     { background: rgba(22,163,74,.1); color: var(--success); }
.badge-cart     { background: rgba(0,13,155,.08); color: var(--navy); }

/* ─── DASHBOARD STATS ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px 24px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card a { text-decoration: none; color: inherit; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.stat-value { font-size: 32px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); }

/* ─── LOGIN PAGE ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #001fcc 100%);
  padding: 24px;
}
.login-box {
  background: var(--white); border-radius: 16px; padding: 44px 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,30,.35);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo .logo-img  { width: 48px; height: 48px; }
.login-logo .logo-name { font-size: 17px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.login-sub   { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.login-alert {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.code-inputs { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.code-input {
  width: 48px; height: 56px; border: 2px solid var(--border); border-radius: 10px;
  text-align: center; font-size: 22px; font-weight: 700; color: var(--navy);
  font-family: inherit; outline: none; transition: border-color .2s;
}
.code-input:focus { border-color: var(--cyan); }

/* ─── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  background: var(--navy); color: rgba(255,255,255,.7);
  padding: 18px 32px; font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-footer a { color: var(--lblue); text-decoration: none; }
.site-footer-right { font-size: 11px; opacity: .6; }

/* ─── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-info    { background: #eff6ff; border: 1px solid var(--lblue); color: var(--navy); }

/* ─── PANIER RECAP ─────────────────────────────────────────── */
.panier-table th, .panier-table td { padding: 14px 16px; }
.panier-table .remove-btn {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px;
}

/* ─── LIVRAISON FORM ───────────────────────────────────────── */
.livraison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.address-panel {
  background: var(--off); border-radius: 10px; border: 1.5px solid var(--border); padding: 16px;
  font-size: 13px; line-height: 1.6; white-space: pre-line;
}
.address-panel.selected { border-color: var(--navy); background: rgba(0,13,155,.04); }

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(2,1fr); }
  .stats-grid   { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .livraison-grid { grid-template-columns: 1fr; }
  .header-top { padding: 0 16px; }
  .search-box { display: none; }
  .layout { padding: 16px; }
}
@media (max-width: 600px) {
  .product-grid { grid-template-columns: 1fr; }
  .stats-grid   { grid-template-columns: 1fr; }
}
