/* =====================================================================
   Popup « Choisir une option » (templates/shop/_variant_picker.html.twig),
   ouverte par le « + » d'une carte produit à plusieurs variantes
   (assets/js/cart.js). Ordinateur : fenêtre centrée ; mobile : panneau
   remontant du bas de l'écran.
   ===================================================================== */

body.variant-picker-open {
    overflow: hidden;
}

.variant-picker {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.variant-picker__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    animation: variant-picker-fade .2s ease;
}

.variant-picker__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 72rem;
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    border-radius: 1.6rem;
    background: #fff;
    box-shadow: 0 2.4rem 6rem rgba(15, 23, 42, .25);
    outline: none;
    animation: variant-picker-in .22s ease;
}

.variant-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.6rem;
    padding: 2rem 2.4rem;
    border-bottom: 1px solid #eceef2;
}

.variant-picker__title {
    margin: 0;
    color: #1d2433;
    font-size: 2rem;
    font-weight: 700;
}

.variant-picker__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.6rem;
    height: 3.6rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #1d2433;
    font-size: 1.6rem;
    cursor: pointer;
    transition: background-color .2s ease;
}

.variant-picker__close:hover,
.variant-picker__close:focus-visible {
    background: #f3f4f7;
}

.variant-picker__body {
    display: grid;
    grid-template-columns: 22rem 1fr;
    gap: 2.4rem;
    padding: 2.4rem;
    overflow-y: auto;
}

.variant-picker__media {
    margin: 0;
}

.variant-picker__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 1rem;
    background: #f5f6f8;
}

.variant-picker__info {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-width: 0;
}

.variant-picker__name {
    color: #1d2433;
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 1.4;
}

.variant-picker__name:hover {
    color: #F78116;
}

.variant-picker__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .4rem 1rem;
}

.variant-picker__price .new-price {
    color: #1d2433;
    font-size: 2rem;
    font-weight: 700;
    text-decoration: none;
}

.variant-picker__price .old-price {
    color: #8a91a1;
    font-size: 1.4rem;
}

.variant-picker__discount {
    padding: .2rem .7rem;
    border-radius: .4rem;
    background: #e5322a;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.variant-picker__unavailable {
    margin: 0;
    color: #8a91a1;
    font-size: 1.4rem;
}

.variant-picker__options {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
}

.variant-picker__option {
    position: relative;
    min-height: 4rem;
    padding: .8rem 1.8rem;
    border: 1px solid #d5d8df;
    border-radius: 999px;
    background: #fff;
    color: #1d2433;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.variant-picker__option:hover:not(:disabled) {
    border-color: #1d2433;
}

.variant-picker__option.is-selected {
    border-color: #1d2433;
    background: #f5f6f8;
    box-shadow: inset 0 0 0 1px #1d2433;
}

/* Option déjà en panier : petite pastille orange. */
.variant-picker__option.is-in-cart::after {
    content: "";
    position: absolute;
    top: -.2rem;
    right: -.2rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #F78116;
}

.variant-picker__option:disabled {
    color: #a6abb7;
    text-decoration: line-through;
    cursor: not-allowed;
    background: #f7f8fa;
}

.variant-picker__qty[hidden],
.variant-picker__price[hidden] {
    display: none;
}

.variant-picker__footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    padding: 1.6rem 2.4rem 2.4rem;
}

.variant-picker__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 4.8rem;
    padding: 1rem 2rem;
    border: 1px solid #1d2433;
    border-radius: 999px;
    background: #fff;
    color: #1d2433;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.variant-picker__btn--ghost:hover,
.variant-picker__btn--ghost:focus-visible {
    background: #f3f4f7;
}

.variant-picker__btn--primary {
    border-color: #F78116;
    background: #F78116;
    color: #fff;
}

.variant-picker__btn--primary:hover,
.variant-picker__btn--primary:focus-visible {
    border-color: #e06d05;
    background: #e06d05;
    color: #fff;
}

.variant-picker__btn--primary.is-disabled {
    border-color: #eceef2;
    background: #eceef2;
    color: #a6abb7;
    cursor: not-allowed;
}

@keyframes variant-picker-fade {
    from { opacity: 0; }
}

@keyframes variant-picker-in {
    from { opacity: 0; transform: translateY(1.2rem) scale(.98); }
}

/* Mobile : panneau en bas de l'écran, image réduite à côté du nom. */
@media (max-width: 575.98px) {
    .variant-picker {
        align-items: flex-end;
        padding: 0;
    }

    .variant-picker__dialog {
        max-width: none;
        max-height: 90vh;
        border-radius: 1.6rem 1.6rem 0 0;
    }

    .variant-picker__header {
        padding: 1.6rem;
    }

    .variant-picker__title {
        font-size: 1.8rem;
    }

    .variant-picker__body {
        grid-template-columns: 9rem 1fr;
        gap: 1.4rem;
        padding: 1.6rem;
    }

    .variant-picker__name {
        font-size: 1.4rem;
    }

    .variant-picker__footer {
        gap: .8rem;
        padding: 1.2rem 1.6rem 1.6rem;
    }

    .variant-picker__btn {
        min-height: 4.4rem;
        padding: .8rem 1rem;
        font-size: 1.4rem;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .variant-picker__overlay,
    .variant-picker__dialog {
        animation: none;
    }
}
