/*
 * Favoris (bj-buro-core/inc/favoris.php, assets/js/favoris.js), session Fonctionnalités, 01/11/2026.
 * Chargé après bj-buro.css quand les favoris sont actifs. Charte : boutons et champs à 6 px, panneaux à 12 px,
 * jetons de 01-tokens.css. Cœur bleu (couleur d'action), sans fond sur les photos (choix de Lucas du 01/11/2026).
 */

/* ---------- En-tête : une case « Favoris » entre Compte et Panier ---------- */
.bj-header__inner {
  grid-template-columns: auto auto 1fr auto auto auto;
  grid-template-areas: "menu logo . fav account cart" "search search search search search search" "mode mode mode mode mode mode";
}
.bj-header__fav { grid-area: fav; }
.bj-header__fav:has(.bj-favcount:not([hidden])) > .bj-icon { color: var(--bj-action); fill: var(--bj-action); }
@media (min-width: 960px) {
  .bj-header__inner {
    grid-template-columns: auto 1fr auto auto auto auto;
    grid-template-areas: "logo search mode fav account cart";
  }
}
.bj-favcount {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--bj-r-pill);
  background: var(--bj-hl); color: var(--bj-ink);
  border: 1.5px solid var(--bj-action);
  font-size: 11px; font-weight: 800; line-height: 15px; text-align: center;
}
.bj-iconbtn .bj-favcount { position: absolute; top: 4px; right: 2px; }
@media (min-width: 960px) {
  .bj-iconbtn .bj-favcount { position: static; font-size: var(--bj-fs-micro); }
}
.bj-favcount.is-bump { animation: bj-fav-bump 0.4s ease-out; }
@keyframes bj-fav-bump { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* ---------- Cœur d'une carte : petit cœur bleu dans le coin haut droit de la photo, sans fond ---------- */
.bj-fav {
  position: absolute; z-index: 2; top: 2px; right: 2px;
  width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--bj-r-sm); background: none; box-shadow: none;
  color: var(--bj-action);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}
.bj-fav::before { content: ""; position: absolute; inset: -2px; } /* zone tactile de 44 px */
.bj-fav:hover { color: var(--bj-action-hover); }
.bj-fav:hover .bj-fav__icone { transform: scale(1.12); }
.bj-fav:focus-visible { outline: 2px solid var(--bj-focus); outline-offset: -2px; }
.bj-fav__icone { width: 20px; height: 20px; stroke-width: 2; transition: fill 0.15s ease, transform 0.15s ease; }
.bj-fav.is-actif .bj-fav__icone { fill: currentColor; }
.bj-fav.is-pop .bj-fav__icone { animation: bj-fav-pop 0.38s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes bj-fav-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.bj-card__badges { right: 44px; } /* les pastilles ne passent pas sous le cœur */
/* Vue liste (mobile par défaut) : photo étroite, cœur en bas à droite de la photo */
html[data-bj-vue="liste"] .bj-grid--produits .bj-fav { top: auto; bottom: -4px; right: -6px; width: 36px; height: 36px; }
html[data-bj-vue="liste"] .bj-grid--produits .bj-fav__icone { width: 18px; height: 18px; }
html[data-bj-vue="liste"] .bj-grid--produits .bj-card__badges { right: 0; }

/* ---------- Fiche produit : bouton texte sous l'ajout au panier ---------- */
.bj-fav-fiche { display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--bj-s-4); margin-top: var(--bj-s-2); }
.bj-fav--texte {
  position: static; width: auto; height: auto; min-height: var(--bj-tap); padding: 0 var(--bj-s-1) 0 0;
  gap: var(--bj-s-2); background: none; box-shadow: none;
  color: var(--bj-ink-2); font: inherit; font-size: var(--bj-fs-sm); font-weight: 700;
}
.bj-fav--texte::before { display: none; }
.bj-fav--texte:hover { background: none; color: var(--bj-ink); }
.bj-fav--texte:hover .bj-fav__libelle { text-decoration: underline; }
.bj-fav--texte .bj-fav__icone { color: var(--bj-action); }
.bj-fav--texte:hover .bj-fav__icone { transform: none; }
.bj-fav--texte.is-actif { color: var(--bj-ink); }
.bj-fav-fiche__voir { display: inline-flex; align-items: center; gap: 4px; min-height: var(--bj-tap); font-size: var(--bj-fs-sm); font-weight: 700; color: var(--bj-action); }
.bj-fav-fiche--epuise { margin-top: var(--bj-s-4); padding: var(--bj-s-3) var(--bj-s-4); background: var(--bj-tint); border-radius: var(--bj-r-md); }
.bj-fav-fiche__aide { flex-basis: 100%; margin: 0; font-size: var(--bj-fs-sm); color: var(--bj-ink-2); }

