/* Spliff — Popup « Recharge » AVANT l'ajout au panier (feature recharge-upsell)
 *
 * Desktop : carte centrée (fade + scale). Mobile : bottom-sheet (slide-up).
 * Les boutons forcent leurs fonds en !important sur hover/focus/active : les
 * thèmes (Astra…) peignent les <button> au survol — même défense que les
 * autres modules Spliff. */

.spliff-rup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.spliff-rup[hidden] {
    display: none;
}
.spliff-rup *,
.spliff-rup *::before,
.spliff-rup *::after {
    box-sizing: border-box;
}

/* Scroll de fond verrouillé tant que la popup est ouverte (posé par le JS). */
html.spliff-rup-lock {
    overflow: hidden;
}

.spliff-rup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 16, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.spliff-rup.is-open .spliff-rup__overlay {
    opacity: 1;
}

.spliff-rup__card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: #FFFFFF;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
    outline: none;
    opacity: 0;
    transform: scale(0.96) translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    /* Typo D.A. déclarée EXPLICITEMENT : la popup vit en wp_footer, HORS des
       conteneurs Elementor → sans ça elle hérite des règles du thème (le h3
       du titre tombait sur Outfit). Syne PARTOUT dans la popup ; la famille
       est déjà @font-face site-wide (graisse variable). */
    font-family: 'Syne', sans-serif;
}

/* Les <button> n'héritent PAS de la police (défaut UA) → on force l'héritage
   sur tous les interactifs de la popup (même défense que les autres modules). */
.spliff-rup button {
    font-family: inherit;
}

/* Le titre (h3) et l'aide (p) matchent les règles ÉLÉMENT du thème (h3/p),
   qui battent l'héritage de la carte → Syne re-déclaré explicitement. */
.spliff-rup .spliff-rup__title,
.spliff-rup .spliff-rup__help {
    font-family: 'Syne', sans-serif;
}
.spliff-rup.is-open .spliff-rup__card {
    opacity: 1;
    transform: none;
}

.spliff-rup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #F4F4F4 !important;
    color: #0F0F10 !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}
.spliff-rup__close:hover,
.spliff-rup__close:focus,
.spliff-rup__close:active {
    background: #E8E8E8 !important;
    color: #0F0F10 !important;
    box-shadow: none !important;
    outline: none !important;
}

.spliff-rup__title {
    /* pleine largeur — la croix flotte en absolu au coin, le titre passe dessous */
    margin: 4px 0 16px;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.2;
    color: #0F0F10;
}

.spliff-rup__product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #F7F7F8;
}
.spliff-rup__product img,
.spliff-rup__img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    background: #EFEFEF;
    flex-shrink: 0;
}
.spliff-rup__info {
    min-width: 0;
}
.spliff-rup__name {
    font-size: 15px;
    font-weight: 700;
    color: #0F0F10;
    line-height: 1.25;
}

/* ── Grille pack (recharge avec pack-mix) : cartes ×1/×2/×3+ ── */
.spliff-rup__packs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 8px;
    margin-top: 16px;
}
.spliff-rup__pack {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 8px 12px;
    border: 1.5px solid #E4E4E7;
    border-radius: 10px;
    background: #FFFFFF !important;
    color: #0F0F10 !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.spliff-rup__pack:hover,
.spliff-rup__pack:focus {
    border-color: #3D5BFF;
    background: #FFFFFF !important;
    color: #0F0F10 !important;
    box-shadow: none !important;
    outline: none !important;
}
.spliff-rup__pack:focus-visible {
    outline: 2px solid #3D5BFF !important;
    outline-offset: 2px;
}
.spliff-rup__pack.is-selected,
.spliff-rup__pack.is-selected:hover,
.spliff-rup__pack.is-selected:focus {
    border-color: #3D5BFF;
    background: #EEF1FF !important;
    color: #0F0F10 !important;
}
.spliff-rup__pack-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 9px;
    border-radius: 10px;
    background: #0F0F10;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
}
.spliff-rup__pack.is-selected .spliff-rup__pack-badge {
    background: #3D5BFF;
}
.spliff-rup__pack-qty {
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}
.spliff-rup__pack-prices {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 11px;
    line-height: 1;
}
.spliff-rup__pack-prices del {
    color: #9A9A9E;
    font-weight: 500;
}
.spliff-rup__pack-prices strong {
    font-weight: 700;
    color: #3D5BFF;
}

