/* ═══════════════════════════════════════════════════════════════
   LA FIRMA GROS — app.css  |  Design System + Global Styles
   ═══════════════════════════════════════════════════════════════ */

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

/* ── 1. Variables ──────────────────────────────────────────────── */
:root {
  /* Colors */
  --rouge:        #C8102E;
  --rouge-sombre: #9B0D22;
  --rouge-light:  rgba(200, 16, 46, 0.08);
  --noir:         #111111;
  --noir-doux:    #1E1E1E;
  --blanc:        #FFFFFF;
  --gris-clair:   #F5F5F5;
  --gris-moyen:   #E0E0E0;
  --gris-texte:   #555555;
  --gris-badge:   #F0F0F0;

  /* Typography */
  --font-title: 'Poppins', sans-serif;
  --font-body:  'Inter', sans-serif;

  /* Spacing */
  --radius-card: 12px;
  --radius-btn:  8px;
  --radius-sm:   4px;

  /* Shadows */
  --shadow-card:  0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 32px rgba(200, 16, 46, 0.18);
  --shadow-deep:  0 16px 48px rgba(0, 0, 0, 0.16);

  /* Transitions */
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --trans:    all 0.3s var(--ease);
  --trans-fast: all 0.18s var(--ease);

  /* Header height */
  --header-h: 70px;
}

/* ── 2. Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--noir);
  background: var(--blanc);
  line-height: 1.6;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── 3. Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-title); font-weight: 700; line-height: 1.2; }

.text-rouge   { color: var(--rouge); }
.text-muted   { color: var(--gris-texte); font-size: 0.875rem; }
.text-center  { text-align: center; }
.fw-800       { font-weight: 800; }

/* ── 4. Layout ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.section--dark {
  background: var(--noir);
  color: var(--blanc);
}

.section--gray {
  background: var(--gris-clair);
}

.section__header {
  text-align: center;
  margin-bottom: 3rem;
}

.section__title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.section__subtitle {
  color: var(--gris-texte);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.section__title .accent {
  color: var(--rouge);
}

/* ── 5. Header ─────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  background: var(--noir);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.site-header.scrolled {
  background: rgba(17,17,17,0.97);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Logo */
.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header__logo img {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(200,16,46,0.3));
}

.header__logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.header__logo-firma {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--rouge);
  letter-spacing: 0.05em;
}

.header__logo-gros {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Search */
.header__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header__search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.75rem;
  background: var(--noir-doux);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--blanc);
  font-size: 0.9rem;
  transition: var(--trans-fast);
  outline: none;
}

.header__search-input::placeholder { color: rgba(255,255,255,0.35); }

.header__search-input:focus {
  border-color: var(--rouge);
  background: #252525;
  box-shadow: 0 0 0 3px rgba(200,16,46,0.15);
}

.header__search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

/* Nav */
.header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header__nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: var(--trans-fast);
  white-space: nowrap;
}

.header__nav-link:hover {
  color: var(--blanc);
  background: rgba(255,255,255,0.08);
}

.header__nav-link.active {
  color: var(--rouge);
}

/* Actions (panier, compte) */
.header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.header__action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  transition: var(--trans-fast);
}

.header__action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--blanc);
}

.header__cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--rouge);
  color: var(--blanc);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header__user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.875rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--trans-fast);
  border: 1.5px solid rgba(255,255,255,0.15);
}

.header__user-btn:hover {
  border-color: var(--rouge);
  color: var(--rouge);
}

/* Mobile toggle */
.header__hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
  transition: var(--trans-fast);
}

.header__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: var(--trans);
}

.header__hamburger:hover { background: rgba(255,255,255,0.1); }

/* ── 6. Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--noir);
  color: rgba(255,255,255,0.7);
  padding: 4rem 0 2rem;
  margin-top: auto;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer__logo img { height: 48px; }

.footer__brand p {
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 280px;
}

.footer__contact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.footer__contact a { transition: var(--trans-fast); }
.footer__contact a:hover { color: var(--rouge); }

.footer__col-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--blanc);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer__links a {
  font-size: 0.875rem;
  transition: var(--trans-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer__links a::before {
  content: '›';
  color: var(--rouge);
  font-weight: 700;
}

.footer__links a:hover { color: var(--blanc); padding-left: 4px; }

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer__bottom-logo { color: var(--rouge); font-weight: 700; }

/* ── 7. Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gris-texte);
  padding: 1rem 0;
  flex-wrap: wrap;
}

.breadcrumb a { transition: var(--trans-fast); }
.breadcrumb a:hover { color: var(--rouge); }
.breadcrumb__sep { color: var(--gris-moyen); }
.breadcrumb__current { color: var(--noir); font-weight: 500; }

/* ── 8. Alert / Flash ──────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.alert--success { background: #E8F5E9; color: #2E7D32; border-left: 4px solid #4CAF50; }
.alert--error   { background: #FFEBEE; color: #C62828; border-left: 4px solid var(--rouge); }
.alert--info    { background: #E3F2FD; color: #1565C0; border-left: 4px solid #2196F3; }
.alert--warning { background: #FFF3E0; color: #E65100; border-left: 4px solid #FF9800; }

/* ── 9. Page wrapper ───────────────────────────────────────────── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-h);
}

.page-wrapper > main { flex: 1; }

/* ── 10. Scrollbar custom ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--gris-clair); }
::-webkit-scrollbar-thumb { background: var(--rouge); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--rouge-sombre); }

/* ── 11. Selection ─────────────────────────────────────────────── */
::selection { background: var(--rouge); color: var(--blanc); }

