/**
 * Attribute Swatches Styles - Modern Design
 * WinkelvanHugo
 */

/* ==========================================================================
   SWATCHES CONTAINER
   ========================================================================== */

.lbc-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
}

/* ==========================================================================
   BASE SWATCH
   ========================================================================== */

.lbc-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
}

.lbc-swatch:hover {
    transform: scale(1.08);
}

.lbc-swatch.is-selected {
    transform: scale(1.02);
}

.lbc-swatch:focus {
    outline: 2px solid #FF5A4D;
    outline-offset: 2px;
}

/* ==========================================================================
   COLOR SWATCH
   ========================================================================== */

.lbc-swatch--color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.12);
}

.lbc-swatch--color:hover {
    box-shadow: 
        0 0 0 3px #FF5A4D,
        0 4px 12px rgba(255, 90, 77, 0.3);
    transform: scale(1.1);
}

.lbc-swatch--color.is-selected {
    box-shadow: 
        0 0 0 3px #FF5A4D,
        0 4px 16px rgba(255, 90, 77, 0.35);
}

/* Checkmark for selected color - CSS-based checkmark */
.lbc-swatch--color .lbc-swatch__check {
    display: none;
    width: 14px;
    height: 14px;
    position: relative;
}

.lbc-swatch--color .lbc-swatch__check::before,
.lbc-swatch--color .lbc-swatch__check::after {
    content: '';
    position: absolute;
    background: #ffffff;
    border-radius: 2px;
}

