/**
 * FlexCommerce Add to Cart Widget Styles
 * Version:           1.0.7
 */

/* Wrapper */
.flexcommerce-add-to-cart {
    width: 100%;
    box-sizing: border-box;
}

.flexcommerce-add-to-cart-form {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Default spacing - can be overridden by widget settings */
    width: 100%;
}

/* Layout modes */
.flexcommerce-layout-stacked .flexcommerce-add-to-cart-form {
    flex-direction: column;
}

.flexcommerce-layout-inline .flexcommerce-add-to-cart-form {
    flex-direction: column;
}

.flexcommerce-layout-inline .flexcommerce-quantity-price-row,
.flexcommerce-layout-inline-tablet .flexcommerce-quantity-price-row,
.flexcommerce-layout-inline-mobile .flexcommerce-quantity-price-row {
    display: flex;
    width: 100%;
    gap: 20px;
    align-items: flex-start;
}

/* Quantity Section */
.flexcommerce-quantity-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.flexcommerce-layout-inline .flexcommerce-quantity-wrapper,
.flexcommerce-layout-inline .flexcommerce-price-wrapper,
.flexcommerce-layout-inline-tablet .flexcommerce-quantity-wrapper,
.flexcommerce-layout-inline-tablet .flexcommerce-price-wrapper,
.flexcommerce-layout-inline-mobile .flexcommerce-quantity-wrapper,
.flexcommerce-layout-inline-mobile .flexcommerce-price-wrapper {
    margin: 0;
}

.flexcommerce-quantity-label {
    font-weight: 600;
    text-transform: uppercase;
    color: #777;
    font-size: 14px;
    margin-bottom: 5px;
}

/* Slider Styles */
.flexcommerce-slider-row {
    display: flex;
    align-items: center;
    gap: 10px; /* Default - can be adjusted with the control */
    width: 100%;
    flex-wrap: nowrap; /* Prevent wrapping at all screen sizes */
}

input[type="range"].flexcommerce-quantity-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #ccc;
    border-radius: 3px;
    outline: none;
    min-width: 0; /* Prevents overflow issues */
}

input[type="range"].flexcommerce-quantity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4BCFAF;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"].flexcommerce-quantity-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4BCFAF;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.flexcommerce-quantity-display {
    font-weight: 500;
    min-width: 60px;
    text-align: right;
    white-space: nowrap; /* Prevent wrapping of the quantity display */
    flex-shrink: 0; /* Prevent the display from shrinking */
}

