/* =====================================================================
   Vitrine (grille type Shein), fiche produit, panier, messages.
   Utilise les couleurs et formes de style.css (variables :root).
   ===================================================================== */

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- En-tête ---------- */
.entete-actions { display: flex; align-items: center; gap: 10px; }
.bouton-panier {
    position: relative; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--ligne-forte); background: var(--surface); color: var(--encre);
    display: grid; place-items: center; cursor: pointer;
}
.bouton-panier:hover { border-color: var(--encre); }
.compteur {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--marque); color: #fff; font-size: 12px; font-weight: 700;
    display: grid; place-items: center;
}

/* ---------- Barre de filtres collée en haut ---------- */
.barre-filtres {
    position: sticky; top: 0; z-index: 20; background: var(--surface);
    border-bottom: 1px solid var(--ligne); padding: 10px 0 0;
}
.rubriques {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.rubriques::-webkit-scrollbar { display: none; }
.puce {
    flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px;
    border: 1px solid var(--ligne-forte); background: var(--surface); color: var(--encre-douce); cursor: pointer;
}
.puce:hover { border-color: var(--encre); }
.puce.active { background: var(--encre); border-color: var(--encre); color: #fff; }

.outils-zone { padding-top: 12px; }
.outils { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.outils .recherche { flex: 1 1 220px; min-width: 0; }
.select-tri select {
    height: 44px; padding: 0 12px; border-radius: var(--rayon-champ); border: 1px solid var(--ligne-forte);
    background: var(--surface); font: inherit; color: var(--encre);
}
.interrupteur { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; color: var(--encre-douce); cursor: pointer; }
.interrupteur input { width: 18px; height: 18px; accent-color: var(--encre); }
.densites { display: inline-flex; gap: 4px; margin-left: auto; }
.densite {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--ligne-forte);
    background: var(--surface); color: var(--discret); display: grid; place-items: center; cursor: pointer;
}
.densite.active { background: var(--encre); border-color: var(--encre); color: #fff; }

/* ---------- Grille : le nombre de colonnes dépend de l'écran ET du choix du client ---------- */
.vitrine-contenu { padding-top: 8px; padding-bottom: 40px; }
.resume { color: var(--discret); font-size: 14px; margin-bottom: 10px; min-height: 1.2em; }

.grille-produits {
    --colonnes: 2;
    display: grid; gap: 10px;
    grid-template-columns: repeat(var(--colonnes), minmax(0, 1fr));
}
/* téléphone : compact 3, moyen 2, grand 1 */
.grille-produits[data-densite="compact"] { --colonnes: 3; gap: 6px; }
.grille-produits[data-densite="grand"] { --colonnes: 1; }
/* tablette */
@media (min-width: 640px) {
    .grille-produits { --colonnes: 3; gap: 14px; }
    .grille-produits[data-densite="compact"] { --colonnes: 4; gap: 10px; }
    .grille-produits[data-densite="grand"] { --colonnes: 2; }
}
/* ordinateur */
@media (min-width: 960px) {
    .grille-produits { --colonnes: 4; gap: 18px; }
    .grille-produits[data-densite="compact"] { --colonnes: 6; gap: 12px; }
    .grille-produits[data-densite="grand"] { --colonnes: 3; }
}
@media (min-width: 1280px) {
    .grille-produits { --colonnes: 5; }
    .grille-produits[data-densite="compact"] { --colonnes: 7; }
    .grille-produits[data-densite="grand"] { --colonnes: 4; }
}

/* ---------- Carte produit ---------- */
.carte-produit { position: relative; background: transparent; }
.cp-ouvrir {
    display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left;
    font: inherit; color: inherit; cursor: pointer;
}
.cp-image {
    position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #E9ECF5;
    border-radius: 12px;
}
.cp-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.cp-ouvrir:hover .cp-image img { transform: scale(1.04); }
.cp-image .sans-photo { width: 100%; height: 100%; display: grid; place-items: center; color: var(--discret); }
.epuise .cp-image img { opacity: .45; filter: grayscale(.6); }
.badge-cp {
    position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.badge-cp.rupture { background: var(--rouge-fond); color: var(--rouge); }
.badge-cp.rare { background: var(--ambre-fond); color: var(--ambre); }
.cp-corps { padding: 8px 2px 0; }
.cp-nom {
    font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--encre-douce);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.6em;
}
.cp-prix { font-weight: 800; font-size: 16px; color: var(--marque); margin-top: 2px; }
.grille-produits[data-densite="compact"] .cp-nom { font-size: 12px; min-height: 2.6em; }
.grille-produits[data-densite="compact"] .cp-prix { font-size: 13px; }

.cp-photo { position: absolute; inset: 0; }
.ajout-rapide {
    position: absolute; right: 8px; bottom: 8px; z-index: 1;
    width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface); color: var(--encre);
    box-shadow: 0 2px 10px rgba(16, 25, 56, .25); display: grid; place-items: center; cursor: pointer;
}
.ajout-rapide:hover { background: var(--encre); color: #fff; }
.grille-produits[data-densite="compact"] .ajout-rapide { width: 32px; height: 32px; right: 6px; bottom: 6px; }

/* Squelettes pendant le chargement */
.squelette .cp-image { animation: pulse 1.2s ease-in-out infinite; }
.squelette .ligne { height: 12px; border-radius: 6px; background: #E9ECF5; margin-top: 8px; animation: pulse 1.2s ease-in-out infinite; }
.squelette .ligne.courte { width: 50%; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .squelette * { animation: none !important; } }

.plus { text-align: center; margin-top: 24px; }

/* ---------- Fenêtres (fiche produit, panier) ---------- */
dialog { border: 0; padding: 0; color: var(--encre); font-family: var(--police); }
dialog::backdrop { background: rgba(16, 25, 56, .55); }

.feuille {
    width: min(920px, 100vw); max-height: 92vh; overflow: auto; background: var(--surface);
    border-radius: 22px 22px 0 0; margin: auto 0 0 0; max-width: 100vw;
}
@media (min-width: 760px) {
    .feuille { margin: auto; border-radius: 22px; }
}
.fermer, .fermer-simple {
    border: 0; background: var(--surface); color: var(--encre); cursor: pointer;
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
}
.fermer { position: absolute; right: 12px; top: 12px; z-index: 2; box-shadow: 0 2px 10px rgba(16, 25, 56, .2); }
.fiche-grille { display: grid; grid-template-columns: 1fr; }
@media (min-width: 760px) { .fiche-grille { grid-template-columns: 1fr 1fr; } }
.fiche-photo { background: #E9ECF5; aspect-ratio: 1 / 1; max-height: 55vh; }
@media (min-width: 760px) { .fiche-photo { aspect-ratio: 3 / 4; max-height: none; } }
.fiche-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fiche-photo .sans-photo { height: 100%; display: grid; place-items: center; color: var(--discret); }
.fiche-infos { padding: 22px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.fiche-infos h2 { font-size: 22px; line-height: 1.25; }
.fiche-prix { font-size: 26px; font-weight: 800; color: var(--marque); }
.fiche-description { color: var(--encre-douce); white-space: pre-line; }
.etiquette { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; margin-top: 6px; }
.fiche-actions .btn { flex: 1 1 140px; }
.lien-discret {
    border: 0; background: none; color: var(--discret); font: inherit; font-weight: 600; cursor: pointer;
    display: inline-flex; gap: 6px; align-items: center; padding: 6px 0;
}
.lien-discret:hover { color: var(--encre); }

.qte {
    display: inline-flex; align-items: center; border: 1px solid var(--ligne-forte); border-radius: 12px; overflow: hidden;
}
.qte button { width: 42px; height: 46px; border: 0; background: var(--surface); color: var(--encre); display: grid; place-items: center; cursor: pointer; }
.qte button:hover { background: var(--fond); }
.qte-valeur { min-width: 36px; text-align: center; font-weight: 700; }
.qte-petite button { width: 32px; height: 32px; }

.tiroir {
    width: 100vw; max-width: 100vw; max-height: 90vh; margin: auto 0 0 0; background: var(--surface);
    border-radius: 22px 22px 0 0; padding: 18px; overflow: auto;
}
@media (min-width: 640px) {
    .tiroir { width: 420px; max-height: 100vh; height: 100vh; margin: 0 0 0 auto; border-radius: 0; }
}
.tiroir-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tiroir-tete h2 { font-size: 20px; }
.lignes-panier { list-style: none; display: grid; gap: 14px; margin-bottom: 16px; }
.lignes-panier li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; }
.lp-photo { width: 64px; height: 80px; border-radius: 10px; overflow: hidden; background: #E9ECF5; display: grid; place-items: center; color: var(--discret); }
.lp-photo img { width: 100%; height: 100%; object-fit: cover; }
.lp-infos { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.lp-infos strong { font-size: 14px; overflow-wrap: anywhere; }
.lp-prix { color: var(--marque); font-weight: 700; font-size: 14px; }
.retirer { border: 0; background: none; color: var(--discret); cursor: pointer; padding: 8px; }
.retirer:hover { color: var(--rouge); }
.total-panier { display: flex; justify-content: space-between; font-size: 18px; margin-bottom: 4px; }
.tiroir-form { display: grid; gap: 14px; }
.merci { display: grid; gap: 14px; }

/* ---------- Messages ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 100; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--encre); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(16, 25, 56, .3); }
.toast-erreur { background: var(--rouge); }
