/* -------------------------------------------------------------------------
   Vente additionnelle -- feuille de style

   Portee : barre de progression vers le franco de port (lot 2) et volet
   lateral apres ajout au panier (lot 3, .jr-va-volet).

   Le .htaccess met les CSS en cache 30 jours : incrementer le ?v= dans
   includes/template_top.php a CHAQUE modification de ce fichier, sinon les
   visiteurs deja venus garderont l ancienne version. (Le volet charge ce
   fichier lui-meme avec ?v=filemtime : pas d action pour lui.)

   Prefixe .jr-va- sur toutes les classes : stylesheet.css fait 75 Ko et
   utilise des noms tres generiques, on ne veut aucune collision.
   ------------------------------------------------------------------------- */

.jr-va-franco {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  background: #f8f9fa;
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0;
  box-sizing: border-box;
}

.jr-va-franco__titre {
  font-size: 13px;
  line-height: 1.45;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.jr-va-franco__titre b {
  font-weight: 700;
  /* Le montant restant est la seule information mise en avant. Pas de
     couleur d alerte : c est un renseignement, pas un avertissement. */
  color: #1a1a2e;
}

/* Rappel du seuil, en retrait : utile a la premiere lecture, pas au dela.
   Le tiret separateur est pose en CSS et non dans le PHP : quand le rappel
   passe a la ligne sur petit ecran, un tiret en debut de ligne n aurait
   plus de sens. */
.jr-va-franco__detail {
  color: #6b7280;
  font-weight: 400;
}

.jr-va-franco__detail:before {
  content: ' \2014\00a0';
}

.jr-va-franco__piste {
  position: relative;
  height: 8px;
  background: #e6e8eb;
  border-radius: 4px;
  overflow: hidden;
}

.jr-va-franco__jauge {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: #3b82f6;
  /* La largeur est posee en style inline par PHP. La transition ne sert que
     si un jour la valeur est rafraichie sans rechargement. */
  transition: width .3s ease;
}

.jr-va-franco__note {
  margin-top: 7px;
  font-size: 11px;
  color: #6b7280;
}

/* Palier atteint : vert, une ligne, et on retire la note de bas de bloc.
   Le message disparait de lui-meme de l attention du client, il n a plus
   rien a faire. */
.jr-va-franco--atteint {
  background: #f0faf4;
  border-color: #cdeadb;
}

.jr-va-franco--atteint .jr-va-franco__titre {
  color: #15803d;
  font-weight: 700;
  margin-bottom: 8px;
}

.jr-va-franco--atteint .jr-va-franco__detail {
  color: #4d8968;
  font-weight: 400;
}

.jr-va-franco--atteint .jr-va-franco__jauge {
  background: #2ecc71;
}

/* Variante compacte : bloc panier lateral et popup, ou la place manque. */
.jr-va-franco--compact {
  padding: 9px 11px;
  margin: 8px 0;
  border-radius: 8px;
}

.jr-va-franco--compact .jr-va-franco__titre {
  font-size: 12px;
  margin-bottom: 6px;
}

.jr-va-franco--compact .jr-va-franco__piste {
  height: 6px;
}

/* Sur ecran etroit le rappel du seuil passe a la ligne plutot que de
   comprimer le montant restant, qui est l information utile. */
@media (max-width: 600px) {
  .jr-va-franco__detail {
    display: block;
  }

  .jr-va-franco__detail:before {
    content: '';
  }
}


/* =========================================================================
   Volet lateral apres ajout au panier (lot 3)
   Rendu par jr_va_volet() (includes/functions/vente_additionnelle.php),
   anime par includes/javascript/vente_additionnelle.js.
   ========================================================================= */

.jr-va-volet {
  position: fixed;
  inset: 0;
  z-index: 10000;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  pointer-events: none;
}

.jr-va-volet[hidden] { display: none; }

/* Les widgets Trusted Shops sont au z-index maximal (2147483647) : impossible
   de passer dessus, on les masque le temps que le volet est ouvert (display :
   leurs elements internes forcent visibility:visible). Le
   bandeau cookies (z-index 10050) reste, lui, au-dessus du voile. */
body.jr-va-volet-ouvert [id^="trustbadge-container"],
body.jr-va-volet-ouvert .ts-stars-fullBar { display: none !important; }

/* Voile tres leger : la page reste lisible ; un clic dessus ferme le volet */
.jr-va-volet__fond {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.18);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: auto;
}

.jr-va-volet__panneau {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 20px 22px;
  background: #fff;
  box-shadow: -8px 0 30px rgba(16, 24, 40, 0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
  outline: none;
  color: #1a1a2e;
}

.jr-va-volet.is-ouvert .jr-va-volet__fond { opacity: 1; }
.jr-va-volet.is-ouvert .jr-va-volet__panneau { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .jr-va-volet__fond,
  .jr-va-volet__panneau { transition: none; }
}

.jr-va-volet__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jr-va-volet__titre {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.jr-va-volet__coche {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e8e3e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 14px 14px;
}

.jr-va-volet__fermer {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b6f78;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.jr-va-volet__fermer:hover { background: #f0f0f3; color: #1a1a2e; }

.jr-va-volet__produit {
  display: flex;
  gap: 12px;
  align-items: center;
}

.jr-va-volet__produit img {
  flex: none;
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #ececef;
  border-radius: 8px;
  background: #fff;
}

.jr-va-volet__nom {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.jr-va-volet__qte {
  margin-top: 2px;
  font-size: 12.5px;
  color: #6b6f78;
}

.jr-va-volet__panier {
  font-size: 13.5px;
  color: #3d4048;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.jr-va-volet .jr-va-franco { margin: 0; }

/* Les deux boutons au meme niveau, meme taille ; "Commander" a droite */
.jr-va-volet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.jr-va-volet__bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 8px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  white-space: nowrap;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.jr-va-volet__bouton--continuer {
  background: #fff;
  color: #1a1a2e;
  border: 2px solid #1a1a2e;
}

.jr-va-volet__bouton--continuer:hover { background: #f4f4f6; }

.jr-va-volet__bouton--commander,
.jr-va-volet__bouton--commander:visited {
  background: #e8194f;
  color: #fff;
  border: 2px solid #e8194f;
}

.jr-va-volet__bouton--commander:hover { background: #c01640; border-color: #c01640; color: #fff; }

.jr-va-volet__bouton:focus-visible {
  outline: 3px solid rgba(232, 25, 79, 0.35);
  outline-offset: 2px;
}

.jr-va-volet__memo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #6b6f78;
  cursor: pointer;
}

.jr-va-volet__memo input { margin: 0; accent-color: #e8194f; }
