/* Main Wrapper */
.evs-add-to-cart-section .single_add_to_cart_button[hidden] { display: none !important; }
.evs-artwork {
    border: 1px solid #d8dcda;
    border-radius: 4px;
    padding: 12px;
    margin: 12px 0 16px;
    min-width: 0;
}

.evs-artwork legend { font-family: inherit; font-size: inherit; font-weight: bold; line-height: inherit; color: inherit; padding: 0 4px; }
.evs-artwork small { display: block; margin-top: 8px; font-size: 12px; }
.evs-artwork-input[hidden] { display: none !important; }
.evs-artwork-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 4px; }
.evs-artwork-actions .evs-artwork-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    gap: 7px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #d8dcda;
    border-radius: 5px;
    background: #fff;
    color: #26352f;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
    cursor: pointer;
    box-shadow: none;
}
.evs-artwork-actions .evs-artwork-button:hover:not(:disabled) { background: #edf0ee; color: #26352f; border-color: #b7c4bb; }
.evs-artwork-actions .evs-artwork-upload-button { background: #26352f; color: #fff; border-color: #26352f; }
.evs-artwork-actions .evs-artwork-upload-button:hover:not(:disabled) { background: #394d43; color: #fff; border-color: #394d43; }
.evs-artwork-actions .evs-artwork-button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.evs-artwork-actions .evs-artwork-button:disabled { opacity: 0.5; cursor: wait; }
.evs-artwork button { font: inherit; border-radius: 3px; padding: 6px 9px; cursor: pointer; }
.evs-artwork-selected { list-style: none; padding: 0; margin: 8px 0 0; }
.evs-artwork-selected li,
.evs-artwork-library-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0ee; }
.evs-artwork-selected span,
.evs-artwork-library-item span { min-width: 0; overflow-wrap: anywhere; }
.evs-artwork .evs-artwork-file-info { min-width: 0; }
.evs-artwork .evs-artwork-file-name { display: block; font-size: 13px; line-height: 1.4; }
.evs-artwork .evs-artwork-file-info small { margin: 3px 0 0; font-size: 11px; color: #6a746e; }
.evs-artwork button.evs-artwork-thumbnail { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; padding: 3px; margin: 0; border: 1px solid #dfe4e0; border-radius: 4px; background: #f5f7f5; color: #536358; overflow: hidden; }
.evs-artwork-thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; }
.evs-artwork-format { font-size: 10px; font-weight: 600; line-height: 1; }
.evs-artwork button.evs-artwork-remove { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; margin: 0; font-size: 18px; border: 0; background: transparent; color: #6a746e; border-radius: 4px; }
.evs-artwork button.evs-artwork-remove:hover { color: #b42318; background: #fff0ed; border: 0; }
.evs-artwork button.evs-artwork-select { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; margin: 0; padding: 5px 7px; font-size: 12px; line-height: 1.2; border: 1px solid #d8dcda; border-radius: 4px; color: #26352f; background: #fff; white-space: normal; max-width: 112px; }
.evs-artwork button.evs-artwork-select:hover:not(:disabled) { background: #edf0ee; color: #26352f; border-color: #b7c4bb; }
.evs-artwork button.evs-artwork-select:disabled { color: #47624f; background: #f1f5f1; border-color: transparent; cursor: default; }
.evs-artwork .dashicons { flex-shrink: 0; font-size: 18px; width: 18px; height: 18px; }
.evs-artwork-library { max-height: 260px; overflow-y: auto; margin-top: 8px; border-top: 1px solid #d8dcda; }
.evs-artwork-status { margin: 8px 0 0; overflow-wrap: anywhere; }
.evs-artwork-status:empty { display: none; }

.evs-artwork-lightbox { width: min(960px, calc(100% - 32px)); max-width: calc(100% - 32px); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 6px; background: #fff; color: #26352f; box-sizing: border-box; }
.evs-artwork-lightbox::backdrop { background: rgba(0, 0, 0, 0.72); }
.evs-artwork-lightbox header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #e5e9e6; }
#evs-artwork-preview-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
.evs-artwork-lightbox .evs-artwork-close,
.evs-artwork-lightbox .evs-artwork-download { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; margin: 0; border: 0; border-radius: 4px; color: #26352f; background: #f2f5f2; cursor: pointer; text-decoration: none; }
.evs-artwork-lightbox .evs-artwork-close:hover,
.evs-artwork-lightbox .evs-artwork-download:hover { background: #e4eae5; }
.evs-artwork-preview-body { display: flex; justify-content: center; align-items: center; min-height: 180px; padding: 16px; box-sizing: border-box; }
.evs-artwork-preview-body img { display: block; max-width: 100%; max-height: calc(100dvh - 140px); width: auto; height: auto; object-fit: contain; }

.evs-inline-grouped .evs-grouped-options {
    display: grid;
    gap: 4px;
    margin-top: 6px;
    min-width: 0;
}

.evs-inline-grouped .evs-grouped-options label {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 400;
    margin: 4px 0 0;
}

.evs-inline-grouped .evs-grouped-options select {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 34px;
    margin: 0;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: normal;
    letter-spacing: 0;
    color: inherit;
    background-color: #fff;
    border: 1px solid #d8dcda;
    border-radius: 3px;
    box-shadow: none;
    cursor: pointer;
}

.evs-inline-grouped .evs-grouped-options select:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.evs-grouped-status {
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.evs-grouped-status:empty {
    display: none;
}

.evs-grouped-price,
.evs-grouped-stock {
    display: block;
}

.evs-grouped-product,
.evs-inline-grouped {
    container-type: inline-size;
    min-width: 0;
}

.evs-grouped-product .group_table,
.evs-inline-grouped table {
    width: 100%;
    table-layout: auto;
}

.evs-grouped-product .group_table td,
.evs-inline-grouped td {
    vertical-align: top;
    overflow-wrap: anywhere;
}

.evs-grouped-product .woocommerce-grouped-product-list-item__quantity,
.evs-inline-grouped .woocommerce-grouped-product-list-item__quantity {
    width: 1%;
    min-width: 9rem;
}

.evs-grouped-product .woocommerce-grouped-product-list-item__quantity .button,
.evs-inline-grouped .woocommerce-grouped-product-list-item__quantity .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.35;
}

.evs-grouped-product .woocommerce-grouped-product-list-item__price,
.evs-inline-grouped .woocommerce-grouped-product-list-item__price {
    width: 27%;
    overflow-wrap: normal;
}

/* Product columns can be narrow even on a wide desktop viewport. */
@container (max-width: 600px) {
    .evs-grouped-product .group_table,
    .evs-grouped-product .group_table tbody,
    .evs-inline-grouped table,
    .evs-inline-grouped tbody {
        display: block;
    }

    .evs-grouped-product .group_table tr,
    .evs-inline-grouped tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        padding: 12px 0;
    }

    .evs-grouped-product .group_table td,
    .evs-inline-grouped td,
    .evs-inline-grouped .woocommerce-grouped-product-list-item__quantity,
    .evs-inline-grouped .woocommerce-grouped-product-list-item__price {
        display: block;
        width: auto;
        min-width: 0;
        padding: 0 8px;
    }

    .evs-grouped-product .woocommerce-grouped-product-list-item__label,
    .evs-inline-grouped .woocommerce-grouped-product-list-item__label {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

@media (max-width: 600px) {
    .evs-grouped-product .group_table,
    .evs-grouped-product .group_table tbody,
    .evs-inline-grouped table,
    .evs-inline-grouped tbody {
        display: block;
    }

    .evs-grouped-product .group_table tr,
    .evs-inline-grouped tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        padding: 12px 0;
    }

    .evs-grouped-product .group_table td,
    .evs-inline-grouped td {
        display: block;
        width: auto;
        min-width: 0;
        padding: 0 8px;
    }

    .evs-grouped-product .woocommerce-grouped-product-list-item__label,
    .evs-inline-grouped .woocommerce-grouped-product-list-item__label {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .evs-grouped-product .woocommerce-grouped-product-list-item__price,
    .evs-inline-grouped .woocommerce-grouped-product-list-item__price {
        width: auto;
    }
}

.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;
}
