/**
 * Color Swatches Styling
 * Styles for the Elementor Color Swatches widget
 */

/* Widget Container */
.roxyrich-color-swatches-widget {
    margin: 0;
}

/* Label */
.color-swatches-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-transform: capitalize;
}

/* Swatches Container */
.color-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Individual Color Swatch */
.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid #d0d0d0;
    border-width: 1px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 4px #ffffff;
}

/* Tooltip on hover */
.color-swatch::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

/* Tooltip arrow */
.color-swatch::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

/* Show tooltip on hover */
.color-swatch:hover::before,
.color-swatch:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Hover State */
.color-swatch:hover {
    border-color: #999;
    transform: scale(1.5);
    z-index: 10;
    box-shadow: inset 0 0 0 4px #ffffff, 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Selected State */
.color-swatch.selected {
    border-color: #000 !important;
    border-width: 3px !important;
}

/* Disabled/Out of Stock State */
.color-swatch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    position: relative;
}

/* Use a pseudo-element for disabled line (before tooltip) */
.color-swatch.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #999;
    transform: translate(-50%, -50%) rotate(-45deg);
    opacity: 1 !important;
    visibility: visible !important;
    border: none;
    padding: 0;
    border-radius: 0;
    z-index: 1;
}

.color-swatch.disabled:hover {
    transform: none;
}

/* Hide tooltip on disabled swatches */
.color-swatch.disabled:hover::after {
    display: none;
}

/* Hide WooCommerce default variation select when using swatches */
body.single-product .variations select[name*="color"],
body.single-product .variations select[name*="colour"],
body.single-product .variations select[name*="couleur"] {
    display: none !important;
}

/* Hide the entire table row for color attribute */
body.single-product .variations tr:has(select[name*="color"]),
body.single-product .variations tr:has(select[name*="colour"]),
body.single-product .variations tr:has(select[name*="couleur"]) {
    display: none !important;
}

/* Fallback: hide by attribute name in label */
body.single-product .variations tr:has(label:contains("Color")),
body.single-product .variations tr:has(label:contains("Colour")),
body.single-product .variations tr:has(label:contains("Couleur")) {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .color-swatch {
        width: 45px;
        height: 45px;
        box-shadow: inset 0 0 0 3px #ffffff;
    }

    .color-swatch.selected {
        box-shadow: inset 0 0 0 3px #ffffff;
    }

    .color-swatches-container {
        gap: 10px;
    }
}
