/**
 * Variation Swatches - Shop/Archive Styles
 */

.dnwooe-shop-swatches-wrapper {
    margin: 10px 0;
}

.dnwooe-shop-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.dnwooe-swatches-label {
    font-weight: 600;
    margin-right: 5px;
}

.dnwooe-selected-value {
    font-weight: 400;
    margin-right: 8px;
}

.dnwooe-swatches-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.dnwooe-swatch-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-sizing: border-box;
}

.dnwooe-swatch-item:hover {
    transform: scale(1.05);
    z-index: 2;
}

.dnwooe-swatch-item.selected:not(.dnwooe-swatch-color):not(.dnwooe-swatch-image) {
    box-shadow: 0 0 0 2px #333;
}

/* Button type swatches */
.dnwooe-swatch-button.dnwooe-swatch-color .dnwooe-swatch-text,
.dnwooe-swatch-button.dnwooe-swatch-image .dnwooe-swatch-text {
    /* hide label text only when this button is a color or image swatch */
    display: none;
}

/* Ensure text is visible for text-only button swatches */
.dnwooe-swatch-item .dnwooe-swatch-text {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.dnwooe-swatch-item .dnwooe-swatch-radio-label {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Exact button-style swatches: rectangular colored blocks with white inner ring and dark outer border */
.dnwooe-swatch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; /* exact width for color button */
    height: 24px; /* exact height for color button */
    min-width: 52px;
    min-height: 24px;
    padding: 0;
    border-radius: 2px; /* small radius */
    /* border controlled by SwatchRenderer inline CSS */
    box-shadow: none;
    background-clip: padding-box;
    opacity: 1;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.dnwooe-swatch-button .dnwooe-swatch-color,
.dnwooe-swatch-button[style] {
    /* ensure the inline background-color fills the inner area */
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-clip: padding-box;
}

.dnwooe-swatch-button:hover {
    transform: translateY(-2px);
    border-color: #30374f;
}

.dnwooe-swatch-button.selected {
    box-shadow: 0 0 0 2px rgba(3,2,19,0.95);
    border-color: #0b0b1a;
}

/* Button-like swatch visuals (rectangular color blocks with inner white ring and outer dark border)
   Target non-radio / non-checkbox swatch items so radio/checkbox styles remain unchanged. */
.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-radio):not(.dnwooe-swatch-checkbox) {
    border-radius: 6px;
    box-shadow: none;
    padding: 6px 14px;
    min-width: 44px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-clip: padding-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-radio):not(.dnwooe-swatch-checkbox) .dnwooe-swatch-text {
    padding: 0;
    margin: 0;
}

.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-radio):not(.dnwooe-swatch-checkbox):hover {
    transform: translateY(-2px);
    border-color: #30374f;
}

.dnwooe-shop-swatches .dnwooe-swatch-item.selected:not(.dnwooe-swatch-radio):not(.dnwooe-swatch-checkbox) {
    box-shadow: 0 0 0 2px rgba(3,2,19,0.9);
}

/* Color type swatches */
.dnwooe-swatch-color {
    border-radius: 50%;
}

/* Image type swatches */
.dnwooe-swatch-image {
    overflow: hidden;
}

/* Tooltip styles */
.dnwooe-swatch-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: #1a1a2e;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    pointer-events: none;
    margin-bottom: 8px;
}

/* Image tooltip specific styles */
.dnwooe-swatch-tooltip.tooltip-image {
    padding: 8px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dnwooe-swatch-tooltip.tooltip-image img {
    display: block;
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 4px;
}

.dnwooe-swatch-tooltip img {
    display: block;
    max-width: 60px;
    max-height: 60px;
    margin: 0 auto 4px;
    border-radius: 2px;
}

.dnwooe-swatch-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1a1a2e transparent transparent transparent;
}

.dnwooe-swatch-tooltip.tooltip-image::after {
    border-color: #ddd transparent transparent transparent;
}

