/* ==========================================================================
   ADD TO CART - PILL DESIGN & PRICE LOGIC
   Version: 4.1.1 (Complet avec Marque & Corrections)
   ========================================================================== */

/* --- VARIABLES --- */
:root {
    --syn-dark-blue: #003153;
    --syn-text-white: #ffffff;
    --syn-border-pill: #ccc;
    --syn-msg-success: #27ae60;
    --syn-msg-error: #c0392b;
}

/* --- WRAPPER PRINCIPAL --- */
#syn-add-cart-wrapper {
    width: 100% !important;
    max-width: 380px !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: relative;
}

#syn-add-cart-wrapper .label {
	background : transparent;
	border-color: transparent !important;
}

#syn-add-cart-wrapper * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

/* --- PRIX --- */
#syn-add-cart-wrapper .syn-price-header {
    font-size: 1.6rem;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin-bottom: 20px !important;
    line-height: 1.2 !important;
    display: block !important;
}

#syn-add-cart-wrapper .woocommerce-variation-price .price {
    display: block !important;
}

/* Ligne 1 : Barré + Badge */
#syn-add-cart-wrapper .syn-price-row-1 {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin-bottom: 4px !important;
    width: 100% !important;
}

#syn-add-cart-wrapper .syn-price-row-1 del,
#syn-add-cart-wrapper .syn-price-row-1 .syn-old-price {
    color: #888 !important;
    text-decoration: line-through !important;
    font-size: 0.75em !important;
    font-weight: 500 !important;
    display: inline-block !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

#syn-add-cart-wrapper .syn-price-row-1 .syn-price-badge {
    margin: 0 !important;
    background-color: #e74c3c !important;
    color: #ffffff !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    border: none !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
}

/* Ligne 2 : Nouveau prix + Suffixe + Marque */
#syn-add-cart-wrapper .syn-price-row-2 {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
}

#syn-add-cart-wrapper .syn-price-row-2 ins {
    text-decoration: none !important;
    color: #111 !important;
    display: inline-block !important;
    margin: 0 !important;
}

/* Affichage classique si pas de promo */
#syn-add-cart-wrapper .syn-price-header:not(:has(.syn-price-row-1)),
#syn-add-cart-wrapper .woocommerce-variation-price .price:not(:has(.syn-price-row-1)) {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

#syn-add-cart-wrapper .woocommerce-price-suffix {
    font-size: 0.75em !important;
    color: #1a1a1a !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

/* --- AFFICHAGE DE LA MARQUE --- */
#syn-add-cart-wrapper .syn-brand-link {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
}

#syn-add-cart-wrapper .syn-brand-img img {
    height: 40px !important;
    width: auto !important;
    display: block !important;
    object-fit: contain !important;
    margin: 0 !important;
}

#syn-add-cart-wrapper .syn-brand-text {
    background-color: #ffffff !important;
    color: #000000 !important;
    text-transform: uppercase !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #eaeaea !important;
    display: inline-block !important;
    line-height: 1.2 !important;
    transition: all 0.2s ease !important;
}

#syn-add-cart-wrapper .syn-brand-text:hover {
    border-color: #000000 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
}

/* --- 1. CARTOUCHES (VARIATIONS) --- */
#syn-add-cart-wrapper form.cart { margin: 0 !important; padding: 0 !important; }

#syn-add-cart-wrapper .variations {
    width: 100% !important; border: none !important; margin-bottom: 15px !important;
    display: block !important; background: transparent !important;
}
#syn-add-cart-wrapper .variations tbody { display: block !important; }
#syn-add-cart-wrapper .variations tr {
    display: flex !important; align-items: center !important; justify-content: space-between !important;
    background: #fff !important; border: 1px solid var(--syn-border-pill) !important;
    border-radius: 8px !important; padding: 0 15px !important; margin-bottom: 10px !important;
    height: 50px !important; transition: border-color 0.2s;
}
#syn-add-cart-wrapper .variations tr:hover { border-color: var(--syn-dark-blue) !important; }
#syn-add-cart-wrapper .variations td.label {
    display: block !important; padding: 0 !important; margin: 0 !important; width: auto !important;
    border: none !important; background: transparent !important; flex-shrink: 0 !important;
}
#syn-add-cart-wrapper .variations td.value {
    display: block !important; flex-grow: 1 !important; padding: 0 !important; border: none !important;
    background: transparent !important; text-align: right !important;
}
#syn-add-cart-wrapper select {
    width: 100% !important; border: none !important; background-color: transparent !important;
    box-shadow: none !important; outline: none !important; text-align: right !important;
    text-align-last: right !important; font-size: 15px !important; color: #333 !important;
    cursor: pointer !important; padding-right: 0px !important; margin: 0 !important; height: auto !important;
}

