/* LCSW Swatches Frontend Styles */

/* Hide default WooCommerce attribute selects immediately when LCSW is active */
.variations_form select[name^="attribute_pa_cores"] {
    display: none !important;
}

.lcsw-swatches {
    margin: 15px 0;
}

.lcsw-swatches-label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.lcsw-swatches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lcsw-swatch {
    position: relative;
    display: inline-block;
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.lcsw-swatch:hover {
    border: 2px solid var(--lcsw-hover-color, #333);
    transform: var(--lcsw-hover-transform, scale(1.1));
}

.lcsw-swatch.selected {
    border: 3px solid var(--lcsw-selected-color, #aa0000);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* .lcsw-swatch:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
} */

.lcsw-swatch[data-linked-product] {
    position: relative;
}

/* .lcsw-swatch[data-linked-product]:after {
    content: "🔗";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    background: #0073aa;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
} */

.lcsw-swatch-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    margin-bottom: 5px;
}

.lcsw-swatch-tooltip:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

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

/* Hide only the specific select that has swatches */
.lcsw-hide-original .variations select.lcsw-hidden-select {
    display: none !important;
}

/* Ensure other selects remain visible */
.lcsw-hide-original .variations select:not(.lcsw-hidden-select) {
    display: block !important;
}

.lcsw-hide-original .variations .woocommerce-variation-availability {
    margin-top: 10px;
}

/* Loading state */
.lcsw-swatch.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.lcsw-swatch.loading:after {
    content: "⏳";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .lcsw-swatch {
        width: 35px;
        height: 35px;
    }
    
    .lcsw-swatches-list {
        gap: 8px;
    }
}

/* Fallback for terms without color/image */
.lcsw-swatch.fallback {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
    padding: 2px;
    word-break: break-word;
}

/* Square swatches option */
.lcsw-swatches.square .lcsw-swatch {
    border-radius: 4px;
}

/* Different sizes */
.lcsw-swatches.small .lcsw-swatch {
    width: 30px;
    height: 30px;
}

.lcsw-swatches.medium .lcsw-swatch {
    width: 40px;
    height: 40px;
}

.lcsw-swatches.large .lcsw-swatch {
    width: 50px;
    height: 50px;
}