/* =========================================================
 * YOOZI HOME CART — 2026-07-07 (demande Mathieu)
 * Bouton "AJOUTER" premium + prix "l'unité" sous chaque produit
 * de la page d'accueil, avec animation d'ajout au panier.
 * Injecté par assets/yoozi-home-cart.js. Palette : couche Mathieu.
 * ========================================================= */

/* --- Ligne prix + bouton (bas de carte) --- */
.yoozi-product-card .yoozi-home-buy {
    display: flex;
    align-items: center;
    justify-content: center;   /* prix + bouton centrés en groupe */
    gap: 20px;
    width: 100%;               /* pleine largeur de la carte (sinon rétréci à gauche par la grille) */
    align-self: stretch;
    box-sizing: border-box;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--y-line, #e5e0d6);
    /* Entrée douce à l'injection */
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .5s ease, transform .5s ease;
}
.yoozi-product-card .yoozi-home-buy.is-visible {
    opacity: 1;
    transform: none;
}

/* --- Prix --- */
.yoozi-home-buy .yoozi-home-price {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 20px;
    line-height: 1.1;
    color: var(--y-ink, #1a1a1a);
    white-space: nowrap;
}
.yoozi-home-buy .yoozi-home-price .woocommerce-Price-amount {
    font-weight: 800;
    color: var(--y-ink, #1a1a1a);
}
.yoozi-home-buy .yoozi-price-unit {
    display: inline-block;
    margin-left: 7px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--y-grey, #7a7a7a);
}

/* --- Bouton doré premium --- */
.yoozi-add-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-width: 132px;
    padding: 14px 28px;
    background: var(--y-gold, #C8A96E);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
    border: 0;
    border-radius: 0;   /* carré, comme la maquette Mathieu + fiches produit */
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 24px -10px rgba(200, 169, 110, .55);
    transition: background .3s ease, transform .25s ease, box-shadow .3s ease;
    -webkit-tap-highlight-color: transparent;
}
.yoozi-add-btn,
.yoozi-add-btn:hover,
.yoozi-add-btn:focus,
.yoozi-add-btn:visited {
    color: #fff;
}
.yoozi-add-btn:hover,
.yoozi-add-btn:focus-visible {
    background: var(--y-gold-deep, #a88a4f);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -10px rgba(168, 138, 79, .6);
}
.yoozi-add-btn:active {
    transform: translateY(0);
}
.yoozi-add-btn:focus-visible {
    outline: 2px solid var(--y-gold-deep, #a88a4f);
    outline-offset: 3px;
}

/* Reflet doré balayant au survol */
.yoozi-add-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -130%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
    transform: skewX(-18deg);
    pointer-events: none;
}
.yoozi-add-btn:hover::after {
    animation: yz-sheen .8s ease;
}
@keyframes yz-sheen {
    from { left: -130%; }
    to   { left: 140%; }
}

.yoozi-add-btn .yoozi-add-label {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    transition: opacity .2s ease;
}

/* --- État "chargement" (classe .loading posée par WooCommerce) --- */
.yoozi-add-btn.loading {
    pointer-events: none;
}
.yoozi-add-btn.loading::after {   /* neutralise le spinner par défaut de WooCommerce */
    content: none;
}
.yoozi-add-btn.loading .yoozi-add-label {
    opacity: 0;
}
.yoozi-add-btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    animation: yz-spin .6s linear infinite;
}
@keyframes yz-spin {
    to { transform: rotate(360deg); }
}

/* --- État "ajouté" (morph "Ajouté ✓") --- */
.yoozi-add-btn.is-added {
    background: var(--y-gold-deep, #a88a4f);
    box-shadow: 0 12px 28px -10px rgba(168, 138, 79, .65);
    animation: yz-pop .45s ease;
}
@keyframes yz-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}
.yoozi-check {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}
.yoozi-check path {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
}
.yoozi-add-btn.is-added .yoozi-check path {
    animation: yz-draw .45s ease .05s forwards;
}
@keyframes yz-draw {
    to { stroke-dashoffset: 0; }
}

/* --- Bouteille "volante" vers le panier --- */
.yoozi-fly-bottle {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    will-change: transform, opacity;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .28));
}

/* --- Rebond de l'icône panier (header Blocksy) --- */
.ct-header-cart.yoozi-cart-bump,
.yoozi-cart-bump {
    animation: yz-bump .55s ease;
}
@keyframes yz-bump {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.18); }
    55%  { transform: scale(.93); }
    100% { transform: scale(1); }
}

/* Masque le lien "Voir le panier" que WooCommerce ajoute après le bouton */
.yoozi-product-card .added_to_cart,
.yoozi-home-buy .added_to_cart {
    display: none !important;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .yoozi-product-card .yoozi-home-buy {
        gap: 12px;
    }
    .yoozi-add-btn {
        min-width: 118px;
        padding: 13px 22px;
    }
    .yoozi-home-buy .yoozi-home-price {
        font-size: 18px;
    }
}

/* --- Accessibilité : mouvement réduit --- */
@media (prefers-reduced-motion: reduce) {
    .yoozi-product-card .yoozi-home-buy {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .yoozi-add-btn,
    .yoozi-add-btn::after,
    .yoozi-add-btn:hover,
    .yoozi-add-btn.is-added,
    .yoozi-check path,
    .ct-header-cart.yoozi-cart-bump,
    .yoozi-cart-bump {
        animation: none !important;
        transition: none !important;
    }
    .yoozi-add-btn.is-added .yoozi-check path {
        stroke-dashoffset: 0;
    }
    .yoozi-fly-bottle {
        display: none !important;
    }
}
