/* Additional styles for Americana theme */

/* Fix for overlapping buttons */
.button-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Ensure proper spacing between buttons */
.add_to_cart_button {
    margin-bottom: 5px !important;
}

/* Style for "View inquiry list" button to ensure it's below the add button */
.added_to_cart {
    margin-top: 5px !important;
    margin-bottom: 10px !important;
    display: block !important;
    text-align: center;
}

/* Fix for quantity buttons to avoid overlap */
.has-quantity-buttons {
    margin-bottom: 10px !important;
    display: block !important;
    clear: both !important;
}

/* Hide "View inquiry list" when quantity buttons are present */
.has-quantity-buttons + .added_to_cart {
    display: none !important;
}

/* Product code selector styling */
.americana-code-selector label { font-size: 12px; color: #444; }
.americana-code-selector select.product-code-select {
    width: 100%;
    max-width: 260px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Styling for the quantity controls */
.quantity-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.minus-item, .plus-item {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #ddd;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 4px;
    text-align: center;
    line-height: 1;
    padding: 0;
    outline: none;
}

.minus-item:hover, .plus-item:hover {
    background: #f7f7f7;
    color: #333;
}

.item-count {
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    font-size: 14px;
    color: #000;
    display: inline-block;
    margin: 0;
}


.quantity-controls {
    display: flex;
    background-color: rgba(224, 229, 235, 0.6);
    padding: 5px;
    border-radius: 20px;
}

a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart.has-quantity-buttons {
    background: transparent;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
}

/* AJAX loading styles */
.loading-spinner {
    display: inline-block;
    position: relative;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.loading-spinner:after {
    content: " ";
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
    border-color: #333 transparent #333 transparent;
    animation: spinner 1.2s linear infinite;
}

/* Loading state for "Add to inquiry list" button */
.add_to_cart_button.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.add_to_cart_button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    margin-left: -8px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    animation: spinner 0.8s linear infinite;
}

/* Loading state for quantity controls */
.quantity-controls.loading {
    opacity: 0.7;
    pointer-events: none;
}

.quantity-controls.loading .minus-item,
.quantity-controls.loading .plus-item {
    opacity: 0.5;
}

.quantity-controls.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    margin-left: -8px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    animation: spinner 0.8s linear infinite;
    z-index: 10;
}

/* Animation for the spinner */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}