/* ==========================================================================
   Améliorations boutique : notifications, états panier / wishlist, langue
   ========================================================================== */

/* ---- Notifications ---- */
#shop-toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10060;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.shop-toast {
    pointer-events: auto;
    padding: 14px 18px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    transform: translateX(24px);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}
.shop-toast.is-visible { transform: none; opacity: 1; }
.shop-toast--success { background: #2e7d5b; }
.shop-toast--error { background: #c0392b; }
.shop-toast--info { background: #34495e; }
[dir="rtl"] #shop-toasts { right: auto; left: 20px; }

/* ---- Boutons en cours ---- */
[data-add-to-cart].is-loading,
[data-product-submit].is-loading {
    opacity: .7;
    cursor: progress;
    pointer-events: none;
}
[data-wishlist-toggle].is-loading svg { animation: shop-pulse .8s ease-in-out infinite; }

/* ---- Wishlist active (cartes + fiche produit) ---- */
[data-wishlist-toggle].is-active svg,
[data-wishlist-toggle].is-active svg path {
    fill: #e2264d !important;
}
[data-wishlist-toggle].is-active { color: #e2264d; }

@keyframes shop-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); }
}
@keyframes shop-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.35); }
}
[data-cart-count].count-updated { animation: shop-bounce .35s ease; }

/* ---- Sidebar panier ---- */
#halo-cart-sidebar .previewCartItem.is-loading { opacity: .5; pointer-events: none; }
#halo-cart-sidebar .previewCartItem--empty { padding: 40px 0; color: #777; }
#halo-cart-sidebar .previewCartItem-remove {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 4px;
}
#halo-cart-sidebar .shop-qty button,
.productView .shop-qty button {
    background: transparent;
    border: 0;
    cursor: pointer;
}
#halo-cart-sidebar .progress_shipping {
    background: #eee;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}
#halo-cart-sidebar [data-shipping-bar] {
    height: 100%;
    background: #2e7d5b;
    transition: width .4s ease;
}
#halo-cart-sidebar .button-checkout[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---- Fiche produit ---- */
.productView [data-product-stock].is-out { color: #c0392b; font-weight: 600; }
.productView .product-form__radio:disabled + label { opacity: .4; text-decoration: line-through; }
.productView [data-product-submit]:disabled { opacity: .6; cursor: not-allowed; }
.productView .price-item--regular .money { text-decoration: line-through; color: #888; }

/* ---- Images : réserver la place pour éviter les décalages ---- */
.product-card-media img { width: 100%; height: auto; }

/* ---- Pagination boutique ---- */
.shop-pagination { display: flex; justify-content: center; margin: 30px 0 10px; }
.shop-pagination .pagination { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.shop-pagination .page-link,
.shop-pagination .page-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #222;
    text-decoration: none;
}
.shop-pagination .page-item.active .page-link,
.shop-pagination .page-item.active span { background: #222; border-color: #222; color: #fff; }
.shop-pagination .page-item.disabled span { opacity: .45; }

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

/* ---- Choix de variation sur les cartes ---- */
.product-card .swatch-label.swatch-text {
    width: auto;
    min-width: 30px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    background: #fff;
}
.product-card .swatch-label.swatch-text.is-active { border-color: #111; background: #111; color: #fff; }
.product-card .swatch-label.is-soldout { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.product-card .swatch .item { display: inline-block; margin: 2px; }
.product-card [aria-disabled="true"] { opacity: .6; }
.soldout-badge { background: #555 !important; }

/* Cœur wishlist : contour par défaut, plein quand le produit est dans la wishlist */
[data-wishlist-toggle] .heart-solid { display: none; }
[data-wishlist-toggle].is-active .heart-solid { display: inline; fill: #e2264d; }
[data-wishlist-toggle].is-active .heart-outline { display: none; }

/* Arabe (RTL) : les montants restent lisibles de gauche à droite */
[dir="rtl"] .money,
[dir="rtl"] [data-cart-count],
[dir="rtl"] [data-wishlist-count] {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}
