/* =========================================================================
   Modale « Produit ajouté au panier » — DA MARIE Didier Automobiles
   Couleurs du thème (config.inc.php) : color-1 #202026 / color-2 #e2001a
   color-5 #f8f8f8 / gris #707070. Valeurs en dur (robustes même si les
   variables --wp--preset--color--* venaient à manquer sous WP7).
   Fichier auto-chargé par mp_get_theme_css_files() (glob assets/css/*.css).
   ========================================================================= */

.adm-atc {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.adm-atc[hidden] {
    display: none;
}

/* Voile sombre */
.adm-atc__scrim {
    position: absolute;
    inset: 0;
    background: rgba(32, 32, 38, 0.72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.adm-atc.is-open .adm-atc__scrim {
    opacity: 1;
}

/* Carte blanche (même surface que la fiche produit) */
.adm-atc__dialog {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: calc(100dvh - 2.5rem);
    overflow-y: auto;
    padding: 2.25rem 2rem 2rem;
    background: #fff;
    color: #202026;
    border-radius: 1.25rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
    font-family: "Geologica", sans-serif;
    font-weight: 300;
    opacity: 0;
    transform: translateY(1rem) scale(0.985);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.adm-atc.is-open .adm-atc__dialog {
    opacity: 1;
    transform: none;
}

/* Bouton fermer */
.adm-atc__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background: #f8f8f8;
    border: none;
    border-radius: 50%;
    color: #202026;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.adm-atc__close:hover,
.adm-atc__close:focus-visible {
    background: #e2001a;
    color: #fff;
    outline: none;
}

/* En-tête : icône + titre */
.adm-atc__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}
.adm-atc__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.adm-atc__icon--info {
    width: 56px;
    height: 56px;
    color: #e2001a;
    font-size: 2.6rem;
}
.adm-atc__icon svg {
    width: 56px;
    height: 56px;
    display: block;
}
.adm-atc__icon-ring {
    fill: #e2001a;
    transform-origin: center;
    transform: scale(0);
}
.adm-atc__icon-mark {
    fill: none;
    stroke: #fff;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}
.adm-atc.is-open .adm-atc__icon-ring {
    animation: adm-atc-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.adm-atc.is-open .adm-atc__icon-mark {
    animation: adm-atc-draw 0.4s ease 0.2s forwards;
}
@keyframes adm-atc-pop {
    to { transform: scale(1); }
}
@keyframes adm-atc-draw {
    to { stroke-dashoffset: 0; }
}

/* Bascule succès / déjà présent */
.adm-atc__icon--info { display: none; }
.adm-atc--info .adm-atc__icon--success { display: none; }
.adm-atc--info .adm-atc__icon--info { display: inline-flex; }

.adm-atc__title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: #202026;
}
.adm-atc__subtitle {
    margin: 0;
    font-family: "FigTree", sans-serif;
    font-size: 0.9rem;
    color: #707070;
}
.adm-atc__subtitle:empty { display: none; }

/* Ligne produit (surface claire, comme une ligne du mini-panier) */
.adm-atc__line {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: #f8f8f8;
    border-radius: 1rem;
}
.adm-atc__media {
    flex: 0 0 auto;
    width: 84px;
    height: 84px;
    border-radius: 0.6rem;
    overflow: hidden;
    background: #fff;
}
.adm-atc__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.adm-atc__info {
    flex: 1 1 auto;
    min-width: 0;
}
.adm-atc__brand {
    font-family: "FigTree", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #707070;
    margin-bottom: 0.15rem;
}
.adm-atc__brand:empty { display: none; }
.adm-atc__name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    text-transform: uppercase;
    color: #202026;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.adm-atc__ref {
    margin-top: 0.25rem;
    font-family: "FigTree", sans-serif;
    font-size: 0.8rem;
    color: #707070;
}
.adm-atc__ref:empty { display: none; }
.adm-atc__priceqty {
    flex: 0 0 auto;
    text-align: right;
}
.adm-atc__price {
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1;
    color: #e2001a;
    white-space: nowrap;
}
.adm-atc__price .woocommerce-Price-currencySymbol {
    position: static;
    top: 0;
    font-size: 0.8em;
}
.adm-atc__qty {
    margin-top: 0.35rem;
    font-family: "FigTree", sans-serif;
    font-size: 0.8rem;
    color: #707070;
}
.adm-atc__qty:empty { display: none; }

/* Récapitulatif panier */
.adm-atc__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e6e6e6;
}
.adm-atc__summary-label {
    font-family: "FigTree", sans-serif;
    font-size: 0.9rem;
    color: #202026;
}
.adm-atc__summary-total {
    font-weight: 700;
    font-size: 1.25rem;
    color: #e2001a;
    white-space: nowrap;
}
.adm-atc__summary-total .woocommerce-Price-currencySymbol {
    position: static;
    top: 0;
    font-size: 0.8em;
}

/* Actions */
.adm-atc__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.75rem;
}
.adm-atc__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.1rem;
    border-radius: 2rem;
    font-family: "Geologica", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
}
.adm-atc__btn:active {
    transform: translateY(1px);
}
.adm-atc__btn--ghost {
    background: transparent;
    border: 1.5px solid #202026;
    color: #202026;
}
.adm-atc__btn--ghost:hover,
.adm-atc__btn--ghost:focus-visible {
    background: #202026;
    color: #fff;
    outline: none;
}
.adm-atc__btn--primary {
    background: #e2001a;
    border: 1.5px solid #e2001a;
    color: #fff;
}
.adm-atc__btn--primary:hover,
.adm-atc__btn--primary:focus-visible {
    background: #202026;
    border-color: #202026;
    color: #fff;
    outline: none;
}

/* Verrou de défilement de la page sous la modale */
html.adm-atc-lock {
    overflow: hidden;
}

/* Mobile */
@media (max-width: 480px) {
    .adm-atc__dialog {
        padding: 2rem 1.25rem 1.5rem;
    }
    .adm-atc__actions {
        grid-template-columns: 1fr;
    }
    .adm-atc__btn--primary {
        order: -1;
    }
    .adm-atc__title {
        font-size: 1.2rem;
    }
    .adm-atc__price {
        font-size: 1.3rem;
    }
}
@media (max-width: 360px) {
    .adm-atc__line {
        flex-wrap: wrap;
    }
    .adm-atc__priceqty {
        flex-basis: 100%;
        text-align: left;
    }
}

/* =========================================================================
   Bouton « Ajouter au panier » de la fiche produit lorsque la pièce est
   déjà dans le panier : on passe du rouge (color-2) au gris foncé (color-1)
   avec un libellé explicite. La forte spécificité prime sur buttons.css.
   ========================================================================= */
.product .price-and-cart .cart .single_add_to_cart_button.adm-in-cart {
    background-color: #202026;
    border-color: #202026;
    color: #fff;
}
.product .price-and-cart .cart .single_add_to_cart_button.adm-in-cart i {
    margin-right: 0.4em;
}

/* Accessibilité : mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .adm-atc__scrim,
    .adm-atc__dialog,
    .adm-atc__btn {
        transition: none;
    }
    .adm-atc__dialog {
        transform: none;
    }
    .adm-atc.is-open .adm-atc__icon-ring {
        animation: none;
        transform: scale(1);
    }
    .adm-atc.is-open .adm-atc__icon-mark {
        animation: none;
        stroke-dashoffset: 0;
    }
}
