/* ===== Styles partages entre les modules Inventaire et Livraison =====
   Ce fichier regroupe tout ce qui etait duplique entre style.css et
   livraison.css: polices, variables de couleur, fond de page, en-tete de
   site, messages flash et boutons de base. Les deux modules chargent cette
   feuille avant leur propre feuille specifique (style.css / livraison.css),
   qui ne contient plus que les regles propres a chacun. */

@font-face {
  font-family: "Futurastd";
  src: url("https://cdn.prod.website-files.com/67eed6094fc7e6a39406f3d5/67efc2b3e11efd203b7af203_FuturaStd-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Futurastd Book";
  src: url("https://cdn.prod.website-files.com/67eed6094fc7e6a39406f3d5/67efc2b3e4acde8f5d96adff_FuturaStd-Book.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f1f4f6;
  --panel: #ffffff;
  --text: #0f1720;
  --muted: #4b5b65;
  --accent: #228f9d;
  --accent-soft: #dceef1;
  --brand-dark: #0a0a0a;
  --brand-white: #ffffff;
  --danger: #b42318;
  --success: #17795e;
  --warning: #f59e0b;
  --line: #d5dfe4;
  --radius: 12px;
  --z-bg: -1;
  --z-base-raised: 1;
  --z-sticky: 10;
  --z-popover: 80;
  --z-toast: 120;
  --z-modal: 200;
  --z-dropdown: 1000;
  --z-dropdown-panel: 1001;
  --z-dropdown-combobox: 1002;
  --z-dropdown-active-card: 2500;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  /* 16px minimum: en dessous, iOS zoome au focus des champs. */
  font: 16px/1.45 "Futurastd Book", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 16% 2%, #fefefe 0%, #f8fbfc 30%, transparent 36%),
              radial-gradient(circle at 92% 8%, #d6eaef 0%, transparent 32%),
              linear-gradient(180deg, #f6f9fb 0%, var(--bg) 38%),
              var(--bg);
  -webkit-text-size-adjust: 100%;
}

.bg-shape {
  position: fixed;
  z-index: var(--z-bg);
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.45;
}

.bg-a {
  width: 280px;
  height: 280px;
  background: #cde5eb;
  top: -70px;
  left: -50px;
}

.bg-b {
  width: 320px;
  height: 320px;
  background: #b4dce3;
  right: -80px;
  top: 80px;
}

/* ---------- En-tete de site (commun aux deux modules) ---------- */

.site-header {
  padding: 14px clamp(16px, 5vw, 56px);
  padding-top: max(14px, env(safe-area-inset-top));
  display: grid;
  gap: 10px;
  border-bottom: 1px solid #1f3f45;
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.site-header-top {
  display: flex;
  align-items: center;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-white);
  text-decoration: none;
}

.site-logo {
  height: clamp(24px, 3.2vw, 34px);
  width: auto;
  display: block;
}

.site-brand-text {
  font-family: "Futurastd", "Avenir Next", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.86rem;
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-group::-webkit-scrollbar {
  display: none;
}

.nav-link {
  text-decoration: none;
  color: var(--brand-white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-family: "Futurastd", "Avenir Next", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-link-button {
  width: auto;
  min-width: 0;
}

.nav-lock-form {
  margin: 0;
}

.nav-link:hover {
  border-color: var(--accent);
  background: rgba(34, 143, 157, 0.2);
  color: var(--brand-white);
  transform: translateY(-1px);
}

.nav-link.is-active {
  background: var(--accent);
  color: var(--brand-white);
  border-color: var(--accent);
}

.nav-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-white);
  font-weight: 600;
}

.nav-cta:hover,
.nav-cta.is-active {
  background: #176f7b;
  color: var(--brand-white);
  border-color: #176f7b;
}

.active-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  background: rgba(34, 143, 157, 0.2);
  border-color: rgba(34, 143, 157, 0.5);
  color: var(--brand-white);
}

.active-profile-badge:hover,
.active-profile-badge:focus-visible {
  gap: 5px;
  background: rgba(34, 143, 157, 0.28);
  border-color: rgba(34, 143, 157, 0.65);
  color: var(--brand-white);
}

.profile-badge-icon {
  font-size: 1rem;
  line-height: 1;
}

.profile-badge-name {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  transition: max-width 220ms ease;
}

.active-profile-badge:hover .profile-badge-name,
.active-profile-badge:focus-visible .profile-badge-name {
  max-width: 180px;
}

/* legacy fallback — pas utilise si tous les liens passent par .nav-link */
.site-header a:not(.nav-link) {
  text-decoration: none;
  color: var(--brand-white);
}

/* ---------- Messages flash (communs) ---------- */

.flash-list {
  display: grid;
  gap: 8px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.success {
  border-color: #93d4c1;
  background: #edf9f5;
}

.flash.error {
  border-color: #f3a9a3;
  background: #fff3f2;
}

/* ---------- Etiquette et aide de champ (communs) ---------- */
/* Inventaire: .filter-label / .field-hint. Livraison: .liv-champ > span /
   .liv-aide. Meme traitement typographique dans les deux modules. */

.filter-label,
.liv-champ > span {
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.field-hint,
.liv-aide {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

/* ---------- Panneau / carte generique (communs) ---------- */

.panel,
.liv-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--panel);
}

.panel h2 {
  margin-top: 0;
}

/* ---------- Boutons de base (communs) ---------- */

button,
.liv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, filter 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled):not([disabled]),
.liv-btn:hover:not(:disabled) {
  filter: brightness(0.97);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.12);
}

button:focus-visible,
.liv-btn:focus-visible,
.page-btn:focus-visible,
.icon-btn:focus-visible,
.qty-btn:focus-visible,
.btn-profile-delete:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled,
button[disabled],
.liv-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Champs de saisie: focus commun (communs) ---------- */
/* Inventaire applique cet etat via .dropdown-toggle/inputs generiques;
   Livraison via .liv-champ input/.liv-input. Meme anneau d'accent. */

.liv-champ input:focus,
.liv-champ select:focus,
.liv-champ textarea:focus,
.liv-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* ---------- Tableaux (communs) ---------- */
/* Inventaire: .table-wrap + th/td generiques. Livraison: .liv-table-wrap +
   .liv-table th/td. Meme conteneur arrondi et meme entete grise en
   majuscules dans les deux modules. */

.table-wrap,
.liv-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--accent-soft) transparent;
  border-radius: 14px;
}

.liv-table-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
}