/* --- 2. STOCK & MESSAGES WOO --- */
#syn-add-cart-wrapper .single_variation_wrap { display: flex !important; flex-direction: column !important; }

#syn-add-cart-wrapper .syn-stock-in { display: none !important; }
#syn-add-cart-wrapper .woocommerce-variation-availability:has(.syn-stock-in) { display: none !important; }

#syn-add-cart-wrapper .syn-stock-out { 
    display: inline-block !important;
    background-color: var(--syn-msg-error) !important;
    color: #fff !important; 
    font-weight: 700 !important;
    font-size: 14px !important;
    font-style: normal !important;
    padding: 6px 16px !important;
    border-radius: 4px !important;
    margin: 10px 0 !important;
}

#syn-add-cart-wrapper .woocommerce-variation-availability {
    order: 1 !important; margin-bottom: 8px !important; font-size: 13px !important;
    font-style: normal !important; color: #666 !important; line-height: 1 !important; background: transparent !important;
}

#syn-add-cart-wrapper .woocommerce-variation-price { order: 0 !important; margin-bottom: 5px !important; }
#syn-add-cart-wrapper .reset_variations { display: none !important; }

/* --- 3. BLOC ACTION FUSIONNÉ --- */
#syn-add-cart-wrapper .woocommerce-variation-add-to-cart,
#syn-add-cart-wrapper form.cart:not(.variations_form) {
    order: 2 !important; display: flex !important; flex-wrap: nowrap !important;
    align-items: center !important; background-color: var(--syn-dark-blue) !important;
    border-radius: 8px !important; overflow: hidden !important; margin: 0 !important;
    width: 100% !important; height: 55px !important; box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
    position: relative !important; z-index: 1 !important;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

#syn-add-cart-wrapper form.cart:has(.syn-stock-out) .woocommerce-variation-add-to-cart,
#syn-add-cart-wrapper form.cart:has(.stock.out-of-stock) .woocommerce-variation-add-to-cart {
    display: none !important;
}

#syn-add-cart-wrapper .woocommerce-variation-add-to-cart.syn-disabled,
#syn-add-cart-wrapper form.cart.syn-disabled {
    opacity: 0.6 !important;
    pointer-events: none !important; 
    filter: grayscale(100%) !important;
}
#syn-add-cart-wrapper button.single_add_to_cart_button:disabled,
#syn-add-cart-wrapper button.single_add_to_cart_button.disabled {
    cursor: not-allowed !important; background-color: transparent !important;
}

/* --- ZONE QUANTITÉ --- */
#syn-add-cart-wrapper .syn-qty-wrapper {
    display: flex !important; align-items: center !important; justify-content: center !important;
    width: 110px !important; height: 100% !important; padding: 0 10px !important;
    border-right: 1px solid rgba(255,255,255,0.1) !important; background: transparent !important;
    position: relative !important; z-index: 2 !important; transition: width 0.3s ease;
}
#syn-add-cart-wrapper .syn-qty-wrapper.syn-one-qty .syn-qty-btn { display: none !important; }
#syn-add-cart-wrapper .syn-qty-wrapper.syn-one-qty { border-right: none !important; width: 60px !important; }
#syn-add-cart-wrapper .syn-qty-wrapper.syn-one-qty input.qty { pointer-events: none !important; }

#syn-add-cart-wrapper .syn-qty-btn {
    width: 35px !important; height: 100% !important; background: transparent !important;
    border: none !important; cursor: pointer !important; font-size: 20px !important;
    font-weight: 400 !important; color: var(--syn-text-white) !important;
    display: flex !important; align-items: center; justify-content: center !important;
    padding: 0 !important; margin: 0 !important; line-height: 1 !important; appearance: none !important;
}
#syn-add-cart-wrapper .syn-qty-btn:hover { background: rgba(255,255,255,0.1) !important; }
#syn-add-cart-wrapper .syn-qty-btn:disabled { opacity: 0.3 !important; cursor: not-allowed !important; }

