/*
Plugin: Smart Add to Cart
Description: Styles for the smart quantity button.
*/

.smart-cart-button-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
    max-width: 150px; /* Adjust as needed */
    margin: 0 auto; /* Center the button */
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease-in-out;
    opacity: 0; /* Initially hidden, JS will make it visible */
    visibility: hidden;
    height: 0; /* Collapse height initially */
    box-sizing: border-box; /* Ensure padding/border is included in height */
}

/* Make it visible and expand height when active */
.smart-cart-button-wrapper.smart-cart-button--active {
    opacity: 1;
    visibility: visible;
    height: 40px; /* Default button height, adjust to match theme */
    padding: 0; /* Reset padding here if applied elsewhere */
}


.smart-cart-button-wrapper .smart-cart-button {
    background-color: #f8f8f8;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    transition: background-color 0.2s ease-in-out;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.smart-cart-button-wrapper .smart-cart-button:hover {
    background-color: #e0e0e0;
}

.smart-cart-button-wrapper .smart-cart-quantity-input {
    width: 50px; /* Adjust as needed */
    text-align: center;
    border: none;
    font-size: 1em;
    padding: 10px 0;
    -moz-appearance: textfield; /* Remove spinner for Firefox */
    flex-grow: 1; /* Allow input to grow */
    background-color: #fff;
    color: #333;
}

/* Remove spinner for Chrome, Safari, Edge */
.smart-cart-button-wrapper .smart-cart-quantity-input::-webkit-outer-spin-button,
.smart-cart-button-wrapper .smart-cart-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Style for initial Add to Cart button when hidden by JS */
.smart-cart-initial-button.smart-cart-button--hidden {
    display: none !important;
}

/* Loading state for buttons */
.smart-cart-initial-button.loading,
.smart-cart-button-wrapper.loading .smart-cart-button {
    cursor: wait;
    opacity: 0.7;
}

/* Out of Stock and Disabled state */
.smart-cart-button--out-of-stock,
.smart-cart-button--disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #e0e0e0 !important;
    color: #777 !important;
}

.smart-cart-button--out-of-stock {
    text-transform: uppercase;
}

/* Ensure WooCommerce notices are visible */
.woocommerce-notices-wrapper {
    position: fixed;
    top: 50px; /* Adjust based on header height */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 600px;
}

.woocommerce-message.success {
    background-color: #dff0d8;
    color: #3c763d;
    border-color: #d6e9c6;
}

.woocommerce-message.error {
    background-color: #f2dede;
    color: #a94442;
    border-color: #ebccd1;
}

.woocommerce-message {
    padding: 1em 2em 1em 3.5em;
    margin: 0 0 2em;
    position: relative;
    background-color: #f7f6f7;
    color: #515151;
    border-top: 3px solid #f2f2f2;
    list-style: none outside;
    width: auto;
    word-wrap: break-word;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    animation: fadeInOut 5s forwards; /* For fade out */
}

/* Header Cart Icon Buzz Animation */
@keyframes smart-cart-buzz {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-1deg); }
    50% { transform: translateX(3px) rotate(1deg); }
    75% { transform: translateX(-3px) rotate(-1deg); }
    100% { transform: translateX(0); }
}

.smart-cart-buzz-animation {
    animation: smart-cart-buzz 0.3s ease-in-out; /* Short and snappy */
}