/* Main Wrapper */
.elementor-variation-swatches-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Row (Label + Swatches) */
.evs-attribute-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.evs-attribute-label {
    font-weight: bold;
}

/* Container for Swatches */
.evs-swatches-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Swatch Base */
.evs-swatch {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Image Mode */
.evs-swatch.evs-type-image {
    flex-direction: column;
}

.evs-swatch.evs-type-image img {
    object-fit: cover;
    display: block;
    border: 1px solid #ddd;
    /* Default border */
}

/* Selected State (Image) */
.evs-swatch.evs-type-image.selected img {
    border-color: #000;
    /* Default selected color */
}

/* Label below image */
.evs-swatch-label {
    margin-top: 5px;
    font-size: 12px;
    text-align: center;
}

/* Button Mode */
.evs-swatch.evs-type-button {
    border: 1px solid #ccc;
    background: #f9f9f9;
    padding: 5px 10px;
    font-size: 14px;
}

.evs-swatch.evs-type-button:hover {
    background: #eee;
}

.evs-swatch.evs-type-button.selected {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* Disabled State Base */
.evs-swatch.disabled {
    cursor: not-allowed;
}

/* Behavior: Blur (Default) */
.evs-oos-behavior-blur .evs-swatch.disabled {
    opacity: 0.4;
    filter: grayscale(100%);
    pointer-events: none;
    /* Prevent clicking */
}

/* Behavior: Hide */
.evs-oos-behavior-hide .evs-swatch.disabled {
    display: none !important;
}

/* Add to Cart Section */
.evs-add-to-cart-section {
    margin-top: 25px;
}

.variations_button {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* EVS Quantity Wrapper with +/- Buttons - Unified Segmented Control */
.evs-quantity-wrapper {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    /* No margin tricks - use box-shadow to merge adjacent borders */
}

/* EVS Quantity Buttons */
.evs-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: var(--evs-qty-height, 36px);
    padding: 0 12px;
    margin: 0;
    font-size: var(--evs-qty-btn-font-size, 18px);
    font-weight: 400;
    line-height: 1;
    color: var(--evs-qty-btn-color, #333);
    background: var(--evs-qty-btn-bg, #f9f9f9);
    border: 1px solid var(--evs-qty-btn-border-color, #ccc);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    /* Use box-shadow to create the merged-border illusion between adjacent segments */
    position: relative;
    z-index: 2;
}

/* Minus button - left outer corners rounded (TOP and LEFT from Elementor control) */
.evs-qty-btn.evs-qty-minus {
    border-radius: 4px 0 0 4px;
}

/* Plus button - right outer corners rounded (TOP and BOTTOM from Elementor control) */
.evs-qty-btn.evs-qty-plus {
    border-radius: 0 4px 4px 0;
}

/* Input in middle has no radius */
.evs-quantity-wrapper input.qty {
    border-radius: 0;
}

/* Hover — never applies to disabled buttons */
.evs-qty-btn:hover:not(:disabled) {
    background: var(--evs-qty-btn-bg-hover, #eee);
    border-color: var(--evs-qty-btn-border-color-hover, #bbb);
    position: relative;
    z-index: 3;
}

/* Focus */
.evs-qty-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* Active/focus — never applies to disabled buttons */
.evs-qty-btn:active:not(:disabled),
.evs-qty-btn:focus:not(:disabled) {
    background: var(--evs-qty-btn-bg-active, #e0e0e0);
}

/* Disabled state — completely opaque, blocks all inherited states */
.evs-qty-btn:disabled,
.evs-qty-btn.disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    /* Force neutral background/border so no hover/active color leaks through */
    background: var(--evs-qty-btn-bg, #f9f9f9) !important;
    border-color: var(--evs-qty-btn-border-color, #ccc) !important;
    color: var(--evs-qty-btn-color, #999) !important;
}

/* Native WooCommerce .quantity wrapper — fully reset inside EVS context */
.evs-quantity-wrapper .quantity,
body .evs-quantity-wrapper .quantity,
html body .evs-quantity-wrapper .quantity {
    display: flex !important;
    align-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    position: relative !important;
    z-index: 1 !important;
    width: auto !important;
    float: none !important;
}

/* Target input[type=number] explicitly for Firefox */
.evs-quantity-wrapper input[type="number"],
.evs-quantity-wrapper input.qty {
    -moz-appearance: textfield;
    appearance: textfield;
    /* Size and styling */
    width: var(--evs-qty-input-width, 50px);
    height: var(--evs-qty-height, 36px);
    padding: 0 4px;
    margin: 0;
    font-size: var(--evs-qty-input-font-size, 14px);
    text-align: center;
    color: var(--evs-qty-input-color, #333);
    background: var(--evs-qty-input-bg, #fff);
    border: 1px solid var(--evs-qty-btn-border-color, #ccc);
    border-left: none;
    border-right: none;
    border-radius: 0;
    /* Collapse borders - left connects to minus, right connects to plus */
    position: relative;
    z-index: 2;
    /* Box shadow to visually merge with adjacent button borders */
    box-shadow: none;
}

/* Remove webkit spinner arrows */
.evs-quantity-wrapper input[type="number"]::-webkit-inner-spin-button,
.evs-quantity-wrapper input[type="number"]::-webkit-outer-spin-button,
.evs-quantity-wrapper input.qty::-webkit-inner-spin-button,
.evs-quantity-wrapper input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0;
}

/* Firefox: remove number input spinners via pseudo-element */
.evs-quantity-wrapper input[type="number"]::-moz-number-spin-up,
.evs-quantity-wrapper input[type="number"]::-moz-number-spin-down {
    display: none;
}

/* Preserve alignment within .variations_button */
.variations_button .evs-quantity-wrapper {
    vertical-align: middle;
}

/* Add to Cart Button Base */
.single_add_to_cart_button {
    cursor: pointer;
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border: none;
    transition: all 0.2s;
}

.single_add_to_cart_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Native Selects - Hidden by default but functional */
.evs-hidden-select {
    visibility: hidden;
    position: absolute;
    z-index: -1;
    opacity: 0;
    width: 1px;
    height: 1px;
}

/* =========================================
   Alignment Helpers (Elementor Controls)
   ========================================= */

/* LEFT (Default) */
.elementor-align-left .elementor-variation-swatches-wrapper {
    align-items: flex-start;
}

.elementor-align-left .evs-attribute-row {
    align-items: flex-start;
}

.elementor-align-left .evs-swatches-container {
    justify-content: flex-start;
}

.elementor-align-left .evs-attribute-label {
    text-align: left;
}

/* CENTER */
.elementor-align-center .elementor-variation-swatches-wrapper {
    align-items: center;
}

.elementor-align-center .evs-attribute-row {
    align-items: center;
}

.elementor-align-center .evs-swatches-container {
    justify-content: center;
}

.elementor-align-center .evs-attribute-label {
    text-align: center;
}

/* RIGHT */
.elementor-align-right .elementor-variation-swatches-wrapper {
    align-items: flex-end;
}

.elementor-align-right .evs-attribute-row {
    align-items: flex-end;
}

.elementor-align-right .evs-swatches-container {
    justify-content: flex-end;
}

.elementor-align-right .evs-attribute-label {
    text-align: right;
}

/* JUSTIFY */
.elementor-align-justify .elementor-variation-swatches-wrapper {
    align-items: stretch;
}

.elementor-align-justify .evs-attribute-row {
    align-items: stretch;
}

.elementor-align-justify .evs-swatches-container {
    justify-content: flex-start;
    /* Swatches usually flow, justify might look weird if space-between */
}

.elementor-align-justify .evs-attribute-label {
    text-align: justify;
}

/* Add to Cart Section Alignment */
.elementor-align-left .evs-add-to-cart-section,
.elementor-align-left .variations_button {
    justify-content: flex-start;
}

.elementor-align-center .evs-add-to-cart-section,
.elementor-align-center .variations_button {
    justify-content: center;
}

.elementor-align-right .evs-add-to-cart-section,
.elementor-align-right .variations_button {
    justify-content: flex-end;
}

.elementor-align-justify .evs-add-to-cart-section,
.elementor-align-justify .variations_button {
    justify-content: space-between;
}