.dnwooe-swatch-tooltip.tooltip-bottom {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 8px;
}

.dnwooe-swatch-tooltip.tooltip-bottom::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #1a1a2e transparent;
}

.dnwooe-swatch-tooltip.tooltip-image.tooltip-bottom::after {
    border-color: transparent transparent #ddd transparent;
}

.dnwooe-swatch-item:hover .dnwooe-swatch-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Ensure tooltips are visible for all swatch types */
.dnwooe-swatch-checkbox:hover .dnwooe-swatch-tooltip,
.dnwooe-custom-select__option:hover .dnwooe-swatch-tooltip {
    opacity: 1;
    visibility: visible;
}

.dnwooe-swatch-tooltip img {
    display: block;
    max-width: 60px;
    height: auto;
    margin-bottom: 5px;
    border-radius: 2px;
}

/* Disabled styles */
.dnwooe-swatch-item.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

/* More items indicator */
.dnwooe-swatch-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
}

/* Variation form styles */
.dnwooe-variations-form {
    margin-top: 10px;
}

.dnwooe-variations-form .variations {
    margin-bottom: 10px;
}

.dnwooe-variations-form .variations th.label,
.dnwooe-variations-form .variations td.value {
    vertical-align: middle;
}

.dnwooe-variations-form .variations td.value .dnwooe-shop-swatches,
body.woocommerce div.product form.cart .variations td.value .dnwooe-shop-swatches {
    margin: 0;
    justify-content: flex-start;
}

.dnwooe-variations-form .single_variation_wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.dnwooe-variations-form .woocommerce-variation {
    margin-bottom: 10px;
}

.dnwooe-variations-form .woocommerce-variation-price {
    font-weight: 600;
    margin-bottom: 5px;
}

.dnwooe-variations-form .variations_button {
    display: flex;
    gap: 10px;
    flex-direction: column;
    display: flex;
    width: 260px;
    padding: 8px 0;
    gap: 8px;
}
.dnwooe-variations-form .single_variation_wrap .single_add_to_cart_button {
    font-size: 14px !important;
    border-radius: 8px !important;
    background: #030213 !important;
    border: 1px solid #030213 !important;
    color: #fff !important;
    padding: 8px 0 !important;
}

.dnwooe-variations-form .quantity {
    width: auto;
}

.dnwooe-variations-form .quantity .qty {
    width: 60px;
    padding: 8px;
    text-align: center;
}

.dnwooe-variations-form .single_add_to_cart_button {
    flex: 1;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dnwooe-variations-form .single_add_to_cart_button svg {
    flex-shrink: 0;
}

.dnwooe-variations-form .single_add_to_cart_button::after {
    display: none !important;
}

/* Hide the hidden select */
.dnwooe-hidden-select {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
}

/* Visible native select when configured */
.dnwooe-visible-select {
    position: relative !important;
    clip: auto !important;
    padding: 6px 8px !important;
    border: 1px solid #ccc !important;
    height: auto !important;
    width: auto !important;
    min-width: 150px;
    display: inline-block !important;
    vertical-align: middle;
    margin-right: 8px;
    background: #fff;
}

/* Radio-style swatch visuals – full circle */
.dnwooe-swatch-radio {
    border-radius: 99px !important;
    border: 1px solid #DCDFEA;
    background: #F9F9FB;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    aspect-ratio: 1 / 1;
}

/* Hide text inside radio circles – tooltip shows on hover instead */
.dnwooe-swatch-radio-label,
.dnwooe-swatch-radio .dnwooe-swatch-text {
    display: none !important;
}

.dnwooe-swatch-radio:hover {
    border-color: #30374F;
}

.dnwooe-swatch-radio.selected {
    background: #30374F;
    border-color: #30374F;
    box-shadow: none;
}


/* Text-only swatches (size labels) exact dimensions and border
   Targets items that are not color/image swatches so color blocks remain unaffected. */
/* Make every attribute type use the color-button size */
.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-radio):not(.dnwooe-swatch-checkbox) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 36px;
    min-width: 52px;
    min-height: 36px;
    padding: 2px 10px 2px 10px; /* top/right/bottom/left */
    border-radius: 2px;
    background: #fff;
    opacity: 1;
}