.flexcommerce-min-note {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Number Input Styles */
.flexcommerce-quantity-number {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Plus/Minus Buttons Styles */
.flexcommerce-quantity-buttons {
    display: flex;
    align-items: center;
    gap: 0;
}

.flexcommerce-quantity-minus,
.flexcommerce-quantity-plus {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.flexcommerce-quantity-minus:hover,
.flexcommerce-quantity-plus:hover {
    background: #eee;
}

.flexcommerce-quantity-minus {
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.flexcommerce-quantity-plus {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.flexcommerce-quantity-field {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 16px;
}

.flexcommerce-unit-label {
    margin-left: 8px;
    font-size: 14px;
    color: #666;
}

/* Price Display */
.flexcommerce-price-wrapper {
    margin: 10px 0;
    width: 100%;
}

.flexcommerce-price-label {
    font-weight: 600;
    text-transform: uppercase;
    color: #777;
    font-size: 14px;
    margin-bottom: 5px;
    display: block;
}

.flexcommerce-total-price {
    display: flex;
    align-items: center;
}

.flexcommerce-price-amount {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 4px;
    width: 100%;
    font-weight: 500;
    color: #4BCFAF;
    font-size: 16px;
}

/* Button Styles */
.flexcommerce-add-to-cart-button {
    width: 100%;
    background-color: #666;
    color: white;
    text-transform: uppercase;
    font-weight: 700;
    font-size: clamp(0.7rem, 2vw, 1rem);
    padding: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative; /* Ensure proper positioning */
}

.flexcommerce-add-to-cart-button:hover {
    background-color: #555;
}

.flexcommerce-add-to-cart-button.updating {
    opacity: 0.7;
    cursor: wait;
}

.flexcommerce-add-to-cart-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flexcommerce-add-to-cart-button.in-cart {
    background-color: #4BCFAF;
}

.flexcommerce-add-to-cart-button.in-cart:hover {
    background-color: #3ab89a;
}

/* Icon Styles */
.flexcommerce-add-to-cart-button i {
    font-size: 1.2em;
}

.flexcommerce-add-to-cart-button svg {
    width: 1.2em;
    height: 1.2em;
}

/* Icon Display for Buttons */
.flexcommerce-add-to-cart-button .elementor-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* In-Cart Status for Buttons */
.flexcommerce-add-to-cart-button.in-cart {
    background-color: #4BCFAF !important; 
    color: white !important;
}

.flexcommerce-add-to-cart-button.in-cart:hover {
    background-color: #3ab89a !important;
}

/* Limit Warning */
.flexcommerce-limit-warning {
    margin-bottom: 15px;
    color: #ff0000;
    font-weight: 500;
    font-size: 14px;
    padding: 8px;
    background-color: #ffe6e6;
    border-radius: 4px;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    /* Tablet styles */
    .flexcommerce-layout-stacked-tablet .flexcommerce-add-to-cart-form {
        flex-direction: column;
    }
    
    .flexcommerce-layout-inline-tablet .flexcommerce-quantity-price-row {
        display: flex;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .flexcommerce-add-to-cart-form {
        gap: 12px;
    }
    
    .flexcommerce-layout-inline-mobile .flexcommerce-quantity-price-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .flexcommerce-layout-inline-mobile .flexcommerce-quantity-wrapper,
    .flexcommerce-layout-inline-mobile .flexcommerce-price-wrapper {
        width: 100% !important;
    }
    
    .flexcommerce-quantity-number {
        width: 80px;
    }
    
    .flexcommerce-quantity-minus,
    .flexcommerce-quantity-plus {
        width: 36px;
        height: 36px;
    }
    
    .flexcommerce-quantity-field {
        width: 50px;
        height: 36px;
    }
    
    .flexcommerce-add-to-cart-button {
        font-size: 14px;
        padding: 10px;
    }
    
    /* FIX: Keep slider row from wrapping on mobile */
    .flexcommerce-slider-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        width: 100% !important;
    }
    
    /* FIX: Quantity display next to slider on mobile */
    .flexcommerce-quantity-display {
        flex-shrink: 0 !important;
        width: auto !important;
        min-width: 50px !important;
        text-align: right !important;
        margin-top: 0 !important;
    }
    
    /* FIX: Make sure slider takes correct amount of space */
    input[type="range"].flexcommerce-quantity-slider {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }
}

@media (max-width: 480px) {
    /* FIX: Prevent wrapping on small screens */
    .flexcommerce-slider-row {
        flex-wrap: nowrap !important;
    }
    
    /* FIX: Keep quantity display beside slider */
    .flexcommerce-quantity-display {
        width: auto !important;
        text-align: right !important;
        margin-top: 0 !important;
        flex-shrink: 0 !important;
        min-width: 50px !important;
        white-space: nowrap !important;
    }
}

/* CRITICAL FIXES - DO NOT REMOVE */

/* Force widget to be 100% width */
.flexcommerce-add-to-cart {
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure elementor containers respect width */
.elementor-widget-container .flexcommerce-add-to-cart {
    width: 100% !important;
}

/* Fix for JetBlocks Cart Widget display */
.jet-blocks-cart {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for cart count badge */
.jet-blocks-cart__count {
    display: block !important;
    z-index: 99 !important;
}

/* Archive container centering fix */
.archive .elementor-container,
.post-type-archive .elementor-container {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Jet-listing grid item width fix */
.jet-listing-grid__item {
    width: auto !important;
}

/* Animation for newly added products (simple highlight) */
@keyframes flexcommerce-flash {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(75, 207, 175, 0.15); }
}

.newly-added-to-cart {
    animation: flexcommerce-flash 1s ease;
}