/* ── 12. Utilities ─────────────────────────────────────────────── */
.d-none { display: none !important; }
.mt-auto { margin-top: auto; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ── 13. Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .header__search { max-width: 300px; }
  .header__nav { display: none; }
  /* ── FIX : hamburger visible dès que le nav disparaît ─── */
  .header__hamburger { display: flex; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* ── Variable : header 2 lignes (logo+actions + search) ── */
  :root { --header-h: 104px; }

  /* ── Inner : height auto pour s'adapter aux 2 lignes ───── */
  .header__inner {
    flex-wrap: wrap;
    height: auto !important;        /* écrase height:100% du desktop */
    padding: 0.3rem 0.75rem 0.35rem;
    gap: 0.3rem 0.4rem;
    align-content: center;
  }

  /* ── Search : 2e ligne, pleine largeur ─────────────────── */
  .header__search {
    display: block !important;      /* annule display:none du desktop */
    order: 10;                      /* toujours après logo + actions */
    flex: 0 0 100%;                 /* prend 100% de la ligne */
    max-width: 100%;
  }

  /* ── Reste du header compact ────────────────────────────── */
  .header__hamburger { display: flex; }
  .footer__grid      { grid-template-columns: 1fr; gap: 2rem; }
  .footer__bottom    { flex-direction: column; text-align: center; }
  .header__logo img  { height: 36px; }
  .header__logo-text { display: none; }
  .header__logo      { gap: 0; }
  .header__actions   { gap: 0.3rem; }
  .header__action-btn{ width: 34px; height: 34px; }
  .header__hamburger { width: 34px; height: 34px; padding: 6px; }

  .header__user-btn {
    padding: 0.4rem 0.5rem;
    gap: 0;
    font-size: 0;
  }
  .header__user-btn i:first-child      { font-size: 1.15rem; }
  .header__user-btn i.bi-chevron-down  { display: none; }

  a.header__user-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    gap: 0.3rem;
  }
  a.header__user-btn i { font-size: 0.9rem; }
}

/* ── 14. Mobile drawer ─────────────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(300px, 82vw);
  /* dvh = dynamic viewport height : tient compte de la barre d'adresse iOS/Android */
  height: 100vh;
  height: 100dvh;
  background: var(--noir-doux);
  z-index: 1001;
  transition: right 0.35s var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem 2rem;  /* top réduit : le X reste proche du bord */
  gap: 0.1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: -8px 0 48px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.mobile-menu.open { right: 0; }

.mobile-menu__close {
  align-self: flex-end;
  color: rgba(255,255,255,0.6);
  font-size: 1.3rem;
  margin-bottom: 0.25rem;   /* réduit l'espace entre X et 1er lien */
  flex-shrink: 0;
  transition: var(--trans-fast);
}
.mobile-menu__close:hover { color: var(--blanc); }

.mobile-menu a {
  padding: 0.52rem 0.8rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--trans-fast);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mobile-menu a:hover { background: rgba(255,255,255,0.08); color: var(--blanc); }

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}

/* ════════════════════════════════════════════════════════════════
   IMPRESSION — @media print
   S'applique sur toutes les pages du site
   ════════════════════════════════════════════════════════════════ */
