/**
 * MOBILE REFONTE — Esther Ifrah — 2026-05-15
 * Fixes prioritaires identifiés par audit Gemini Vision :
 *   1. Cookies banner discret (non-intrusif mobile + checkout)
 *   2. Hamburger 44x44 tap-target conforme WCAG/iOS
 *   3. Drawer mobile uniformisé (icônes cohérentes + spacing)
 *   4. "Présentation par Esther" bouton plus sobre sur /collections/all
 *   5. Trait séparation sous logo équilibré (largeur centrée)
 *   6. Mobile padding/typo/tap-target globaux
 * Chargé APRÈS mobile-responsive.css pour override.
 */

/* ═══════════════════════════════════════════════════════════════
   1. COOKIES BANNER — discret mobile, dismissible visible
   ═══════════════════════════════════════════════════════════════ */
#cookieBanner {
  /* Override inline styles */
  padding: 0.7rem 0.9rem !important;
  font-size: 0.78rem !important;
  line-height: 1.4 !important;
  border-radius: 8px !important;
  bottom: 0.5rem !important;
  left: 0.5rem !important;
  right: 0.5rem !important;
  max-width: 480px !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22) !important;
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#cookieBannerTitle {
  font-size: 0.82rem !important;
  margin-bottom: 0.25rem !important;
}
#cookieAccept {
  padding: 0.4rem 0.85rem !important;
  font-size: 0.74rem !important;
}
/* Bouton fermeture (X) ajouté en haut droite */
#cookieBanner::before {
  content: "×";
  position: absolute;
  top: 0.35rem;
  right: 0.6rem;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
@media (max-width: 480px) {
  #cookieBanner {
    font-size: 0.74rem !important;
    padding: 0.6rem 0.75rem !important;
  }
  #cookieBanner > div:nth-child(2) {
    margin-bottom: 0.5rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   2. HAMBURGER — 44x44 tap-target + style sobre
   ═══════════════════════════════════════════════════════════════ */
.mobile-menu-toggle {
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 10px !important;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 1px solid rgba(212, 175, 55, 0.25) !important;
  border-radius: 8px !important;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s ease, border-color 0.2s ease;
}
@media (max-width: 900px) {
  .mobile-menu-toggle {
    display: inline-flex !important;
  }
}
.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus-visible {
  background: rgba(212, 175, 55, 0.08) !important;
  border-color: rgba(212, 175, 55, 0.5) !important;
  outline: none;
}
.mobile-menu-toggle span {
  display: block !important;
  width: 22px !important;
  height: 2.5px !important;
  background: #D4AF37 !important;
  margin: 4px 0 !important;
  border-radius: 2px;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-menu-toggle.active {
  background: rgba(212, 175, 55, 0.12) !important;
  border-color: rgba(212, 175, 55, 0.6) !important;
}
.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px) !important;
}
.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0 !important;
}
.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px) !important;
}