.dnwooe-shop-swatches .dnwooe-swatch-item .dnwooe-swatch-text {
    padding: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1;
    font-weight: 600;
}

.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-color):not(.dnwooe-swatch-image):hover {
    transform: translateY(-1px);
    border-color: #30374f;
}

.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-color):not(.dnwooe-swatch-image).selected {
    background: #1a1a2e;
    border-color: #1a1a2e;
}

.dnwooe-shop-swatches .dnwooe-swatch-item:not(.dnwooe-swatch-color):not(.dnwooe-swatch-image).selected .dnwooe-swatch-text {
    color: #fff !important;
}

/* Ensure swatches flow without overlapping the select */
.dnwooe-shop-swatches .dnwooe-swatch-item {
    margin-left: 4px;
}
body.woocommerce div.product form.cart table.variations {
    width: auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}
body.woocommerce div.product form.cart .variations tr {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}
body.woocommerce div.product form.cart .variations th.label {
    width: auto !important;
    white-space: nowrap;
    padding: 0 !important;
}
body.woocommerce div.product form.cart .variations td.value {
    padding: 0 !important;
}

/* Custom Select Dropdown */
.dnwooe-custom-select {
    position: relative;
    display: inline-block;
    width: 240px;
}

.dnwooe-custom-select__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #DCDFEA;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.dnwooe-custom-select__trigger:hover,
.dnwooe-custom-select.open .dnwooe-custom-select__trigger {
    border-color: #30374F;
}

.dnwooe-custom-select__color-dot {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dnwooe-custom-select__text {
    flex: 1;
    color: #30374F;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dnwooe-custom-select__arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dnwooe-custom-select.open .dnwooe-custom-select__arrow {
    transform: rotate(180deg);
}

.dnwooe-custom-select__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #DCDFEA;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    box-sizing: border-box;
}

.dnwooe-custom-select.open .dnwooe-custom-select__dropdown {
    display: block;
}

.dnwooe-custom-select__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #30374F;
    line-height: 20px;
    transition: background-color 0.15s ease;
}

.dnwooe-custom-select__option:hover {
    background-color: #F5F6FA;
}

.dnwooe-custom-select__option.selected {
    background-color: #EEF0F6;
}

.dnwooe-custom-select__option-dot {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Checkbox style swatches — color/image swatches with checkmark overlay */
.dnwooe-swatch-checkbox {
    border-radius: 2px !important;
    position: relative;
}

.dnwooe-swatch-checkbox:hover {
    transform: scale(1.1);
}

.dnwooe-swatch-checkbox.selected {
    box-shadow: none !important;
}

/* Non-color checkbox swatches (text labels like Size) */
.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text {
    background: #f5f5f5;
}

.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text .dnwooe-swatch-text {
    font-size: 14px;
    font-weight: 700;
    color: #30374F;
    padding: 0;
    white-space: nowrap;
}

.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text.selected {
    background: #30374F !important;
    border-color: #30374F !important;
}

.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text.selected .dnwooe-swatch-text {
    color: #fff;
}

.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text.disabled {
    opacity: 0.5;
}

.dnwooe-checkbox-tick {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.dnwooe-swatch-checkbox.selected .dnwooe-checkbox-tick {
    opacity: 1;
}

/* Hide checkmark on text-only checkbox swatches (they use bg color change instead) */
.dnwooe-swatch-checkbox.dnwooe-swatch-checkbox--text .dnwooe-checkbox-tick {
    display: none;
}

.dnwooe-swatch-checkbox.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}