/* Long part of checkmark */
.lbc-swatch--color .lbc-swatch__check::before {
    width: 3px;
    height: 12px;
    top: 0;
    left: 9px;
    transform: rotate(40deg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Short part of checkmark */
.lbc-swatch--color .lbc-swatch__check::after {
    width: 3px;
    height: 6px;
    top: 6px;
    left: 3px;
    transform: rotate(-50deg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.lbc-swatch--color.is-selected .lbc-swatch__check {
    display: block;
}

/* Light colors need dark checkmark */
.lbc-swatch--color.lbc-swatch--light {
    border-color: #e5e5e5;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.lbc-swatch--color.lbc-swatch--light .lbc-swatch__check::before,
.lbc-swatch--color.lbc-swatch--light .lbc-swatch__check::after {
    background: #333333;
    box-shadow: none;
}

/* ==========================================================================
   SIZE SWATCH
   ========================================================================== */

.lbc-swatch--size {
    min-width: 48px;
    height: 48px;
    padding: 0 16px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #555;
}

.lbc-swatch--size:hover {
    background: #ffffff;
    border-color: #FF5A4D;
    color: #FF5A4D;
    box-shadow: 0 4px 12px rgba(255, 90, 77, 0.15);
}

.lbc-swatch--size.is-selected {
    background: linear-gradient(135deg, #FF5A4D 0%, #FF7B6E 100%);
    border-color: #FF5A4D;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(255, 90, 77, 0.3);
}

/* ==========================================================================
   TEXT/LABEL SWATCH (fallback for colors without hex)
   ========================================================================== */

.lbc-swatch--text {
    min-width: auto;
    height: 40px;
    padding: 0 16px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.lbc-swatch--text:hover {
    border-color: #FF5A4D;
    color: #FF5A4D;
    background: #fff8f3;
}

.lbc-swatch--text.is-selected {
    background: linear-gradient(135deg, #FF5A4D 0%, #FF7B6E 100%);
    border-color: #FF5A4D;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 90, 77, 0.25);
}

.lbc-swatch--text .lbc-swatch__label {
    white-space: nowrap;
}

/* ==========================================================================
   IMAGE SWATCH
   ========================================================================== */

.lbc-swatch--image {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 3px solid transparent;
    overflow: hidden;
    padding: 0;
}

.lbc-swatch--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lbc-swatch--image:hover {
    border-color: #FF5A4D;
}

.lbc-swatch--image.is-selected {
    border-color: #FF5A4D;
    box-shadow: 0 4px 16px rgba(255, 90, 77, 0.3);
}

/* ==========================================================================
   DISABLED / OUT OF STOCK - DUIDELIJK ZICHTBAAR
   ========================================================================== */

.lbc-swatch.is-disabled,
.lbc-swatch[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
    filter: grayscale(100%);
}

/* Rode streep door uitverkochte optie - using inner span */
.lbc-swatch.is-disabled .lbc-swatch__strike,
.lbc-swatch[disabled] .lbc-swatch__strike {
    display: block;
    position: absolute;
    top: 50%;
    left: -4px;
    right: -4px;
    height: 3px;
    background: #e53935;
    transform: rotate(-45deg);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(229, 57, 53, 0.5);
    z-index: 10;
}

.lbc-swatch__strike {
    display: none;
}

/* Extra duidelijk voor kleur swatches */
.lbc-swatch--color.is-disabled .lbc-swatch__strike,
.lbc-swatch--color[disabled] .lbc-swatch__strike {
    left: -2px;
    right: -2px;
}

/* Extra styling voor maat/text swatches */
.lbc-swatch--size.is-disabled,
.lbc-swatch--size[disabled],
.lbc-swatch--text.is-disabled,
.lbc-swatch--text[disabled] {
    background: #f8f8f8 !important;
    border-color: #e0e0e0 !important;
    color: #bbb !important;
}

/* Disabled text swatches - strike through text */
.lbc-swatch--text.is-disabled .lbc-swatch__strike,
.lbc-swatch--text[disabled] .lbc-swatch__strike {
    left: 10%;
    right: 10%;
    height: 2px;
}

/* ==========================================================================
   SWATCH TOOLTIP - Using JavaScript-controlled element
   ========================================================================== */

.lbc-swatch-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 6px 12px;
    background: #1a1a2e;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

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

.lbc-swatch:hover .lbc-swatch-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Disabled tooltip - red version */
.lbc-swatch.is-disabled .lbc-swatch-tooltip,
.lbc-swatch[disabled] .lbc-swatch-tooltip {
    background: #e53935;
}

.lbc-swatch.is-disabled .lbc-swatch-tooltip::after,
.lbc-swatch[disabled] .lbc-swatch-tooltip::after {
    border-top-color: #e53935;
}

/* ==========================================================================
   SINGLE PRODUCT SWATCHES
   ========================================================================== */

.single-product .lbc-swatches {
    gap: 12px;
}

.single-product .lbc-swatch--color {
    width: 44px;
    height: 44px;
}

.single-product .lbc-swatch--color .lbc-swatch__check {
    width: 16px;
    height: 16px;
}

.single-product .lbc-swatch--color .lbc-swatch__check::before {
    height: 14px;
    left: 10px;
}

.single-product .lbc-swatch--color .lbc-swatch__check::after {
    height: 7px;
    top: 7px;
}

.single-product .lbc-swatch--size {
    min-width: 56px;
    height: 56px;
    font-size: 15px;
}

.single-product .lbc-swatch--text {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
}

/* ==========================================================================
   VARIATION FORM STYLING
   ========================================================================== */

.variations {
    margin-bottom: 24px;
}

.variations tr {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.variations tr:last-child {
    margin-bottom: 0;
}

.variations .label {
    display: block;
}

.variations .label label {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variations .value {
    display: block;
}

/* Hide default select when swatches are shown */
.variations .lbc-swatches + select {
    display: none;
}

/* Reset link */
.reset_variations {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 13px;
    color: #999;
    transition: color 0.2s ease;
}

.reset_variations:hover {
    color: #e53935;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .lbc-swatch--color {
        width: 36px;
        height: 36px;
    }
    
    .lbc-swatch--color .lbc-swatch__check {
        width: 12px;
        height: 12px;
    }
    
    .lbc-swatch--color .lbc-swatch__check::before {
        height: 10px;
        left: 7px;
    }
    
    .lbc-swatch--color .lbc-swatch__check::after {
        height: 5px;
        top: 5px;
        left: 2px;
    }
    
    .lbc-swatch--size {
        min-width: 44px;
        height: 44px;
        font-size: 13px;
    }
    
    .lbc-swatch--text {
        height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }
    
    .single-product .lbc-swatch--color {
        width: 40px;
        height: 40px;
    }
    
    .single-product .lbc-swatch--size {
        min-width: 50px;
        height: 50px;
    }
    
    /* Tooltip on mobile - show below instead of above */
    .lbc-swatch-tooltip {
        bottom: auto;
        top: calc(100% + 8px);
    }
    
    .lbc-swatch-tooltip::after {
        top: auto;
        bottom: 100%;
        border-top-color: transparent;
        border-bottom-color: #1a1a2e;
    }
}