@media print {

  /* ── Éléments à masquer à l'impression ──────────────── */
  .site-header,
  .site-nav,
  .mobile-menu,
  .mobile-overlay,
  .site-footer,
  .cart-btn,
  .btn,
  .alert,
  form,
  nav,
  #userMenuBtn,
  #userDropdown,
  [class*="btn"] {
    display: none !important;
  }

  /* ── Reset global pour l'impression ─────────────────── */
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: #ccc !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.6;
    margin: 0;
    padding: 0;
  }

  /* ── Conteneur principal ─────────────────────────────── */
  .page-wrapper,
  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── Cards / blocs légaux ────────────────────────────── */
  .card,
  .politique-page .contact-box,
  [style*="border-radius"] {
    border: 1px solid #ccc !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
    margin-bottom: 0.75rem !important;
    padding: 0.75rem !important;
  }

  .card__header,
  .card__title {
    font-weight: bold;
    font-size: 11pt;
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 0.4rem !important;
    margin-bottom: 0.4rem !important;
  }

  /* ── Titres ──────────────────────────────────────────── */
  h1 { font-size: 18pt !important; margin-bottom: 0.5rem !important; }
  h2 { font-size: 13pt !important; margin-top: 1rem !important; border-bottom: 1px solid #999 !important; padding-bottom: 0.2rem !important; }
  h3 { font-size: 11pt !important; }

  /* ── Texte et liens ──────────────────────────────────── */
  a { color: #000 !important; text-decoration: underline !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555 !important; }
  a[href^="#"]::after,
  a[href^="tel:"]::after,
  a[href^="https://wa.me"]::after { content: "" !important; }

  /* ── Blocs d'alerte / encadrés colorés ──────────────── */
  [style*="background:rgba"],
  [style*="background:#"] {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
  }

  /* ── En-tête de page imprimée ───────────────────────── */
  .politique-page h1::before,
  .container h1::before {
    content: "La Firma Gros Distribution — lafirmagros.com";
    display: block;
    font-size: 8pt;
    color: #777 !important;
    font-weight: normal;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
  }

  /* ── Sauts de page ───────────────────────────────────── */
  h2 { page-break-after: avoid; }
  p, li { orphans: 3; widows: 3; }
  .card { page-break-inside: avoid; }

  /* ── Masquer les images décoratives ─────────────────── */
  [aria-hidden="true"],
  [style*="pointer-events:none"],
  [style*="pointer-events: none"] {
    display: none !important;
  }

  /* ── En-tête impression : visible uniquement à l'impression ── */
  .print-header { display: block !important; }

  /* ── Éléments écran uniquement : masqués à l'impression ────── */
  .screen-only  { display: none  !important; }

  /* ── Styles spécifiques pages légales ───────────────────────── */
  .politique-page { max-width: 100%; padding: 0; margin: 0; }
  .politique-page h2 {
    font-size: 11pt !important;
    font-weight: bold !important;
    border-bottom: 1px solid #999 !important;
    padding-bottom: 0.2rem !important;
    margin-top: 0.75rem !important;
  }
  .politique-page .contact-box {
    border: 1px solid #999 !important;
    padding: 0.6rem !important;
    font-size: 9.5pt !important;
  }
  /* Forcer texte noir sur tous les éléments colorés */
  [style*="color:#C8102E"],
  [style*="color:#B71C1C"],
  [style*="color:var(--rouge)"],
  strong { color: #000 !important; }
}
.mobile-overlay.show { opacity: 1; pointer-events: all; }

/* ════════════════════════════════════════════════════════════════
   BREAKPOINT 717px — Tablette étroite / Mobile paysage (577–767px)
   Corrections ciblant le gap entre sm (576px) et md (768px).
   Ne touche pas au desktop (>768px) ni au petit mobile (<576px).
   ════════════════════════════════════════════════════════════════ */
@media (min-width: 577px) and (max-width: 767px) {

  /* ── Conteneur : padding réduit pour gagner 8px de chaque côté ── */
  .container { padding: 0 1rem; }

  /* ── Sections génériques : espacement vertical réduit ────────── */
  .section { padding: 3rem 0; }

  /* ── Header : actions resserrées ─────────────────────────────── */
  .header__actions { gap: 0.25rem; }

  /* ── Catalogue — barre recherche inline flexible ─────────────── */
  .search-inline              { flex: 1; }
  .search-inline .form-control { width: auto !important; flex: 1; min-width: 0; }

  /* ── Grille produits catalogue : force 2 colonnes à ce range ─── */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }

  /* ── Footer brand : description plus courte ──────────────────── */
  .footer__brand p { max-width: 100%; font-size: 0.85rem; }

  /* ── Pagination : boutons légèrement plus petits ─────────────── */
  .pagination__btn { min-width: 36px; height: 36px; font-size: 0.8rem; }

  /* ── Section Nos Familles : padding vertical réduit ──────────── */
  .section--familles { padding: 2.5rem 0 !important; }

  /* ── CTA inscription : padding vertical réduit ───────────────── */
  .cta-section { padding: 2rem 0 !important; }

  /* ── Breadcrumb : taille réduite ─────────────────────────────── */
  .breadcrumb { font-size: 0.8rem; }

  /* ── Agent KPI : 4 colonnes → 2×2 ──────────────────────────── */
  .agent-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Grille prénom/nom : reste sur 2 cols jusqu'à 577px ─────── */
  /* (stack en 1 col géré dans le bloc ≤576px ci-dessous)          */
}

/* ── Formulaires : prénom + nom en 1 colonne ≤ 480px ─────────────
   Concerne : inscription, profil, toute page avec .form-names-row */
@media (max-width: 480px) {
  .form-names-row { grid-template-columns: 1fr !important; }
}

/* ── Hero boutons : toujours côte à côte sur toute la plage mobile ──
   flex:1 hérité du bureau + gap réduit via ≤768px → les 2 boutons
   tiennent à l'horizontal dès 320px (min ~145px chacun).            */
