/* ==========================================================================
   BLOOP — Panier / récap live [bloop_panier]
   Fichier : bloop_inc/bloop_panier_en_cours/bloop_panier_en_cours.css
   Va avec : bloop_panier_en_cours.php + bloop_panier_en_cours.js (même dossier)

   Une seule case contrastée, de haut en bas :
   titre + nb de cookies → détail → prix → barre de réduction → bouton → erreur.
   La barre se masque toute seule si le produit n'a pas de paliers
   (ex. mini cookies, box Best-sellers).

   La grille de cookies (gauche) reste dans bloop_css/bloop_woo_shop.css.
   ========================================================================== */

.bloop-panier {
  background: var(--main-light-contrast);
  border-radius: 22px;
  padding: 30px 20px;
  color: var(--noir, #1e1e1e);
}

/* Rouge réservé à : nb de cookies, prix, barre, bouton, erreurs.
   Tout le reste en noir. */

/* ---- Titre : "Cookies classiques : 18 cookies" ---- */

.bloop-panier-titre {
  font-family: "Modeco - SemiBold";
  font-size: 22px;
  line-height: 1.3;
  color: var(--main-darker);
  margin: 0 0 10px;
  padding: 0;
  letter-spacing: -0.5px;
}
.bloop-panier-titre-qty {
  color: var(--main-darker);
}

/* ---- Détail de la box ---- */
.bloop-panier-list {
  list-style: none;
  margin: 0;
  padding: 0 !important;
  font-size: 14px;
  line-height: 1.4;
  color: var(--noir, #1e1e1e);
  opacity: 0.8;
}
.bloop-panier-list li {
  list-style: none;
  padding: 2px 0;
}
.bloop-panier-empty-hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--noir, #1e1e1e);
  opacity: 0.65;
  margin: 0;
  padding: 0;
}

/* ---- Prix ---- */
.bloop-panier-prix {
  /* font-weight: 700; */
  font-size: 26px;
  line-height: 1.2;
  color: var(--main-darker);
  margin: 18px 0 12px;
  padding: 0;
  font-family: "Modeco - SemiBold";
}

/* ---- Barre de réduction ---- */
.bloop-panier-reduc {
  margin-bottom: 18px;
}
.bloop-panier-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--main-darker) 15%, transparent);
  margin-bottom: 8px;
}
.bloop-panier-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--main-darker);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.bloop-panier-hint {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--noir, #1e1e1e);
  margin: 0;
  padding: 0;
  min-height: 1em; /* évite que le bouton "saute" quand le message apparaît/disparaît */
}

/* ---- Bouton "Ajouter au panier" ---- */
.bloop-panier .bloop-add-to-cart-btn {
  display: block;
  width: 100%;
  background: var(--main-dark);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  white-space: nowrap;
}
.bloop-panier .bloop-add-to-cart-btn.is-disabled,
.bloop-panier .bloop-add-to-cart-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Message d'erreur (+ messages mini cookies / sans gluten insérés juste avant) ---- */
/* !important : les scripts mini cookies / sans gluten posent leurs styles en inline */
.bloop-panier .bloop-panier-error,
.bloop-panier .prelude-mini-notice,
.bloop-panier .prelude-gf-notice {
  color: var(--main-dark) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  text-align: center;
  margin: 12px 0 0 !important;
  padding: 0 !important;
}

/* ==========================================================================
   MOBILE — Barre récap en bas d'écran + panneau qui remonte
   (éléments créés par le JS, section 4 de bloop_panier_en_cours.js)
   - Barre : visible dès le 1er cookie, cachée quand le vrai panier est à l'écran
   - Tap sur la barre : le vrai panier [bloop_panier] remonte dans un panneau
   - Fermeture : tap sur le fond, glisser vers le bas, ou Échap
   Rien n'apparaît sur ordinateur (le JS ne l'active que ≤ 980 px).
   ========================================================================== */

