/* ==========================================================================
   ASSCW Client Cart — Toast de feedback
   ========================================================================== */

#asscw-cart-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    padding: 16px;
    font-size: .9em;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .3s ease, transform .3s ease;
    border-left: 4px solid #bbb;
}

#asscw-cart-toast.asscw-cart-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

#asscw-cart-toast.asscw-cart-toast--hiding {
    opacity: 0;
    transform: translateY(12px);
}

#asscw-cart-toast.asscw-cart-toast--success {
    border-left-color: #2e7d32;
}

#asscw-cart-toast.asscw-cart-toast--error {
    border-left-color: #c0392b;
}

#asscw-cart-toast.asscw-cart-toast--info {
    border-left-color: #3270A6;
}

.asscw-cart-toast__message {
    font-weight: 600;
    color: #384759;
    margin-bottom: 8px;
    padding-right: 20px;
}

.asscw-cart-toast__incentives {
    margin-bottom: 8px;
}

.asscw-cart-toast__incentive {
    font-size: .85em;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.asscw-cart-toast__incentive--info {
    background: #fff8e1;
    color: #5d4037;
}

.asscw-cart-toast__incentive--success {
    background: #e8f5e9;
    color: #1b5e20;
}

.asscw-cart-toast__summary {
    font-size: .85em;
    color: #384759;
    margin-bottom: 10px;
}

.asscw-cart-toast__link {
    display: inline-block;
    font-size: .85em;
    font-weight: 600;
    color: #3270A6;
    text-decoration: none;
}

.asscw-cart-toast__link:hover {
    text-decoration: underline;
}

.asscw-cart-toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .8em;
    color: #999;
    padding: 0;
    line-height: 1;
}

.asscw-cart-toast__close:hover {
    color: #384759;
}

/* Bouton en état chargement */
.single_add_to_cart_button.asscw-loading,
.add_to_cart_button.asscw-loading {
    opacity: .6;
    cursor: wait;
}

@media (max-width: 480px) {
    #asscw-cart-toast {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 8px 8px 0 0;
        border-left: none;
        border-top: 4px solid #bbb;
    }

    #asscw-cart-toast.asscw-cart-toast--success { border-top-color: #2e7d32; border-left: none; }
    #asscw-cart-toast.asscw-cart-toast--error   { border-top-color: #c0392b; border-left: none; }
    #asscw-cart-toast.asscw-cart-toast--info    { border-top-color: #3270A6; border-left: none; }
}

/* ==========================================================================
   ASSCW Barre incitatifs globale
   ========================================================================== */

.asscw-incentive-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background: #b71c1c;
    color: #fff;
    font-size: 1em;
    font-weight: 300;
    line-height: 1.5;
    padding: 10px 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    transition: transform .3s ease, opacity .3s ease;
    box-sizing: border-box;
}

.asscw-incentive-bar--hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Décaler le contenu page pour ne pas être écrasé par la barre */
body.asscw-bar-visible {
    margin-top: 44px;
    transition: margin-top .3s ease;
}

.asscw-incentive-bar__inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.asscw-incentive-bar__messages {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}

.asscw-incentive-bar__msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 300;
    white-space: nowrap;
    letter-spacing: .01em;
}

.asscw-incentive-bar__msg--info {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.asscw-incentive-bar__msg--success {
    background: rgba(255,255,255,.2);
    color: #fff;
    font-weight: 400;
}

.asscw-incentive-bar__msg--warning {
    background: rgba(255,235,59,.15);
    color: #fff3cd;
    font-weight: 300;
}

.asscw-incentive-bar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    white-space: nowrap;
}

.asscw-incentive-bar__summary {
    color: #b0bec5;
    font-size: .9em;
}

.asscw-incentive-bar__link {
    display: inline-block;
    background: #fff;
    color: #b71c1c;
    font-weight: 700;
    font-size: .85em;
    padding: 5px 14px;
    border-radius: 20px;
    text-decoration: none;
    transition: background .2s;
}

