/**
 * Frontend styles
 */

/* Only hide default dropdowns when swatches are shown */
.wc-variation-swatches-active .variations select {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}


table.variations td.value {
    position: relative;
}

/* Also ensure the hidden-select container is properly hidden */
.hidden-select {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
}

/* Hide the default select dropdown when swatches are enabled */
.wc-variation-swatches + .hidden-select {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
}

/* Also hide the native WooCommerce dropdown that's inside the hidden-select div */
.hidden-select select {
    display: none !important;
    visibility: hidden !important;
}

/* Swatches container */
.wc-variation-swatches {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -5px 10px;
}

/* Individual swatch */
.wc-variation-swatches .swatch {
    margin: 5px;
    cursor: pointer;
    position: relative;
    text-align: center;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    transition: all 0.3s;
}

/* Square swatches */
.wc-variation-swatches .swatch {
    border-radius: 2px;
}

/* Rounded swatches */
.wc-variation-swatches .swatch.swatch-rounded {
    border-radius: 5px;
}

/* Circle swatches */
.wc-variation-swatches .swatch.swatch-circle {
    border-radius: 50%;
}

/* Inner content */
.wc-variation-swatches .swatch .swatch-inner {
    width: 100%;
    height: 100%;
    display: block;
}

/* Color swatches */
.wc-variation-swatches .swatch-color .swatch-inner {
    border-radius: inherit;
}

/* Image swatches */
.wc-variation-swatches .swatch-image .swatch-inner {
    overflow: hidden;
}

.wc-variation-swatches .swatch-image .swatch-inner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Button swatches */
.wc-variation-swatches .swatch-button .swatch-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-size: 12px;
    line-height: 1.2;
}

/* Radio swatches */
.wc-variation-swatches .swatch-radio {
    display: flex;
    align-items: center;
    width: auto !important;
    height: auto !important;
    min-height: 30px;
    padding: 0 10px;
}

.wc-variation-swatches .swatch-radio label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
}

.wc-variation-swatches .swatch-radio input[type="radio"] {
    margin-right: 5px;
}

/* Selected state */
.wc-variation-swatches .swatch.selected {
    border-color: #777;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
}

/* Disabled state */
.wc-variation-swatches .swatch.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Cross out of stock */
.wc-variation-swatches .swatch.disabled.cross:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ff0000;
    transform: rotate(-45deg);
    z-index: 1;
}

.wc-variation-swatches .swatch.disabled.cross:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ff0000;
    transform: rotate(45deg);
    z-index: 1;
}

/* Blur out of stock */
.wc-variation-swatches .swatch.disabled.blur {
    filter: blur(1px);
}

/* Tooltip */
.wc-variation-swatches .swatch[data-tooltip]:hover:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
    min-width: 50px;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
    background: #000;
    color: #fff;
    text-align: center;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 20;
}

.wc-variation-swatches .swatch[data-tooltip]:hover:after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: #000 transparent transparent;
    z-index: 20;
}

/* Variation description */
.wc-variation-description {
    margin-bottom: 15px;
    padding: 10px 0;
    border-top: 1px solid #eeeeee;
    border-bottom: 1px solid #eeeeee;
    font-style: italic;
    font-size: 0.9em;
}

/* Make sure description only appears once */
.wc-variation-description:empty {
    display: none;
}

/* Hide WooCommerce's variation description completely */
.woocommerce-variation-description {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide the entire variation container if needed */
.single-product .woocommerce-variation:empty {
    display: none !important;
}


/* Swatches on shop/archive pages */
.wc-variation-swatches-loop {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.wc-variation-swatches-loop .swatch {
    margin: 3px;
}