:root {
  --bl-pn-bar-bg: var(--main-dark, #911517);  /* fond de la barre */
  --bl-pn-bar-text: #fff;                     /* texte de la barre */
  --bl-pn-sheet-bg: var(--main-light, #ffeedc); /* fond du panneau */
  --bl-pn-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Barre ---- */
.bl-pn-bar {
  position: fixed !important;
  left: 16px;
  right: 16px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 99990;
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: auto !important;
  margin: 0 !important;
  padding: 14px 18px 14px 20px !important;
  border: none !important;
  border-radius: 999px !important;
  background: var(--bl-pn-bar-bg) !important;
  color: var(--bl-pn-bar-text) !important;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--bl-pn-bar-bg) 35%, transparent);
  font-family: "Modeco - SemiBold", sans-serif;
  font-size: 16px !important;
  line-height: 1.2;
  letter-spacing: 0 !important;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(100% + 30px));
  transition:
    transform 0.45s var(--bl-pn-ease),
    opacity 0.3s ease,
    visibility 0s linear 0.45s;
}
.bl-pn-bar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    transform 0.45s var(--bl-pn-ease),
    opacity 0.3s ease,
    visibility 0s;
}
.bl-pn-bar:active {
  transform: scale(0.98);
}

.bl-pn-bar__count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.bl-pn-bar__num {
  display: inline-block;
  font-size: 18px;
}
.bl-pn-bar__sep {
  opacity: 0.5;
}
.bl-pn-bar__price {
  white-space: nowrap;
}

/* Pastille "−5 %" quand un palier de réduction est atteint */
.bl-pn-bar__badge {
  display: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bl-pn-bar-text);
  color: var(--bl-pn-bar-bg);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.bl-pn-bar.has-discount .bl-pn-bar__badge {
  display: inline-block;
  animation: bl-pn-pop 0.4s var(--bl-pn-ease);
}

/* Flèche à droite */
.bl-pn-bar__arrow {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bl-pn-bar-text) 18%, transparent);
  flex-shrink: 0;
}
.bl-pn-bar__arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Liseré de progression vers le prochain palier (en bas de la pilule) */
.bl-pn-bar__progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bl-pn-bar-text) 22%, transparent);
  overflow: hidden;
  display: none;
}
.bl-pn-bar.has-tiers .bl-pn-bar__progress {
  display: none;
}
.bl-pn-bar__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--bl-pn-bar-text);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Petit rebond du nombre de cookies à chaque ajout/retrait */
.bl-pn-bar.is-bump .bl-pn-bar__num {
  animation: bl-pn-bump 0.35s var(--bl-pn-ease);
}
@keyframes bl-pn-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes bl-pn-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Fond assombri ---- */
.bl-pn-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99995;
  background: rgba(30, 30, 30, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.bl-pn-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Panneau ---- */
.bl-pn-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99996;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bl-pn-sheet-bg);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  visibility: hidden;
  transition:
    transform 0.45s var(--bl-pn-ease),
    visibility 0s linear 0.45s;
  outline: none;
}
.bl-pn-sheet.is-open {
  transform: none;
  visibility: visible;
  transition:
    transform 0.45s var(--bl-pn-ease),
    visibility 0s;
}
.bl-pn-sheet.is-dragging {
  transition: none;
}

/* Poignée (glisser vers le bas pour fermer) */
.bl-pn-sheet__handle {
  flex-shrink: 0;
  width: 100%;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}
.bl-pn-sheet__handle::before {
  content: "";
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--noir, #1e1e1e) 22%, transparent);
}

.bl-pn-sheet__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Le vrai panier dans le panneau : même look, un peu plus compact */
.bl-pn-sheet .bloop-panier {
  padding: 24px 18px;
}

/* Place gardée à l'emplacement d'origine pendant que le panier est dans le panneau */
.bl-pn-home {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .bl-pn-bar,
  .bl-pn-sheet,
  .bl-pn-backdrop {
    transition: none !important;
  }
  .bl-pn-bar.is-bump .bl-pn-bar__num,
  .bl-pn-bar.has-discount .bl-pn-bar__badge {
    animation: none !important;
  }
}