/* ==========================================================================
   LSC Swatches — Frontend Styles
   ========================================================================== */

/* Hide the native WooCommerce select dropdowns that we've replaced */
.lsc-swatches-wrapper > .variations select,
.lsc-swatches-wrapper > select {
    display: none !important;
}

/* Also target the select when it's a sibling rendered by WC */
.variations td .lsc-swatches-wrapper select {
    display: none !important;
}

/* ==========================================================================
   Swatch List
   ========================================================================== */

.lsc-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 8px 0 4px;
    padding: 0;
}

/* ==========================================================================
   Individual Swatch
   ========================================================================== */

.lsc-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    background: #fff;
    overflow: hidden;
    user-select: none;
}

.lsc-swatch:hover:not(.lsc-swatch--oos):not(.lsc-swatch--selected) {
    border-color: #999;
}

/* Keyboard focus only — :focus-visible suppresses outline on mouse click */
.lsc-swatch:focus {
    outline: none;
}

.lsc-swatch:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Selected state — single clean teal ring */
.lsc-swatch--selected {
    border-color: #009aa6;
    box-shadow: none;
}

/* ==========================================================================
   Image Swatches
   ========================================================================== */

.lsc-swatches--image .lsc-swatch {
    width: 64px;
    height: 64px;
    padding: 0;
}

.lsc-swatches--image .lsc-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    pointer-events: none;
}

/* ==========================================================================
   Text Swatches
   ========================================================================== */

.lsc-swatches--text .lsc-swatch {
    min-width: 48px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-radius: 6px;
}

.lsc-swatches--text .lsc-swatch .lsc-swatch__label {
    pointer-events: none;
    line-height: 1;
}

/* ==========================================================================
   Out of Stock
   ========================================================================== */

.lsc-swatch--oos {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none; /* prevent click */
}

/* Diagonal strikethrough line */
.lsc-swatch--oos::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top right,
        transparent calc(50% - 1px),
        #999 calc(50% - 1px),
        #999 calc(50% + 1px),
        transparent calc(50% + 1px)
    );
    border-radius: 4px;
    pointer-events: none;
}

/* ==========================================================================
   Selected Value Display (shown above swatches inside wrapper)
   ========================================================================== */

.lsc-selected-value {
    font-weight: 600;
    font-size: inherit;
    color: inherit;
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.lsc-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

.lsc-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.lsc-swatch:hover .lsc-tooltip,
.lsc-swatch:focus .lsc-tooltip {
    opacity: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media ( max-width: 480px ) {
    .lsc-swatches--image .lsc-swatch {
        width: 52px;
        height: 52px;
    }

    .lsc-swatches--text .lsc-swatch {
        min-width: 40px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }
}