/* Ligne d'aide du mode mix (« Sélectionner X goûts. » / « Bravo… ») */
.spliff-rup__help {
    margin: 10px 2px 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #6B6B70;
}
.spliff-rup__help.is-nudge {
    animation: spliffRupNudge 0.3s ease;
    color: #3D5BFF;
}
@keyframes spliffRupNudge {
    0%, 100% { transform: translateX(0); }
    30%      { transform: translateX(-4px); }
    60%      { transform: translateX(4px); }
}

/* Badge compteur sur une tuile en mode mix */
.spliff-rup__vbadge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 10px;
    background: #3D5BFF;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}
.spliff-rup__vbadge[hidden] {
    display: none;
}
.spliff-rup__variant {
    position: relative;
}
.spliff-rup__variant.has-count {
    border-color: #3D5BFF;
    background: #EEF1FF !important;
}
/* En mode mix, la grille de tuiles laisse dépasser les badges */
.spliff-rup.is-mix .spliff-rup__variants {
    padding-top: 7px;
    overflow: visible;
    max-height: none;
}

/* Total live sur le bouton d'ajout (+ total non remisé barré en petit) */
.spliff-rup__add-total {
    font-weight: 800;
    white-space: pre;
}
.spliff-rup__add-total del {
    /* taille FIXE : le prix barré ne suit pas la réduction du bouton */
    font-size: 12px;
    font-weight: 600;
    opacity: 0.72;
    text-decoration: line-through;
}

/* ── Tuiles de variations (recharge variable) — sélection façon radio ── */
.spliff-rup__variants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin-top: 14px;
    max-height: 184px; /* ~3 rangées, puis scroll */
    overflow-y: auto;
    scrollbar-width: thin;
}
.spliff-rup__variant {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 8px;
    border: 1.5px solid #E4E4E7;
    border-radius: 10px;
    background: #FFFFFF !important;
    color: #0F0F10 !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.spliff-rup__variant:hover,
.spliff-rup__variant:focus {
    border-color: #3D5BFF;
    background: #FFFFFF !important;
    color: #0F0F10 !important;
    box-shadow: none !important;
    outline: none !important;
}
.spliff-rup__variant:focus-visible {
    outline: 2px solid #3D5BFF !important;
    outline-offset: 2px;
}
.spliff-rup__variant.is-selected,
.spliff-rup__variant.is-selected:hover,
.spliff-rup__variant.is-selected:focus {
    border-color: #3D5BFF;
    background: #EEF1FF !important;
    color: #0F0F10 !important;
}
.spliff-rup__variant-price {
    font-size: 12px;
    font-weight: 700;
    color: #3D5BFF;
}

.spliff-rup__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.spliff-rup__add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: 10px;
    background: #3D5BFF !important;
    color: #FFFFFF !important;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.spliff-rup__add:hover,
.spliff-rup__add:focus {
    background: #2F49E0 !important;
    color: #FFFFFF !important;
    box-shadow: none !important;
    outline: none !important;
}
.spliff-rup__add:active {
    transform: scale(0.985);
}
.spliff-rup__add.is-loading {
    /* feedback bref pendant que la soumission/navigation repart */
    opacity: 0.65;
    pointer-events: none;
}

/* ── Mobile : bottom-sheet ── */
@media (max-width: 767px) {
    .spliff-rup {
        align-items: flex-end;
        padding: 0;
    }
    .spliff-rup__card {
        max-width: 100%;
        border-radius: 10px 10px 0 0;
        padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        transform: translateY(28px);
    }
    .spliff-rup.is-open .spliff-rup__card {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spliff-rup__overlay,
    .spliff-rup__card,
    .spliff-rup__add {
        transition: none;
    }
}