.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

table,
.liv-table {
  width: 100%;
  border-collapse: collapse;
}

th,
td,
.liv-table th,
.liv-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.liv-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f7fafb;
  white-space: nowrap;
}

.liv-table tr:last-child td {
  border-bottom: 0;
}

/* ---------- Etat vide (communs) ---------- */
/* Inventaire: .table-meta + ligne "Aucun ...". Livraison: .liv-vide, deja en
   carte pointillee. On aligne .liv-vide sur le meme radius que .panel. */

.liv-vide {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.btn-secondary,
.liv-btn-secondaire {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.btn-secondary:hover:not(:disabled):not([disabled]),
.liv-btn-secondaire:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent), #fff 55%);
}

button.danger,
.liv-btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

/* ---------- En-tete: adaptation mobile commune ---------- */

@media (max-width: 719px) {
  .site-header {
    gap: 8px;
  }

  .site-nav {
    display: grid;
    gap: 6px;
    margin-inline: calc(-1 * clamp(16px, 5vw, 56px));
  }

  .nav-group {
    width: 100%;
    padding: 2px clamp(16px, 5vw, 56px) 8px;
  }

  .nav-link,
  .liv-btn {
    min-height: 44px;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .profile-badge-name {
    max-width: 180px;
  }

  .active-profile-badge {
    gap: 5px;
  }
}