/* ---------- Panier : « Mettre de côté » et rappel des favoris ---------- */
.bj-ligne__cote {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px;
  margin-top: 2px; padding: 4px 0;
  font-size: var(--bj-fs-xs); font-weight: 700; color: var(--bj-muted); text-decoration: none;
}
.bj-ligne__cote span { white-space: nowrap; }
.bj-ligne__cote:hover { color: var(--bj-action); }
.bj-ligne__cote:hover span { text-decoration: underline; }

.bj-fav-rappel { margin-top: var(--bj-s-6); padding: var(--bj-s-4); background: var(--bj-paper); border: var(--bj-b-hair); border-radius: var(--bj-r-md); }
.bj-fav-rappel__tete { display: flex; justify-content: space-between; align-items: baseline; gap: var(--bj-s-3); margin-bottom: var(--bj-s-3); }
.bj-fav-rappel__titre { display: flex; align-items: center; gap: var(--bj-s-2); margin: 0; font-size: var(--bj-fs-body); font-weight: 800; }
.bj-fav-rappel__titre .bj-icon { color: var(--bj-action); fill: var(--bj-action); }
.bj-fav-rappel__tout { display: inline-flex; align-items: center; gap: 4px; font-size: var(--bj-fs-sm); font-weight: 700; white-space: nowrap; }
.bj-fav-rappel__liste {
  display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: var(--bj-s-3);
  margin: 0; padding: 0 0 var(--bj-s-1); list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
}
.bj-fav-rappel__item { scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bj-fav-rappel__media { display: block; aspect-ratio: 1 / 1; padding: var(--bj-s-2); background: var(--bj-paper); border: var(--bj-b-hair); border-radius: var(--bj-r-sm); }
.bj-fav-rappel__media img { width: 100%; height: 100%; object-fit: contain; }
.bj-fav-rappel__nom {
  font-size: var(--bj-fs-xs); font-weight: 700; line-height: var(--bj-lh-snug); color: var(--bj-ink); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.bj-fav-rappel__nom:hover { text-decoration: underline; }
.bj-fav-rappel__prix { margin: 0; font-size: var(--bj-fs-sm); font-weight: 800; font-variant-numeric: tabular-nums; }
.bj-fav-rappel__ajout { margin-top: auto; width: 100%; justify-content: center; }
@media (min-width: 720px) { .bj-fav-rappel__liste { grid-auto-columns: 30%; } }
@media (min-width: 960px) {
  .bj-fav-rappel { padding: var(--bj-s-5); }
  .bj-fav-rappel__liste { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: visible; }
}

/* ---------- Message de confirmation : cœur bleu, bouton « Annuler » ---------- */
.bj-toast svg:has(use[href="#i-heart"]) { stroke: var(--bj-action); fill: var(--bj-action); }
.bj-toast__action {
  margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--bj-action); font: inherit; font-weight: 800; text-decoration: underline; white-space: nowrap;
}

/* ---------- Page Mes favoris ---------- */
.bj-fp { padding-bottom: var(--bj-s-8); }
.bj-fp__tete { margin: var(--bj-s-3) 0 var(--bj-s-4); }
.bj-fp__titre { display: flex; align-items: center; gap: 10px; margin: 0; }
.bj-fp__nombre {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: var(--bj-r-sm); background: var(--bj-tint); color: var(--bj-action);
  font-family: var(--bj-font-text); font-size: 16px; font-weight: 800; letter-spacing: 0;
}
.bj-fp__sous { display: flex; align-items: flex-start; gap: 6px; margin: var(--bj-s-2) 0 0; font-size: var(--bj-fs-sm); color: var(--bj-ink-2); }
.bj-fp__sous .bj-icon { flex: none; margin-top: 1px; color: var(--bj-action); }
.bj-fp input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--bj-action); cursor: pointer; }
.bj-fp input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.4; }

