/**
 * Stock Validator - Notify Me Button Styles
 * Responsive styles for the "Notify me" button
 */

/* Button wrapper for responsive layout */
.trs-button-wrapper,
.trs-cart-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

/* Notify me button styles */
.trs-notify-me-btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #0073aa;
    color: #ffffff !important;
    border: 2px solid #0073aa;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.5;
    min-width: 140px;
}

.trs-notify-me-btn:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 115, 170, 0.3);
}

.trs-notify-me-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 115, 170, 0.3);
}

.trs-notify-me-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Subscribed state */
.trs-notify-me-subscribed {
    background-color: #46b450;
    border-color: #46b450;
    color: #ffffff !important;
}

.trs-notify-me-subscribed:hover {
    background-color: #46b450;
    border-color: #46b450;
    transform: none;
    box-shadow: none;
}

/* Disabled Add to Cart while stock check runs */
.trs-add-to-cart-disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Responsive styles */
@media (max-width: 768px) {
    .trs-button-wrapper,
    .trs-cart-buttons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
        margin-top: 0;
    }
    
    .trs-notify-me-btn {
        width: 100%;
        min-width: auto;
        margin-top: 0;
        margin-left: 0;
        margin-right: 0;
        padding: 14px 24px;
        font-size: 15px;
        display: block;
        box-sizing: border-box;
    }
    
    /* Make sure Add to Cart and Notify buttons stack on mobile */
    .trs-button-wrapper .single_add_to_cart_button,
    .trs-button-wrapper .add_to_cart_button,
    .trs-button-wrapper button[type="submit"],
    .trs-cart-buttons .single_add_to_cart_button,
    .trs-cart-buttons .add_to_cart_button,
    .trs-cart-buttons button[type="submit"] {
        width: 100% !important;
        margin-bottom: 0;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }
    
    /* Remove left margin from cart forms on mobile */
    form.cart .trs-notify-me-btn {
        margin-left: 0;
    }
    
    /* Ensure subscribed button also has proper mobile styling */
    .trs-notify-me-subscribed {
        width: 100%;
        min-width: auto;
        margin-top: 0;
        margin-left: 0;
        margin-right: 0;
        padding: 14px 24px;
        font-size: 15px;
        display: block;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .trs-button-wrapper,
    .trs-cart-buttons {
        gap: 10px;
    }
    
    .trs-notify-me-btn,
    .trs-notify-me-subscribed {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* Ensure all buttons in wrapper are same size on small mobile */
    .trs-button-wrapper .single_add_to_cart_button,
    .trs-button-wrapper .add_to_cart_button,
    .trs-button-wrapper button[type="submit"],
    .trs-cart-buttons .single_add_to_cart_button,
    .trs-cart-buttons .add_to_cart_button,
    .trs-cart-buttons button[type="submit"] {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Ensure button appears inline with Add to Cart on desktop */
@media (min-width: 769px) {
    .trs-button-wrapper,
    .trs-cart-buttons {
        flex-direction: row;
        align-items: center;
    }
    
    .trs-notify-me-btn {
        flex: 0 0 auto;
    }
}

/* Compatibility with WooCommerce themes */
.woocommerce .trs-notify-me-btn,
.woocommerce-page .trs-notify-me-btn {
    vertical-align: middle;
}

/* Ensure proper spacing in cart forms */
form.cart .trs-notify-me-btn {
    margin-left: 10px;
}

form.variations_form .trs-notify-me-btn {
    margin-top: 10px;
}

/* Single variation wrap compatibility */
.single_variation_wrap .trs-notify-me-btn,
.woocommerce-variation-add-to-cart .trs-notify-me-btn {
    margin-left: 10px;
}

/* Mobile: Remove left margins from all forms */
@media (max-width: 768px) {
    form.cart .trs-notify-me-btn,
    form.variations_form .trs-notify-me-btn,
    .single_variation_wrap .trs-notify-me-btn,
    .woocommerce-variation-add-to-cart .trs-notify-me-btn {
        margin-left: 0;
        margin-top: 0;
    }
}

/* Hide button if product is in stock (shouldn't happen, but safety) */
.in-stock ~ .trs-notify-me-btn,
.stock.in-stock ~ .trs-notify-me-btn {
    display: none;
}