#syn-add-cart-wrapper .quantity {
    flex-grow: 1 !important; margin: 0 !important; padding: 0 !important; border: none !important;
    height: 100% !important; width: auto !important; display: block !important;
}
#syn-add-cart-wrapper .quantity input.qty {
    width: 100% !important; height: 100% !important; border: none !important;
    background: transparent !important; text-align: center !important; font-size: 16px !important;
    font-weight: 600 !important; color: var(--syn-text-white) !important; padding: 0 !important;
    margin: 0 !important; display: block !important;
}

#syn-add-cart-wrapper button.single_add_to_cart_button {
    flex-grow: 1 !important; height: 100% !important; background-color: transparent !important;
    color: var(--syn-text-white) !important; border: none !important; padding: 0 20px !important;
    font-size: 16px !important; font-weight: 600 !important; text-transform: none !important;
    cursor: pointer !important; margin: 0 !important; display: flex !important;
    align-items: center !important; justify-content: center !important; border-radius: 0 !important;
}
#syn-add-cart-wrapper button.single_add_to_cart_button:hover { background-color: rgba(255,255,255,0.05) !important; }

/* MOBILE */
@media (max-width: 768px) {
    #syn-add-cart-wrapper button.single_add_to_cart_button { font-size: 0 !important; }
    #syn-add-cart-wrapper button.single_add_to_cart_button::before {
        content: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='9' cy='21' r='1'%3e%3c/circle%3e%3ccircle cx='20' cy='21' r='1'%3e%3c/circle%3e%3cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3e%3c/path%3e%3c/svg%3e") !important;
        display: block !important; width: 24px !important; height: 24px !important;
    }
}

/* --- 4. MESSAGES INLINE --- */
.syn-inline-messages {
    margin-top: 15px !important; 
    font-size: 13px; line-height: 1.4; min-height: 0px; 
    transition: opacity 0.5s ease; opacity: 1; 
}
.syn-inline-messages.syn-fading-out { opacity: 0; }

.syn-inline-messages ul, .syn-inline-messages li {
    text-align: left !important;
    padding-top: 15px !important;
    list-style: none !important;
    margin: 0 !important;
}

.syn-inline-messages .woocommerce-message,
.syn-inline-messages .woocommerce-error,
.syn-inline-messages .woocommerce-info,
.syn-inline-messages .syn-addcart-message {
    border: none !important; background: transparent !important; padding: 0 !important;
    margin: 0 !important; width: 100% !important; display: block !important;
}
.syn-inline-messages .button.wc-forward { display: none !important; }

.syn-inline-messages .woocommerce-message,
.syn-inline-messages .syn-addcart-message.success { color: var(--syn-msg-success) !important; font-weight: 700; }
.syn-inline-messages .woocommerce-error,
.syn-inline-messages .syn-addcart-message.error { color: var(--syn-msg-error) !important; font-weight: 700; }
.syn-inline-messages .woocommerce-info { color: #2980b9 !important; font-weight: 700; }

.syn-inline-messages .woocommerce-message::before, .syn-inline-messages .woocommerce-message::after,
.syn-inline-messages .woocommerce-error::before, .syn-inline-messages .woocommerce-error::after,
.syn-inline-messages .woocommerce-info::before, .syn-inline-messages .woocommerce-info::after,
.syn-inline-messages .syn-addcart-message::before, .syn-inline-messages .syn-addcart-message::after {
    content: none !important; display: none !important;
}

/* REVEAL */
#syn-add-cart-wrapper .woocommerce-variation-add-to-cart:not(.syn-ready),
#syn-add-cart-wrapper form.cart:not(.variations_form):not(.syn-ready) {
    opacity: 0 !important; visibility: hidden !important; height: 55px; 
}
#syn-add-cart-wrapper .woocommerce-variation-add-to-cart.syn-ready,
#syn-add-cart-wrapper form.cart:not(.variations_form).syn-ready {
    opacity: 1 !important; visibility: visible !important;
}