/* =============================================================================
   GROSHOP — responsive-v2.css
   Couche de correction responsive : téléphone, tablette, PC, grand écran, TV.
   ------------------------------------------------------------------------------
   * Chargée APRÈS responsive.css (voir resources/views/layouts/app.blade.php).
   * N'ajoute aucun nouveau style visuel : mêmes couleurs, mêmes polices, mêmes
     cartes que le design d'origine. Elle ne fait que corriger les débordements,
     les tailles fixes et les empilements cassés.
   * Pour revenir en arrière : supprimer la ligne qui charge ce fichier.
   Points d'arrêt : téléphone < 640 · tablette 640-1023 · PC >= 1024
                    grand écran >= 1440 · TV >= 1920 (zoom progressif)
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. TITRES : plus de taille fixe de 68 px sur téléphone
   Le PC garde exactement les mêmes tailles qu'avant (plafonds inchangés).
   -------------------------------------------------------------------------- */
:root {
  --fs-h1: clamp(1.9rem, 6.2vw, 68px);
  --fs-h2: clamp(1.55rem, 4.6vw, 46px);
  --fs-h3: clamp(1.3rem, 3.2vw, 32px);
  --fs-h4: clamp(1.1rem, 2.2vw, 23px);
}

/* responsive.css fixait ces titres à 68 px sur TOUS les écrans
   (« Finaliser la commande » occupait 4 lignes sur téléphone). */
.contact-main-title {
  font-size: clamp(2rem, 8vw, 68px);
  line-height: 1.1;
}
.success-card h2,
.payment-page h2 {
  font-size: clamp(1.5rem, 4.4vw, 2.4rem);
  line-height: 1.15;
}

/* -----------------------------------------------------------------------------
   2. BARRE DU HAUT (promo + langues) : sur une seule ligne, centrée si étroit
   -------------------------------------------------------------------------- */
.top-bar-droit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.top-bar-droit p { margin: 0; font-size: 13px; line-height: 1.4; }
.top-bar-droit .lang-switcher { margin-left: 0; }

/* -----------------------------------------------------------------------------
   3. MENU PRINCIPAL
   - PC : une ligne propre ; si les catégories sont nombreuses, retour à la
     ligne centré (au lieu de couper les libellés en deux).
   - Tablette / téléphone : menu déroulant (hamburger), sous-menus dépliables.
   -------------------------------------------------------------------------- */
.main-nav > ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
.main-nav a { white-space: nowrap; line-height: 1.3; }
.main-nav li > a > i { margin-right: 4px; }

@media (min-width: 992px) and (max-width: 1599px) {
  .main-nav a { padding: 10px 12px; font-size: 13.5px; }
}
@media (min-width: 1920px) {
  .main-nav a { padding: 10px 9px; font-size: 13.5px; }
}

/* Sous-menu accessible aussi au clavier / à la télécommande (focus) */
@media (min-width: 992px) {
  li.dropdown:focus-within > .submenu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  li.dropdown:focus-within > a::after { transform: rotate(180deg); }
  .sub-toggle { display: none; }
}