.asscw-incentive-bar__link:hover {
    background: #ffebee;
    color: #b71c1c;
}

/* Décaler le toast au-dessus de la barre sur mobile */
@media (max-width: 480px) {
    #asscw-cart-toast {
        bottom: 60px;
        border-radius: 8px 8px 0 0;
    }
}

/* Masquer le panier WC natif pour les clients ASS */
.asscw-active-client .elementor-menu-cart__toggle,
.asscw-active-client .cart-contents,
.asscw-active-client .widget_shopping_cart,
.asscw-active-client .woocommerce-mini-cart,
.asscw-active-client a.cart-icon,
.asscw-active-client .elementor-widget-woocommerce-menu-cart {
    display: none !important;
}

/* Résumé barre incitatifs — nombre d'articles et total */
.asscw-incentive-bar__summary {
    font-weight: 300;
    font-size: 1em;
    color: rgba(255,255,255,.9);
    white-space: nowrap;
}
.asscw-incentive-bar__count {
    font-size: 1.3em;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8em;
    height: 1.8em;
    line-height: 1;
    margin-right: 4px;
}
.asscw-incentive-bar__total {
    font-weight: 600;
    font-size: 1.1em;
    color: #fff;
}

/* =========================================================================
   Alignement boutons "Ajouter au panier" sur la grille catalogue WC
   Actif uniquement pour les clients actifs (.asscw-active-client sur body)
   ========================================================================= */
.asscw-active-client .products .product,
.asscw-active-client ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
}
.asscw-active-client .products .product a.woocommerce-loop-product__link,
.asscw-active-client ul.products li.product a.woocommerce-loop-product__link {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}
.asscw-active-client .products .product .woocommerce-loop-product__title,
.asscw-active-client ul.products li.product .woocommerce-loop-product__title {
    flex: 1 !important;
}
.asscw-active-client .products .product .add_to_cart_button,
.asscw-active-client ul.products li.product .add_to_cart_button {
    margin-top: auto !important;
    align-self: stretch !important;
}

/* Champ de quantite WC — largeur suffisante pour les grandes quantites */
.asscw-active-client input.qty,
.woocommerce input.qty {
    min-width: 80px !important;
    width: 80px !important;
}

/* Bouton Ajouter au panier WC — bleu ASS */
.asscw-active-client .add_to_cart_button,
.asscw-active-client .single_add_to_cart_button {
    background-color: #3270A6 !important;
    border-color: #3270A6 !important;
    color: #fff !important;
}
.asscw-active-client .add_to_cart_button:hover,
.asscw-active-client .single_add_to_cart_button:hover {
    background-color: #255d8f !important;
    border-color: #255d8f !important;
    color: #fff !important;
}

/* =========================================================================
   Bloc utilisateur dans la barre incitatifs
   ========================================================================= */

.asscw-incentive-bar__user {
    position: relative;
    flex-shrink: 0;
    margin-left: 12px;
}

.asscw-incentive-bar__user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asscw-incentive-bar__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    color: #b71c1c;
    font-size: .8em;
    font-weight: 800;
    letter-spacing: .02em;
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 0 0 2px rgba(255,255,255,.4);
    user-select: none;
}

.asscw-incentive-bar__user-btn:hover .asscw-incentive-bar__avatar {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(255,255,255,.7);
}

.asscw-incentive-bar__user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    min-width: 180px;
    z-index: 10000;
    overflow: hidden;
}

.asscw-incentive-bar__user-dropdown.is-open {
    display: block;
}

.asscw-incentive-bar__user-name-full {
    padding: 12px 16px 8px;
    font-size: .85em;
    font-weight: 700;
    color: #384759;
    border-bottom: 1px solid #F2E4D8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.asscw-incentive-bar__user-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #384759;
    font-size: .85em;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}

.asscw-incentive-bar__user-logout::before {
    content: '⏻';
    font-size: 1em;
    opacity: .6;
}

.asscw-incentive-bar__user-logout:hover {
    background: #F2E4D8;
    color: #384759;
}
