/**
 * Univers LP Business sur téléphone (≤ 820 px) — refonte de l'affichage mobile (2026-11-17).
 * Principes : un en-tête compact (logo, recherche, panier), une barre d'onglets en bas (Accueil, Catégories, Compte, WhatsApp, Panier), des cartes produit
 * COURTES (photo carrée, titre sur 2 lignes, prix en évidence, ajout au panier en un bouton rond), moins de boutons flottants qui masquent le contenu.
 * Ce fichier ne change rien au-dessus de 820 px. Chargé en dernier : il reprend les réglages de base.html → style-pro.css sous ce seuil.
 */

/* La barre d'onglets n'existe que sur téléphone */
.m-tabbar { display: none; }

@media (max-width: 820px) {
  :root {
    --m-header-h: 58px;
    --m-tabbar-h: 62px;
    --m-vert: #0A2A9C;
    --m-vert-2: #0F3BD0;
    --m-orange: #fa9600;
    --m-orange-fonce: #d68000;
    --m-fond: #f3f6f3;
    --m-ombre: 0 2px 10px rgba(0, 40, 15, 0.08);
  }

  html { scroll-padding-top: calc(var(--m-header-h) + 8px); }
  body { background: var(--m-fond); padding-bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  body:not(.has-m-tabbar) { padding-bottom: 0; }

  /* ------------------------------------------------------------------ haut de page : compact ------------------------------------------------- */
  .topbar { display: none !important; }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 70;
    background: linear-gradient(135deg, var(--m-vert) 0%, var(--m-vert-2) 100%);
    box-shadow: 0 2px 14px rgba(0, 40, 15, 0.28);
  }

  .site-header > .container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    min-height: var(--m-header-h);
    padding: 8px 12px;
  }

  .site-logo { flex: none; }
  .site-logo__mark { display: block; }
  .site-logo__mark img { height: 36px; width: auto; max-width: 74px; object-fit: contain; }

  .header-search {
    display: flex;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  }

  .header-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 14px;
    border: 0;
    background: transparent;
    font-size: 14px;
    color: var(--color-ink);
  }

  .header-search input::placeholder { color: #6d7a70; font-size: 13.5px; }

  .header-search button {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: linear-gradient(135deg, var(--m-orange), var(--m-orange-fonce));
    color: #fff;
  }

  .header-search button span { display: none; }
  .header-search button svg { width: 19px; height: 19px; stroke: #fff; }

  .header-actions { flex: none; display: flex; align-items: center; gap: 0; margin: 0; }
  .header-actions .lang-switch,
  .header-actions [data-account-link],
  .header-actions .btn-icon--help,
  .header-actions .nav-toggle { display: none !important; }

  .header-actions [data-cart-toggle] {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
  }

  .header-actions [data-cart-toggle] svg { width: 23px; height: 23px; stroke: #fff; }
  .header-actions [data-cart-toggle] .btn-icon__label { display: none; }
  .header-actions .cart-badge { top: -5px; right: -5px; }

  /* ------------------------------------------------------------------ barre d'onglets en bas ---------------------------------------------------- */
  .m-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 -4px 18px rgba(0, 40, 15, 0.08);
    backdrop-filter: blur(10px);
  }

  .m-tabbar__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 4px;
    border: 0;
    background: transparent;
    color: #5b665e;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-tabbar__icon { position: relative; display: grid; place-items: center; width: 26px; height: 26px; transition: transform 0.18s ease; }
  .m-tabbar__icon svg { width: 24px; height: 24px; }
  .m-tabbar__item:active .m-tabbar__icon { transform: scale(0.9); }
  .m-tabbar__item.is-active { color: var(--m-vert-2); }
  .m-tabbar__item.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 28%;
    right: 28%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--m-orange);
  }

  .m-tabbar__item--wa { color: #0b8a4a; }

  .m-tabbar__badge {
    position: absolute;
    top: -5px;
    right: -9px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--m-orange);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
  }

  .m-tabbar__badge[hidden] { display: none; }

  /* Sur la fiche produit, la barre d'achat prend la place des onglets */
  body.page-produit .m-tabbar,
  .product-sticky-bar ~ .m-tabbar { display: none; }

  /* ------------------------------------------------------------------ boutons flottants : moins envahissants ----------------------------------- */
  .social-float { display: none !important; } /* le lien WhatsApp est dans la barre d'onglets */
  .ai-assistant-fab {
    left: auto !important;
    right: 12px !important;
    bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    width: 46px !important;
    height: 46px !important;
    box-shadow: 0 6px 16px rgba(0, 40, 15, 0.25);
  }
  .ai-assistant-fab svg { width: 22px; height: 22px; }
  .scroll-top, [data-scroll-top] { bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 66px) !important; }

  /* Langue dans le menu des catégories */
  .m-lang { display: flex; gap: 8px; padding: 6px 16px 10px; }
  .m-lang button {
    flex: 1;
    height: 38px;
    border: 1.5px solid var(--color-grey-300);
    border-radius: 999px;
    background: #fff;
    color: var(--color-ink);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
  }
  .m-lang button.is-active { border-color: var(--m-vert-2); background: var(--m-vert-2); color: #fff; }

  /* ------------------------------------------------------------------ cartes produit : courtes et lisibles ---------------------------------------- */
  .product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 10px;
  }

  .product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--m-ombre);
    overflow: hidden;
  }

  .product-card__media {
    position: relative;
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 0;
    border-radius: 0;
    background: #f2f4f2;
  }

  .product-card__media-img { width: 100%; height: 100%; object-fit: cover; }
  .product-card__media.visual-placeholder::after { font-size: 11px; }

  .product-card__badges { top: 8px; left: 8px; }
  .product-card__badges .tag, .product-card__badges span { font-size: 10px; padding: 3px 8px; border-radius: 999px; }

  /* Un seul bouton sur la photo : le cœur (l'aperçu rapide est inutile sur téléphone, la fiche s'ouvre d'un toucher) */
  .product-card__quick-actions { top: 8px; right: 8px; gap: 0; }
  .product-card__quick-actions [data-action="quickview"] { display: none; }
  .product-card__icon-btn {
    width: 32px;
    height: 32px;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
  }
  .product-card__icon-btn svg { width: 17px; height: 17px; }

  .product-card__body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px 11px;
  }

  .product-card__category { display: none; }

  .product-card__name { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; }
  .product-card__name a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--color-ink);
    text-decoration: none;
  }

  .product-card__price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    min-height: 24px;
    margin-top: 3px;
    padding-right: 40px; /* place du bouton rond */
  }

  .product-card__price { font-family: var(--font-body); font-size: 15.5px; font-weight: 800; line-height: 1.2; color: var(--m-orange-fonce); letter-spacing: -0.01em; }
  .product-card__price-old { font-size: 11.5px; color: #8a948d; text-decoration: line-through; }
  .product-card__unit { font-size: 11px; color: #6b766e; }

  .product-card__stock { margin: 0; font-size: 11px; font-weight: 600; color: #2a8a52; line-height: 1.3; }
  .product-card__stock--out { color: #b3261e; }
  .product-card__stock--preorder { color: #9a6200; }

  /* Ajouter au panier : un bouton rond « + » (le libellé reste pour les lecteurs d'écran) */
  .product-card__add {
    position: absolute;
    right: 8px;
    bottom: 9px;
    width: 34px;
    height: 34px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 0 !important;
    line-height: 0;
    color: transparent;
    background: linear-gradient(135deg, var(--m-orange), var(--m-orange-fonce));
    box-shadow: 0 3px 10px rgba(214, 128, 0, 0.4);
    overflow: hidden;
    transition: transform 0.15s ease, background 0.2s ease;
  }

  .product-card__add::before {
    content: "+";
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-family: var(--font-body);
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    color: #fff;
  }

  .product-card__add:active { transform: scale(0.9); }
  .product-card__add.is-added { background: #1f9d55; box-shadow: 0 3px 10px rgba(31, 157, 85, 0.4); }
  .product-card__add.is-added::before { content: "✓"; font-size: 17px; font-weight: 800; }
  .product-card__add:disabled { background: #cfd5d0; box-shadow: none; }
  .product-card__add:disabled::before { content: "×"; color: #7d867f; }

  /* Rangées défilantes de l'accueil : cartes plus étroites, on en voit deux et demie */
  .carousel-track .product-card,
  .section-band ~ .carousel-wrap .carousel-track .product-card { flex: 0 0 calc((100% - 10px) / 2.35) !important; min-width: 0; }
  .carousel-track { gap: 10px; scroll-snap-type: x proximity; }
  .carousel-wrap > button, .carousel-btn { display: none !important; } /* on fait défiler au doigt */

  /* ------------------------------------------------------------------ pages : respiration et titres ----------------------------------------------- */
  main .container, .container { padding-left: 12px; padding-right: 12px; }
  .section { padding-top: 18px; padding-bottom: 8px; }
  .section-heading h2, .section-heading__title { font-size: 20px; }

  /* Bannière verte « Les bonnes affaires » : plus basse */
  .section-band { margin: 14px 12px 10px; padding: 12px 14px; border-radius: 14px; }
  .section-band__title { font-size: 17px; margin-bottom: 8px; }
  .section-band .btn, .section-band button, .section-band a.btn { padding: 8px 14px; font-size: 13px; min-height: 0; }

  /* ------------------------------------------------------------------ accueil : catégories rondes, engagements en pastilles ----------------------- */
  .reassurance-bar, .image-marquee { display: none !important; }

  .hero-cats { margin: 0; padding: 12px 0 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .hero-cats__title { display: none; }
  .hero-cats__list {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin: 0;
    padding: 2px 12px 8px;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .hero-cats__list::-webkit-scrollbar { display: none; }
  .hero-cats__list li { flex: none; }
  .hero-cats__list a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 68px;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--color-ink);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }
  .hero-cats__list img, .hero-cats__leaf {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    background: #e3f3e7;
    box-shadow: 0 2px 8px rgba(0, 40, 15, 0.14);
  }
  .hero-cats__leaf { display: grid; place-items: center; }
  .hero-cats__leaf svg { width: 26px; height: 26px; }

  .banner-carousel { margin: 0; border-radius: 16px; overflow: hidden; box-shadow: var(--m-ombre); }
  .banner-carousel__arrow { display: none !important; }
  .hero-main { display: block; min-height: 0 !important; padding: 18px 16px 20px; }
  .hero__eyebrow, .hero__text { display: none; }
  .hero__title { margin: 0 0 14px; font-size: 25px; line-height: 1.15; }
  .hero__actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .hero__actions .btn { min-height: 0; padding: 10px 16px; font-size: 13px; }

  .services-row { padding: 0; }
  .services-row__grid {
    display: flex !important;
    gap: 8px;
    padding: 10px 12px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    grid-template-columns: none !important;
  }
  .services-row__grid::-webkit-scrollbar { display: none; }
  .service-card {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 9px 14px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--m-ombre);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
  }
  .service-card svg { width: 18px; height: 18px; flex: none; }

  /* ------------------------------------------------------------------ boutique : en-tête de liste compact ---------------------------------------- */
  .breadcrumb { display: none; }
  .shop-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 12px 12px 8px; }
  .shop-header h1 { margin: 0; font-size: 21px; }
  .shop-header__count { margin: 0; font-size: 12.5px; color: #5b665e; }
  .filters-toggle-mobile { min-height: 0; padding: 8px 14px; font-size: 13px; border-radius: 999px; }
  .shop-layout { display: block; padding: 0; }

  /* ------------------------------------------------------------------ fenêtre d'affiches : un bandeau, pas un mur ------------------------------------ */
  .poster-popup {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    border-radius: 14px;
  }
  .poster-popup__stage { aspect-ratio: 1600 / 420; }
  .cart-guide-toast, [data-cart-toast] { bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px) !important; }

  /* ------------------------------------------------------------------ accueil : bas de page plus court ------------------------------------------ */
  /* Publicités : une rangée qu'on fait défiler au doigt, au lieu d'un mur d'images */
  .flyers-grid {
    display: flex !important;
    gap: 10px;
    padding: 2px 2px 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    grid-template-columns: none !important;
  }
  .flyers-grid::-webkit-scrollbar { display: none; }
  .flyers-grid > * { flex: 0 0 82%; scroll-snap-align: center; border-radius: 14px; overflow: hidden; box-shadow: var(--m-ombre); }
  .flyers-grid img { width: 100%; height: auto; display: block; }

  /* Bannière produit du carrousel : moins haute */
  .banner-slide .hero-slider__slide, .hero-slider__slide { min-height: 0 !important; }
  .hero-slider__slides { min-height: 0 !important; }

  /* « Pourquoi choisir Univers LP Business » : 2 colonnes de cartes courtes */
  .section-heading--center { margin-bottom: 12px; }
  .section-heading__eyebrow { font-size: 11px; }
  .trust-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .trust-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 0;
    padding: 14px 12px;
    border-radius: 14px;
    text-align: left;
    box-shadow: var(--m-ombre);
  }
  .trust-card__icon { width: 38px; height: 38px; margin: 0; }
  .trust-card__icon svg { width: 20px; height: 20px; }
  .trust-card h3 { margin: 0; font-size: 14px; line-height: 1.25; }
  .trust-card p { margin: 0; font-size: 12px; line-height: 1.4; color: #5b665e; }

  /* « Comment ça marche » : étapes en liste serrée (numéro à gauche, texte à droite) */
  .steps-grid { display: flex !important; flex-direction: column; gap: 8px !important; grid-template-columns: none !important; }
  .step-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    column-gap: 12px;
    align-items: center;
    min-height: 0;
    padding: 12px 14px;
    border-radius: 14px;
    text-align: left;
    box-shadow: var(--m-ombre);
  }
  .step-card__number { grid-row: 1 / span 2; width: 40px; height: 40px; margin: 0; font-size: 18px; }
  .step-card h3 { margin: 0; font-size: 14.5px; line-height: 1.25; }
  .step-card p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: #5b665e; }

  /* Réseaux sociaux : cartes côte à côte, plus petites */
  .social-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .social-card { padding: 14px 12px; min-height: 0; border-radius: 14px; box-shadow: var(--m-ombre); }
  .social-card h3 { font-size: 15px; margin: 4px 0 0; }
  .social-card p { font-size: 12px; margin: 2px 0 0; }

  .section--tight { padding-top: 10px; padding-bottom: 6px; }
  .section-footer { padding-top: 6px; }
  .section-footer .btn, .section-footer a.btn { min-height: 0; padding: 11px 22px; font-size: 14px; }
  .site-footer { padding-bottom: 12px; }

  /* ------------------------------------------------------------------ fiche produit ------------------------------------------------------------------ */
  body .product-layout, .product-detail { display: block; }
  .product-gallery { margin: 0; border-radius: 0; }
  .product-gallery__main, [data-gallery-main] { aspect-ratio: 1 / 1; border-radius: 0; }
  .product-info { padding: 14px 14px 8px; background: #fff; border-radius: 18px 18px 0 0; margin-top: -14px; position: relative; z-index: 2; box-shadow: 0 -6px 18px rgba(0, 40, 15, 0.07); }
  .product-info__name { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
  .product-info__price { font-size: 24px; font-weight: 800; color: var(--m-orange-fonce); }

  /* ------------------------------------------------------------------ panier, menu et messages : adaptés à la barre d'onglets ----------------------- */
  .cart-bar { display: none !important; } /* le panier et son compteur sont dans la barre d'onglets */
  body.has-cart-bar { padding-bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .cart-toast, .cart-hint {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    padding: 10px 12px;
  }
  .cart-toast__text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
  }

  .cart-drawer { width: 100% !important; max-width: 100vw; }
  .cart-drawer__header { padding: 12px 16px; }
  .cart-drawer__header h2 { font-size: 19px; }
  .cart-item { grid-template-columns: 60px 1fr auto; gap: 10px; }
  .cart-item__media { width: 60px; height: 60px; }
  .cart-item__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
  }
  .cart-item__price { font-size: 12.5px; }

  /* Le total affiché à côté du panier (ajouté par js/cart-guide.js) ne tient pas dans l'en-tête compact : le compteur de la barre d'onglets suffit */
  .btn-cart__label { display: none !important; }
  .header-actions .btn-cart { width: 42px; padding: 0; }
}