@media (max-width: 991px) {
  .main-nav { text-align: left; border-top: 1px solid #eee; max-height: calc(100vh - 120px); overflow-y: auto; }
  .main-nav > ul { flex-wrap: nowrap; justify-content: flex-start; }
  .main-nav li { position: relative; border-bottom: 1px solid #f3f3f3; }
  .main-nav li:last-child { border-bottom: 0; }
  .main-nav a { white-space: normal; padding: 14px 56px 14px 20px; font-size: 15px; }
  .main-nav li.dropdown > a::after { display: none; }   /* remplacé par le bouton .sub-toggle */
  [dir="rtl"] .main-nav { text-align: right; }
  [dir="rtl"] .main-nav a { padding: 14px 20px 14px 56px; }

  .sub-toggle {
    position: absolute; top: 0; right: 0;
    width: 52px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; border-left: 1px solid #f3f3f3;
    color: #17344c; cursor: pointer; font-size: 14px;
  }
  [dir="rtl"] .sub-toggle { right: auto; left: 0; border-left: 0; border-right: 1px solid #f3f3f3; }
  .sub-toggle i { transition: transform .25s; }
  li.dropdown.open > .sub-toggle i { transform: rotate(180deg); }

  /* Sous-menus : replies par défaut, dépliés par le bouton .sub-toggle
     (spécificité volontairement plus forte que « .main-nav ul ») */
  .main-nav .submenu { display: none; background: #f8fafc; padding: 0; margin: 0; width: 100%; list-style: none; }
  .main-nav li.dropdown.open > .submenu,
  .main-nav li.dropdown.open:hover > .submenu { display: block; }
  .submenu li { border-bottom: 1px solid #eef1f5; }
  .submenu li a { padding: 12px 20px 12px 36px; font-size: 14px; }
  [dir="rtl"] .submenu li a { padding: 12px 36px 12px 20px; }

  /* Zones tactiles confortables */
  .hamburger { width: 28px; height: 22px; padding: 12px; box-sizing: content-box; margin: -12px; }
  .header-account-wrap #headerAccMenu { right: 0; left: auto; max-width: calc(100vw - 24px); }
}

/* LOGO : sur tablette / téléphone, il se réduit enfin.
   header.css fixe « .main-header .logo img { height: 50px } » (spécificité plus
   forte) ; ses règles mobiles « .logo img { height: 38px / 32px } » n'étaient
   donc jamais appliquées. Avec un logo large (ex. 2000x402 px), il faisait
   ~250 px de large et poussait le hamburger sur une 2e ligne. */
@media (max-width: 991px) {
  .main-header .logo { flex: 0 1 auto; min-width: 0; }
  .main-header .logo img { height: 40px; width: auto; max-width: 100%; }
}
@media (max-width: 767px) {
  .main-header .logo img { height: 34px; }
}
@media (max-width: 479px) {
  .main-header .logo img { height: 30px; }
}

/* En-tête compact sur téléphone */
@media (max-width: 639px) {
  .top-bar { padding: 4px 3%; }
  .lang-btn { padding: 4px 10px; font-size: .75rem; }
  .main-header { align-items: center; }
  .client-type-bar { padding: 6px 4%; font-size: .74rem; gap: 6px 12px; }
  .client-type-bar span:last-child { margin-left: 0 !important; }
}

/* -----------------------------------------------------------------------------
   4. PIED DE PAGE : 5 blocs (marque + 4 colonnes) — la grille d'origine n'en
   prévoyait que 4, le 5e tombait seul sur une 2e rangée.
   -------------------------------------------------------------------------- */
.footer__inner { grid-template-columns: 1.7fr 1fr 1fr 1fr 1.25fr; gap: 40px; }
.footer__inner > * { min-width: 0; }
.footer__inner > *:nth-child(n) { grid-column: auto; }
.footer__newsletter form { display: flex; flex-direction: column; gap: 10px; }
.footer__newsletter input { width: 100%; min-width: 0; }

@media (max-width: 1199px) {
  .footer__inner { grid-template-columns: repeat(3, 1fr); gap: 32px 28px; }
  .footer__inner > *:nth-child(1) { grid-column: 1 / -1; }
  .footer__inner > *:nth-child(5) { grid-column: auto; }
}
@media (max-width: 767px) {
  .footer__inner { grid-template-columns: repeat(2, 1fr); }
  .footer__inner > *:nth-child(1),
  .footer__inner > *:nth-child(5) { grid-column: 1 / -1; }
}
@media (max-width: 479px) {
  .footer__inner { grid-template-columns: 1fr; }
  .footer__inner > *:nth-child(n) { grid-column: auto; }
}
.footer__bottom { flex-wrap: wrap; gap: 6px 16px; }
.footer-social a { min-width: 44px; min-height: 44px; }

/* -----------------------------------------------------------------------------
   5. CARTES PRODUITS : prix et bouton qui ne débordent plus (petites largeurs)
   -------------------------------------------------------------------------- */
.product-card-list .price-row { flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.product-card-list .old-price,
.product-card-list .new-price { white-space: nowrap; }
.product-card-list .btn-add-cart { min-width: 0; white-space: nowrap; }

@media (max-width: 1023px) {
  .product-card-list .old-price,
  .product-card-list .new-price { font-size: 17px; }
  .product-card-list .btn-add-cart { font-size: 16px; }
}
@media (max-width: 639px) {
  .product-card-list { border-width: 1.5px; border-radius: 12px; }
  .product-card-list .badge { font-size: 12px; padding: 3px 7px; top: 8px; left: 8px; }
  .product-card-list .badge-discount { font-size: 12px; padding: 3px 7px; top: 8px; right: 8px; }
  .product-card-list .card-body { padding: 8px 10px 2px; gap: 3px; }
  .product-card-list .card-category { font-size: 9.5px; padding: 3px 7px; margin-bottom: 2px; }
  .product-card-list .card-name { font-size: 13px; min-height: 36px; margin: 2px 0 4px; }
  .product-card-list .old-price { font-size: 12px; }
  .product-card-list .new-price { font-size: 15px; }
  .product-card-list .stock-ok,
  .product-card-list .stock-no { font-size: 11px; }
  .product-card-list .card-actions { padding: 8px 10px 10px; gap: 6px; }
  .product-card-list .btn-add-cart { font-size: 13px; padding: 8px 6px; gap: 4px; }
  .product-card-list .btn-wishlist { width: 36px; height: 36px; }
}

/* -----------------------------------------------------------------------------
   6. PANIER
   -------------------------------------------------------------------------- */
.cart-layout { align-items: start; }
.cart-layout > * { min-width: 0; }
.cart-items .cart-item { margin-bottom: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid #f1f1f1; }
.cart-items .cart-item:last-child { border-bottom: 0; }

@media (max-width: 767px) {
  .cart-layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .cart-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-areas: "img info rm" "img qty sub";
    gap: 6px 12px;
    align-items: center;
    padding: 14px;
  }
  .cart-item > img                { grid-area: img; width: 72px; height: 72px; align-self: start; }
  .cart-item > .cart-item-info    { grid-area: info; min-width: 0; }
  .cart-item > form               { grid-area: rm; align-self: start; justify-self: end; }
  .cart-item > .cart-item-qty     { grid-area: qty; }
  .cart-item > .cart-item-subtotal{ grid-area: sub; min-width: 0; text-align: right; white-space: nowrap; }
  .cart-item-info h3 { font-size: .92rem; }
  .cart-qty-btn { width: 34px; height: 34px; }
}

/* -----------------------------------------------------------------------------
   7. COMMANDE (checkout) + confirmation
   -------------------------------------------------------------------------- */
.payment-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.payment-layout > * { min-width: 0; }
.pay-item { min-width: 0; }
.pay-item-info { min-width: 0; overflow-wrap: anywhere; }
.pay-item-price { flex-shrink: 0; }

@media (max-width: 991px) {
  .payment-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 639px) {
  .payment-page { padding: 20px 0; }
  .payment-page.container { width: 94%; }
  .payment-form { padding: 18px 14px; }
  .payment-summary { padding: 16px 14px; }
  .cpb-rate-info { flex-wrap: wrap; gap: 6px 14px; }
  .cpb-balance { margin-left: 0; }
  .cpb-header { flex-wrap: wrap; }
  .checkout-points-block,
  .checkout-coupon-block { padding: 14px; }
  .cpb-hints { flex-wrap: wrap; gap: 4px 12px; }
}

/* Bandeau « Code promo » : le dégradé ne couvrait que la ligne du titre */
.checkout-coupon-block .cpb-header { background: none; border: 0; padding: 0; }

/* Page de confirmation : carte lisible sur toutes les tailles.
   checkout-confirm.css rendait .success-page en « display:flex » (ligne) : le
   bandeau vert « +N points » et la carte de commande se retrouvaient côte à
   côte, le bandeau s'étirait en grande boîte verte vide. On les empile. */
.success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}
.success-page > * { width: 100%; max-width: 640px; box-sizing: border-box; }
.success-page > .success-card { max-width: 560px; }
.success-card h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
@media (max-width: 639px) {
  .success-page { padding: 24px 0; }
  .success-row { gap: 12px; flex-wrap: wrap; }
  .success-actions > * { width: 100%; justify-content: center; text-align: center; }
}

/* -----------------------------------------------------------------------------
   8. BOUTONS CYAN (Commander / Confirmer) : texte lisible
   Fond cyan #43dde6 identique ; le texte blanc (contraste ~1,6:1, illisible)
   passe en bleu marine de la charte (#17344c, contraste ~7:1).
   -------------------------------------------------------------------------- */
.btn-confirm-order,
.btn-checkout {
  background: #43dde6;
  color: #17344c;
  border: 2px solid #43dde6;
}
.btn-confirm-order:hover,
.btn-checkout:hover {
  background: #17344c;
  color: #fff;
  border-color: #17344c;
}
.btn-confirm-order:active,
.btn-checkout:active { transform: translateY(1px); }

/* -----------------------------------------------------------------------------
   9. CONNEXION / INSCRIPTION
   -------------------------------------------------------------------------- */
.auth-box div:has(> #remember) {
  flex-wrap: wrap;
  gap: 8px 16px;
}
.auth-box input[type="checkbox"] + label {
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  font-size: .85rem;
}
.auth-box .auth-link { line-height: 1.8; }
@media (max-width: 479px) {
  .auth-page { padding: 24px 12px; }
  .auth-box { padding: 22px 16px; border-radius: 16px; }
}

/* -----------------------------------------------------------------------------
   10. FORMULAIRES : pas de zoom automatique iOS (champs >= 16 px sur téléphone)
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea { font-size: 16px; }
}

/* -----------------------------------------------------------------------------
   11. NOTIFICATIONS flash : ne cachent plus l'en-tête sur petit écran
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  .messages-container { left: 12px; right: 12px; max-width: none; top: 56px; }
}

/* -----------------------------------------------------------------------------
   12. TABLETTE (640-1023) : respirations et colonnes intermédiaires
   -------------------------------------------------------------------------- */
@media (min-width: 640px) and (max-width: 1023px) {
  .container { width: 94%; }
  .products-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cart-layout,
  .payment-layout { gap: 20px; }
}

/* -----------------------------------------------------------------------------
   12b. ACCUEIL — HERO TABLETTE (769-991 px)
   Les 3 colonnes (gauche / centre / droite) tombaient dans une grille à 2
   colonnes : la 3e passait sous la 1re et la carte centrale débordait.
   Maintenant : grande carte centrale en haut, puis 2 colonnes de 2 cartes.
   -------------------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 991px) {
  .container-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
  }
  .container-grid > .center { grid-column: 1 / -1; order: -1; }
  .main-card {
    height: auto;
    min-height: 0;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .main-card h1  { order: 1; }
  .main-card p   { order: 2; max-width: 80%; margin-top: 10px; }
  .main-card img { order: 3; position: static; margin: 14px auto 0; width: auto; max-width: 70%; max-height: 320px; }
  .btn-center    { order: 4; align-self: center; margin: 18px auto 0; font-size: 24px; }
  .left, .right  { height: auto; gap: 18px; min-width: 0; }
  .card          { height: 300px; }
}

/* -----------------------------------------------------------------------------
   12c. AVANTAGES (accueil + À propos) : jamais plus larges que l'écran
   about.css redéclarait .avantages-wrap à 4 colonnes APRÈS ses règles mobiles,
   ce qui annulait le repli et faisait déborder la page à droite.
   -------------------------------------------------------------------------- */
.avantages-section { max-width: 100%; box-sizing: border-box; }
.avantages-wrap { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.av-card { min-width: 0; }
@media (max-width: 991px) {
  .avantages-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .av-card { margin: 0; }
}
@media (max-width: 479px) {
  .av-card { padding: 16px 10px; }
}

/* Panier : on empile résumé et articles dès la tablette portrait */
@media (max-width: 899px) {
  .cart-layout { grid-template-columns: minmax(0, 1fr); }
  .cart-summary { position: static; }
}

/* -----------------------------------------------------------------------------
   12d. ESPACE CLIENT (profil, commandes, points)
   Le bloc « Points » du profil met le titre, « Voir tout » ET le lien du jeu
   sur la même ligne sans retour à la ligne : débordement sur téléphone.
   -------------------------------------------------------------------------- */
.pcard-head { flex-wrap: wrap; row-gap: 6px; }
.pcard-head > a { white-space: nowrap; }
.pgrid > *, .pf-grid > * { min-width: 0; }
.profile-wrap, .pts-page { box-sizing: border-box; width: 100%; }
@media (max-width: 767px) {
  .profile-header { padding: 22px 16px; }
  .pstats { gap: 8px; }
  .ord-item > * { min-width: 0; }
}

/* -----------------------------------------------------------------------------
   12e. FICHE PRODUIT : en une colonne, la galerie reprend toute la largeur
   (align-items:flex-start la réduisait à la largeur de son contenu : colonne
   étroite quand le produit n'a pas d'image, image minuscule sinon).
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .pd-gallery { align-items: stretch; width: 100%; min-width: 0; }
  .pd-main-img-wrap { width: 100%; min-width: 0; }
  .pd-main-img-wrap img { height: min(86vw, 440px); }
  .pd-no-img { height: min(70vw, 400px); width: 100%; }
  .pd-main > * { min-width: 0; }
}

/* -----------------------------------------------------------------------------
   12f. ARABE (RTL) : montants toujours au format « 1 800,00 DH »
   En RTL, le navigateur réordonnait chiffres et « DH » dans le panier, le
   récapitulatif et la confirmation (« DH 800,00 1 »). Même correction que
   responsive.css applique déjà aux cartes produits.
   -------------------------------------------------------------------------- */
html[dir="rtl"] .cart-item-price,
html[dir="rtl"] .cart-item-points,
html[dir="rtl"] .cart-item-subtotal,
html[dir="rtl"] .pay-item-price,
html[dir="rtl"] .pay-total > span:last-child,
html[dir="rtl"] .summary-row > span:last-child,
html[dir="rtl"] .success-row > strong,
html[dir="rtl"] .ord-total,
html[dir="rtl"] #btnConfirmLabel {
  direction: ltr;
  unicode-bidi: isolate;
}
html[dir="rtl"] .cart-item-price,
html[dir="rtl"] .cart-item-points { text-align: right; }

/* -----------------------------------------------------------------------------
   13. NAVIGATION AU CLAVIER / À LA TÉLÉCOMMANDE : anneau de focus visible
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #43dde6;
  outline-offset: 2px;
}
.search-btn:focus-visible,
.btn-add-cart:focus-visible,
.btn-confirm-order:focus-visible,
.btn-checkout:focus-visible { outline-color: #f02443; }

/* -----------------------------------------------------------------------------
   14. GRANDS ÉCRANS & TV
   Le site est dimensionné en px : on agrandit proportionnellement l'ensemble
   (zoom) pour qu'il reste lisible à 3 m. Sans effet sur PC / mobile.
   La plupart des TV (webOS, Tizen, Android TV, Fire TV) annoncent 1920x1080.
   -------------------------------------------------------------------------- */
/* Facteur de zoom TV : modifier --gs-zoom pour l'ajuster (1 = désactivé). */
@media (min-width: 1920px) {
  :root { --gs-zoom: 1.25; }
  html { zoom: var(--gs-zoom); }
}
@media (min-width: 2560px) {
  :root { --gs-zoom: 1.7; }
}
@media (min-width: 3400px) {
  :root { --gs-zoom: 2.3; }
}

/* -----------------------------------------------------------------------------
   Carte centrale d'accueil (« Améliorez votre quotidien ») : bouton trop grand
   sur mobile (30px hérité du desktop) qui recouvrait l'image.
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .main-card .btn-center {
    font-size: 16px;
    padding: 9px 18px;
    border-radius: 9px;
    max-width: 52%;
    white-space: nowrap;
  }
  .main-card img { max-width: 48% !important; max-height: 200px !important; }
}
@media (max-width: 480px) {
  .main-card .btn-center { font-size: 15px; padding: 8px 16px; }
}

/* Carte centrale mobile : le bouton etait pousse hors de la carte (marge 88px heritee). */
@media (max-width: 768px) {
  .main-card .btn-center { margin-top: 18px !important; display: inline-block; }
  .main-card { height: auto !important; min-height: 290px; padding-bottom: 20px; }
}

/* Carte centrale mobile : bouton ancre en bas a gauche, texte centre, jamais plus large que son contenu. */
@media (max-width: 768px) {
  .main-card { position: relative; padding-bottom: 70px; min-height: 300px; }
  .main-card .btn-center {
    position: absolute !important;
    left: 18px; bottom: 18px;
    margin: 0 !important;
    max-width: none;
    width: auto;
    display: inline-flex; align-items: center; justify-content: center;
    text-align: center;
    font-size: 15px; line-height: 1.1;
    padding: 10px 16px;
    white-space: nowrap;
    z-index: 3;
  }
  .main-card img { max-width: 44% !important; }
}
