/**
 * Animation des notices WooCommerce personnalisées
 * 
 * Style : Card en bas centrée avec fade-in + glissement
 * Auto-disparition après 3 secondes
 * 
 * Cible :
 * - .woocommerce-notices-wrapper (notices standards)
 * - #td-notices-container (container créé par JS pour les notices du panier/checkout)
 */

/* ============================================
   WRAPPER FIXE EN BAS DE PAGE
   ============================================ */

/* Wrapper standard WooCommerce */
.woocommerce-notices-wrapper {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 460px !important;
    opacity: 0;
    pointer-events: none;
}

.woocommerce-notices-wrapper.loaded {
    opacity: 1;
    pointer-events: auto;
}

/* Container créé par JS pour les notices du panier/checkout */
#td-notices-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 460px;
    width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

#td-notices-container.has-notices {
    pointer-events: auto;
}

/* ============================================
   STYLE DES NOTICES (CARD)
   ============================================ */

/* Notices dans le wrapper standard */
.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-notices-wrapper .woocommerce-info,
/* Notices dans le container TD */
#td-notices-container .woocommerce-message,
#td-notices-container .woocommerce-error,
#td-notices-container .woocommerce-info {
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #fff;
    border-left: 4px solid;
    animation: noticeSlideIn 0.5s ease-out forwards;
    font-size: 14px;
    line-height: 1.4;
    pointer-events: auto;
}

/* Bouton dans les notices */
.woocommerce-notices-wrapper .button,
#td-notices-container .button {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 20px;
    margin-left: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ============================================
   COULEURS PAR TYPE
   (surchargées par le CSS inline si personnalisées)
   ============================================ */

.woocommerce-notices-wrapper .woocommerce-message,
#td-notices-container .woocommerce-message {
    border-left-color: var(--success, #28a745);
    color: var(--success, #28a745);
}

.woocommerce-notices-wrapper .woocommerce-error,
#td-notices-container .woocommerce-error {
    border-left-color: var(--error, #dc3545);
    color: var(--error, #dc3545);
}

.woocommerce-notices-wrapper .woocommerce-info,
#td-notices-container .woocommerce-info {
    border-left-color: var(--info, #17a2b8);
    color: var(--info, #17a2b8);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes noticeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes noticeSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Animation de sortie */
.woocommerce-notices-wrapper.hiding .woocommerce-message,
.woocommerce-notices-wrapper.hiding .woocommerce-error,
.woocommerce-notices-wrapper.hiding .woocommerce-info,
#td-notices-container .notice-hiding {
    animation: noticeSlideOut 0.3s ease-out forwards;
}

/* ============================================
   MASQUER LES NOTICES ORIGINALES
   (dans panier/checkout, avant qu'elles soient déplacées)
   ============================================ */

/* Masquer les notices inline dans le panier/checkout */
.woocommerce-cart-form .woocommerce-message,
.woocommerce-cart-form .woocommerce-error,
.woocommerce-cart-form .woocommerce-info,
.woocommerce-checkout .woocommerce-message:not(#td-notices-container .woocommerce-message),
.woocommerce-checkout .woocommerce-error:not(#td-notices-container .woocommerce-error),
.woocommerce-checkout .woocommerce-info:not(#td-notices-container .woocommerce-info) {
    /* Par défaut cachées, le JS va les déplacer */
    display: none !important;
}

/* Les notices déjà dans le container TD sont visibles */
#td-notices-container .woocommerce-message,
#td-notices-container .woocommerce-error,
#td-notices-container .woocommerce-info {
    display: block !important;
}

/* ============================================
   RESPONSIVE MOBILE
   ============================================ */

@media (max-width: 768px) {
    .woocommerce-notices-wrapper,
    #td-notices-container {
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
        width: calc(100% - 20px);
        bottom: 10px;
    }
    
    .woocommerce-notices-wrapper .woocommerce-message,
    .woocommerce-notices-wrapper .woocommerce-error,
    .woocommerce-notices-wrapper .woocommerce-info,
    #td-notices-container .woocommerce-message,
    #td-notices-container .woocommerce-error,
    #td-notices-container .woocommerce-info {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .woocommerce-notices-wrapper .button,
    #td-notices-container .button {
        padding: 5px 12px;
        font-size: 12px;
    }
}