/* ═══════════════════════════════════════════════════════════════
   3. DRAWER MOBILE — uniformisé, sobre, élégant
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .navbar__nav {
    /* Override : drawer plus large + spacing aéré + scroll OK */
    width: 85% !important;
    max-width: 340px !important;
    background: #FFFEF7 !important;
    padding: 4.5rem 0 2rem !important;
    box-shadow: 6px 0 24px rgba(15, 23, 42, 0.18) !important;
    border-right: none !important;
  }
  .navbar__nav.active {
    /* Garantit visibilité même sans inline style fallback */
    display: flex !important;
    left: 0 !important;
  }
  .navbar__nav li {
    width: 100% !important;
    list-style: none;
  }
  .navbar__nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.85rem !important;
    padding: 0.95rem 1.5rem !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    color: #0F172A !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.18) !important;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    line-height: 1.4;
    min-height: 48px;
  }
  .navbar__nav-link:active,
  .navbar__nav-link:focus-visible {
    background: rgba(212, 175, 55, 0.08) !important;
    color: #8B6914 !important;
    outline: none;
  }
  /* Bibliothèque highlight — déjà inline gold, on garde mais on harmonise size */
  .navbar__nav-link[href="/collections/all"] {
    color: #8B6914 !important;
    font-weight: 700 !important;
  }
  /* Icônes du drawer : taille uniforme + couleur or */
  .navbar__nav-link i {
    width: 22px;
    text-align: center;
    color: #D4AF37;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
  /* Search item à part visuellement (icône seule) */
  .navbar__nav-link[href="/search"] {
    color: #475569 !important;
    font-weight: 500 !important;
  }
  .navbar__nav-link[href="/search"] i {
    color: #475569;
  }
  /* Bordure dernier item retirée */
  .navbar__nav li:last-child .navbar__nav-link {
    border-bottom: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   4. "PRÉSENTATION PAR ESTHER" — bouton plus sobre
   ═══════════════════════════════════════════════════════════════ */
/* Cible le bouton inline sur /collections/all et /audio */
button[onclick*="booksIntro"] {
  background: rgba(212, 175, 55, 0.08) !important;
  color: #8B6914 !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  padding: 0.45rem 1rem !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  border-radius: 18px !important;
  transition: background 0.2s ease, border-color 0.2s ease !important;
}
button[onclick*="booksIntro"]:hover {
  background: rgba(212, 175, 55, 0.14) !important;
  border-color: rgba(212, 175, 55, 0.65) !important;
}
button[onclick*="booksIntro"] i {
  color: #8B6914;
  margin-right: 0.4rem;
}

/* ═══════════════════════════════════════════════════════════════
   5. TRAIT SÉPARATION SOUS LOGO — équilibré desktop
   ═══════════════════════════════════════════════════════════════ */
/* Cible le div trait inline (height: 2px; background: linear-gradient...) après .navbar */
.navbar + div[style*="linear-gradient(90deg, transparent, #D4AF37"] {
  max-width: 1280px;
  margin-left: auto !important;
  margin-right: auto !important;
  height: 1.5px !important;
  opacity: 0.55;
}

/* ═══════════════════════════════════════════════════════════════
   6. MOBILE : padding latéral garanti + tap-targets + hero
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Padding latéral garanti partout */
  .container,
  main > section,
  main > div {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  /* Pas d'overflow horizontal */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }
  /* Tap targets 44px partout */
  a.btn, button, input[type="submit"], .btn-add-to-cart {
    min-height: 44px;
    min-width: 44px;
  }
  /* Hero cap à 70vh */
  .hero-section,
  .hero {
    max-height: 80vh;
  }
  /* Logo : cache le "by Esther Ifrah" sur mobile pour gain de place */
  .navbar__logo > span:last-child {
    display: none;
  }
  .navbar__logo > span:first-child {
    width: 32px !important;
    height: 32px !important;
  }
  /* Header height plus compacte */
  .navbar__container {
    height: 64px !important;
  }
  main {
    padding-top: 64px !important;
  }
  /* Prix vignettes book : contraste renforcé */
  .book-price,
  .price-wrap,
  .price {
    color: #0F172A !important;
    background: rgba(255, 254, 247, 0.92);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
  }
  /* Cart icon visible top right */
  .navbar__actions {
    gap: 6px !important;
  }
  .navbar__actions a {
    width: 40px !important;
    height: 40px !important;
  }
  /* Compte caché sur mobile (déjà dans drawer) */
  .navbar__actions a[href="/compte"] {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   7. DESKTOP CORRECTION D'OVERFLOW (David 28 May 2026)
   Assure que le Panier, Recherche et Profil sont TOUJOURS visibles
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  .navbar__container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 1.5rem !important;
    box-sizing: border-box !important;
  }
  
  .navbar__nav {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important; /* Rapprochement élégant des liens pour éviter l'overflow */
    margin: 0 auto !important; /* Centrage optique */
    padding: 0 !important;
  }

  .navbar__nav-link {
    font-size: 0.82rem !important; /* Taille de police compacte et sophistiquée */
    white-space: nowrap !important;
    letter-spacing: 0.01em !important;
  }

  /* Bibliothèque : highlight or fort + uppercase petit */
  .navbar__nav-link[href="/collections/all"] {
    color: #D4AF37 !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase;
    font-size: 0.78rem !important;
    padding: 5px 10px !important;
    border: 1.5px solid rgba(212, 175, 55, 0.4) !important;
    border-radius: 6px !important;
    transition: all 0.2s ease;
  }
  .navbar__nav-link[href="/collections/all"]:hover {
    background: rgba(212, 175, 55, 0.12) !important;
    border-color: rgba(212, 175, 55, 0.8) !important;
  }

  /* Masque le sous-titre de marque long sur les écrans intermédiaires pour gagner 100px */
  @media (max-width: 1300px) {
    .navbar__logo span:last-child {
      display: none !important;
    }
  }

  /* Force la visibilité absolue et empêche le rétrécissement du panier/compte */
  .navbar__actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex-shrink: 0 !important;
    margin-left: 0 !important;
  }

  .navbar__actions a {
    width: 40px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    border: 1.5px solid rgba(212, 175, 55, 0.4) !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
  }
  
  .navbar__actions a:hover {
    background: rgba(212, 175, 55, 0.1) !important;
    border-color: #D4AF37 !important;
    transform: scale(1.05);
  }
}

/* Version grand écran (1280px et plus) : réintroduction d'espacements plus larges */
@media (min-width: 1280px) {
  .navbar__nav {
    gap: 1.25rem !important;
  }
  .navbar__nav-link {
    font-size: 0.88rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   8. MENU OVERLAY mobile — bien visible
   ═══════════════════════════════════════════════════════════════ */
.menu-overlay {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}
.menu-overlay.active {
  display: block !important;
}

/* ═══════════════════════════════════════════════════════════════
   9. CART / CHECKOUT — vidange icône + spacing CTA
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .empty-cart-icon,
  .cart-empty-icon,
  [class*="empty"] i.fa-shopping-cart,
  [class*="empty"] svg {
    max-width: 56px !important;
    max-height: 56px !important;
    margin: 0 auto 1rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   10. FICHE PRODUIT — bouton retour bibliothèque clair
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  a[href="/collections/all"][class*="back"],
  .back-to-library,
  .breadcrumb a {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.85rem !important;
    color: #8B6914 !important;
    background: rgba(212, 175, 55, 0.08);
    border-radius: 6px;
    min-height: 40px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   11. STYLE LIEN PANIER DANS LE MENU (David 28 May 2026)
   ═══════════════════════════════════════════════════════════════ */
.navbar__nav-link.navbar__nav-cart-link {
  color: #D4AF37 !important;
  font-weight: 700 !important;
}

.navbar__nav-link.navbar__nav-cart-link .cart-badge {
  position: relative !important;
  top: 0 !important;
  right: 0 !important;
  display: inline-flex !important;
  margin-left: 0.5rem !important;
  vertical-align: middle !important;
  border: none !important;
  box-shadow: none !important;
  background: linear-gradient(135deg, #D4AF37, #F5E6A3) !important;
  color: #1a1a2e !important;
  min-width: 18px !important;
  height: 18px !important;
  font-size: 0.65rem !important;
  border-radius: 50% !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 18px !important;
}