.bj-fp__outils {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 var(--bj-s-3);
  padding: var(--bj-s-1) var(--bj-s-4); background: var(--bj-paper);
  border: var(--bj-b-hair); border-bottom: 0; border-radius: var(--bj-r-md) var(--bj-r-md) 0 0;
}
.bj-fp__tout { display: inline-flex; align-items: center; gap: var(--bj-s-3); min-height: var(--bj-tap); font-size: var(--bj-fs-sm); font-weight: 700; cursor: pointer; }
.bj-fp__aide { margin: 0; font-size: var(--bj-fs-xs); color: var(--bj-muted); }

.bj-fp__liste { margin: 0; padding: 0; list-style: none; background: var(--bj-paper); border: var(--bj-b-hair); border-radius: 0 0 var(--bj-r-md) var(--bj-r-md); }
.bj-fp__ligne {
  display: grid; gap: var(--bj-s-2) var(--bj-s-3);
  grid-template-columns: 20px 72px minmax(0, 1fr) 32px;
  grid-template-areas: "case media infos retirer" "case achat achat achat";
  padding: var(--bj-s-4); border-top: var(--bj-b-hair);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bj-fp__ligne:first-child { border-top: 0; }
.bj-fp__ligne.is-sortie { opacity: 0; transform: translateX(12px); }
.bj-fp__case { grid-area: case; display: flex; align-items: flex-start; padding-top: 26px; }
.bj-fp__media { grid-area: media; width: 72px; height: 72px; display: flex; padding: 4px; background: var(--bj-paper); border: var(--bj-b-hair); border-radius: var(--bj-r-sm); }
.bj-fp__media img { width: 100%; height: 100%; object-fit: contain; }
.bj-fp__ligne.is-indispo .bj-fp__media img { opacity: 0.55; }
.bj-fp__infos { grid-area: infos; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.bj-fp__marque { margin: 0; font-size: var(--bj-fs-micro); color: var(--bj-muted); }
.bj-fp__nom {
  font-size: var(--bj-fs-sm); font-weight: 700; line-height: var(--bj-lh-snug); color: var(--bj-ink); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bj-fp__nom:hover { text-decoration: underline; }
@media (min-width: 960px) { .bj-fp__nom { -webkit-line-clamp: 2; } }
.bj-fp__prix { margin: 2px 0 0; font-size: var(--bj-fs-xs); color: var(--bj-ink-2); }
.bj-fp__prix strong { font-size: 16px; font-weight: 800; letter-spacing: var(--bj-ls-price); color: var(--bj-ink); font-variant-numeric: tabular-nums; }
.bj-fp__palier { display: block; font-weight: 700; color: var(--bj-stock); }
.bj-fp__baisse { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 0; padding: 2px 6px; border-radius: var(--bj-r-xs); background: #E3F2E9; color: var(--bj-stock); font-size: var(--bj-fs-xs); font-weight: 700; }
.bj-fp__dispo { margin: 0; font-size: var(--bj-fs-xs); color: var(--bj-ink-2); }
.bj-fp__dispo.is-stock { color: var(--bj-stock); font-weight: 700; }
.bj-fp__dispo.is-low { color: var(--bj-promo); font-weight: 700; }
.bj-fp__au-panier { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: var(--bj-fs-xs); font-weight: 700; color: var(--bj-action); }
.bj-fp__achat { grid-area: achat; display: flex; flex-wrap: wrap; align-items: center; gap: var(--bj-s-2) var(--bj-s-3); }
.bj-fp__form { display: flex; align-items: center; gap: var(--bj-s-2); margin: 0; }
.bj-fp__ajout { min-height: var(--bj-tap); white-space: nowrap; }
.bj-fp__total { margin: 0; font-size: var(--bj-fs-xs); font-weight: 700; color: var(--bj-ink-2); font-variant-numeric: tabular-nums; }
.bj-fp__retirer { grid-area: retirer; align-self: start; margin: -10px -10px 0 0; color: var(--bj-muted); }
.bj-fp__retirer:hover { color: var(--bj-danger); }
.bj-fp__note { margin: var(--bj-s-3) 0 0; font-size: var(--bj-fs-micro); color: var(--bj-muted); }
@media (min-width: 960px) {
  .bj-fp__ligne {
    grid-template-columns: 20px 88px minmax(0, 1fr) auto 44px;
    grid-template-areas: "case media infos achat retirer";
    align-items: center; padding: var(--bj-s-4) var(--bj-s-5);
  }
  .bj-fp__outils { padding: var(--bj-s-1) var(--bj-s-5); }
  .bj-fp__case { padding-top: 0; align-items: center; }
  .bj-fp__media { width: 88px; height: 88px; }
  .bj-fp__achat { flex-direction: column; align-items: flex-end; }
  .bj-fp__retirer { margin: 0; align-self: center; }
}

/* Barre de la sélection : toujours visible en bas de l'écran pendant la lecture de la liste */
.bj-fp__barre {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--bj-s-3) var(--bj-s-5);
  margin-top: var(--bj-s-4); padding: var(--bj-s-3) var(--bj-s-4);
  background: var(--bj-paper); border: var(--bj-b-hair); border-radius: var(--bj-r-md); box-shadow: var(--bj-shadow-md);
}
.bj-fp__barre-texte { min-width: 0; }
.bj-fp__barre-total { margin: 0; font-size: var(--bj-fs-sm); color: var(--bj-ink-2); }
.bj-fp__barre-total strong, .bj-fp__barre-total [data-mode] { color: var(--bj-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.bj-fp__barre-livraison { margin: 2px 0 0; font-size: var(--bj-fs-xs); color: var(--bj-ink-2); }
.bj-fp__barre-livraison:empty { display: none; }
.bj-fp__barre-livraison.is-atteinte { color: var(--bj-stock); font-weight: 700; }
.bj-fp__barre-bouton { flex: none; gap: var(--bj-s-2); }
.bj-fp__barre-bouton:disabled { opacity: 0.45; cursor: not-allowed; }
.bj-fp__barre-panier { background: var(--bj-stock); border-color: var(--bj-stock); }
.bj-fp__barre-panier:hover { background: #17633A; border-color: #17633A; }
body:has(.bj-fp__barre:not([hidden])) .bj-toast { bottom: calc(var(--bj-s-4) + 92px); }
@media (max-width: 599px) {
  .bj-fp__barre {
    flex-direction: column; align-items: stretch;
    margin: var(--bj-s-4) calc(-1 * var(--bj-gutter)) 0; padding: var(--bj-s-3) var(--bj-gutter) calc(var(--bj-s-3) + env(safe-area-inset-bottom));
    border-left: 0; border-right: 0; border-radius: var(--bj-r-md) var(--bj-r-md) 0 0;
  }
  .bj-fp__barre-bouton { width: 100%; justify-content: center; }
  body:has(.bj-fp__barre:not([hidden])) .bj-toast { bottom: calc(var(--bj-s-4) + 128px); }
}

/* Page vide */
.bj-fp__vide { max-width: 520px; margin: var(--bj-s-6) auto; padding: var(--bj-s-8) var(--bj-s-6); text-align: center; background: var(--bj-paper); border: var(--bj-b-hair); border-radius: var(--bj-r-md); }
.bj-fp__vide-icone { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--bj-tint); color: var(--bj-action); }
.bj-fp__vide-icone .bj-icon { width: 30px; height: 30px; fill: currentColor; }
.bj-fp__vide-titre { margin: var(--bj-s-4) 0 var(--bj-s-2); font-family: var(--bj-font-display); font-size: var(--bj-fs-h2); letter-spacing: var(--bj-ls-display); }
.bj-fp__vide p { margin: 0 auto; max-width: 40ch; color: var(--bj-ink-2); }
.bj-fp__vide-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--bj-s-2); margin-top: var(--bj-s-5); }

@media (prefers-reduced-motion: reduce) {
  .bj-fav.is-pop .bj-fav__icone, .bj-favcount.is-bump { animation: none; }
  .bj-fp__ligne { transition: none; }
}
