/* UltraPC 24/10/2026 upc-ux-mobile — suite de l'analyse Clarity du 23/10 (private/clarity-suivi/analyse-ux-20261023.md).
 * 1. En-tête mobile compact : 417 px -> ~270 px en haut de page, barre fixée 187 px -> ~110 px.
 * 2. Barres d'achat collantes en bas d'écran (fiche produit, panier) : assets/js/upc-ux-mobile.js.
 * 3. Bulle WhatsApp remontée au-dessus des barres collantes (configurateur, fiche, panier).
 * 4. Messages d'erreur dans la page au lieu de la bulle du navigateur (tunnel de commande). */

/* Ordinateur : le conteneur des raccourcis ne change rien à la mise en page existante. */
.upc-raccourcis { display: contents; }

@media (max-width: 991px) {
  /* ---- Ligne « Service client » : devient une icône téléphone à droite de la barre d'icônes ---- */
  #header-container .header-top { position: relative; }
  #header-container .header-top .ctinfo {
    position: absolute; top: -36px; right: 0; z-index: 2;
    height: 35px; padding: 0 !important; margin: 0;
    display: flex; align-items: center;
    background: none !important; border: 0 !important;
  }
  #header-container .header-top .ctinfo .d-block { padding: 0 !important; }
  #header-container .header-top .ctinfo a { margin: 0 !important; font-size: 13px; font-weight: 600; color: #19488f; white-space: nowrap; }
  #header-container .header-top .ctinfo a i { font-size: 20px !important; top: 2px !important; margin-right: 4px; }

  /* ---- Logo plus bas, recherche et magasins resserrés ---- */
  #header-container #header-logo { margin: 6px 0 6px !important; }
  #header-container #header-logo img { height: 32px; width: auto; }
  #header-container #search_widget { margin-bottom: 6px !important; }
  #header-container .upc-store-toggle { padding: 2px 6px !important; min-height: 0; }
  #header-container .upc-store-icon { font-size: 20px !important; }
  #header-container .upc-store-name { font-size: 13px !important; }

  /* ---- Espace sous l'en-tête : les 50 px réservés à l'ancien lien « Nouvel arrivage » positionné en absolu
     (critique/product.tpl) ne servent plus, les raccourcis sont dans la ligne de pastilles. ---- */
  body#product #page-container { padding-top: 0 !important; }
  #page-container #page { padding-top: 8px !important; }

  /* ---- Barre de menu : la carte blanche de fond n'est plus utile ---- */
  .mobile-menu::before,
  .mobile-menu.upc-menu-fixe::before { display: none !important; }
  .mobile-menu { padding-bottom: 6px !important; }
  .mobile-menu.upc-menu-fixe { padding-top: 6px !important; padding-bottom: 6px !important; }

  /* ---- Raccourcis : une seule ligne de pastilles, défilante si besoin ---- */
  .mobile-menu .upc-raccourcis {
    order: 3; flex: 0 0 100%;
    display: flex; flex-wrap: nowrap; gap: 6px;
    margin: 6px 0 0; padding: 0 0 2px;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    /* Fondu à droite : indique que la ligne défile. */
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .mobile-menu .upc-raccourcis::-webkit-scrollbar { display: none; }
  .mobile-menu .upc-raccourcis > a {
    order: 0 !important;
    position: relative !important; top: auto !important; right: auto !important; left: auto !important;
    float: none !important; flex: 0 0 auto !important;
    display: flex !important; align-items: center; gap: 6px !important;
    width: auto !important; min-width: 0 !important; height: 36px !important;
    margin: 0 !important; padding: 0 12px !important;
    border: 1px solid #e1e5ec !important; border-radius: 18px !important;
    background: #fff !important; color: #111 !important;
    font: 600 13px/1 "Open Sans", sans-serif !important; white-space: nowrap;
    text-decoration: none !important; box-shadow: none !important;
  }
  .mobile-menu .upc-raccourcis > a:active { background: #e9eff9 !important; border-color: #19488f !important; }
  .mobile-menu .upc-raccourcis > a::before {
    position: static !important; display: inline-block !important;
    margin: 0 !important; line-height: 1 !important; font-size: 15px !important;
  }
  .mobile-menu .upc-raccourcis > .customMenuConfigurateur::before,
  .mobile-menu .upc-raccourcis > .customMenuServices::before { flex: 0 0 16px !important; width: 16px !important; height: 16px !important; }
  /* Le configurateur reste mis en avant (premier, bord bleu). */
  .mobile-menu .upc-raccourcis > .customMenuConfigurateur { order: -2 !important; border-color: #19488f !important; }
  .mobile-menu .upc-raccourcis > .customMenuServices { order: -1 !important; }
  /* Ordre : Vente flash (si vente en cours), Configurateur, Services, Nouvel arrivage, Promotions, Nouveautés. */
  .mobile-menu .upc-raccourcis > .customMenuVenteFlash { order: -3 !important; }
  .mobile-menu .upc-raccourcis > .menu-specials { order: 1 !important; }
  .mobile-menu .upc-raccourcis > .menu-news { order: 2 !important; }
}

/* ---- Barres collantes du bas (mobile) ---- */
.upc-collant { display: none; }
@media (max-width: 767px) {
  .upc-collant {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid #e1e5ec; box-shadow: 0 -6px 16px -10px rgba(0, 0, 0, .35);
    transform: translateY(110%); transition: transform .2s ease;
    font-family: "Open Sans", sans-serif;
  }
  .upc-collant.est-visible { transform: none; }
  .upc-collant-infos { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
  .upc-collant-nom { display: block; font-size: 12px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .upc-collant-prix { display: block; font-size: 16px; font-weight: 700; color: #19488f; white-space: nowrap; }
  .upc-collant-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 44px; padding: 0 14px; border: 0; border-radius: 8px;
    background: #f69c14; color: #fff !important; font-size: 14px; font-weight: 700; text-decoration: none !important; white-space: nowrap;
  }
  .upc-collant-btn[disabled] { background: #c9ced6; }
  /* La page ne doit pas finir cachée derrière la barre. */
  body.upc-barre-bas #footer-container { padding-bottom: 72px; }
}

/* ---- Bulle WhatsApp au-dessus de toute barre collante du bas ---- */
#whatsappchat-agents1 { transition: bottom .2s ease; }
body.upc-barre-bas #whatsappchat-agents1 { bottom: calc(var(--upc-barre-bas, 64px) + 12px) !important; }

/* ---- Tunnel de commande : erreurs de saisie affichées sous le champ ---- */
#checkout .upc-champ-erreur {
  display: block; margin: 6px 0 0; padding: 0;
  color: #c62828; font-size: 13px; font-weight: 600; line-height: 1.35;
}
#checkout .upc-champ-invalide,
#checkout .upc-champ-invalide:focus { border-color: #c62828 !important; box-shadow: 0 0 0 2px rgba(198, 40, 40, .15) !important; }

/* ---- Simulateur de crédit (fiche produit) : « ✓ 0% intérêt », « ✓ 0 dhs avance » en texte simple ----
 * Ces mentions avaient le même style de pastille que les badges cliquables des durées juste en dessous :
 * ~160 sessions/3 jours cliquaient dessus sans effet (Clarity 20→22/10). Toutes tailles d'écran. */
.upccr-simulator .upccr-tags { gap: 2px 16px; }
.upccr-simulator .upccr-tag {
  background: none; border: 0; border-radius: 0; padding: 0;
  color: #0f8a00; font-weight: 600; cursor: default; user-select: text;
}
