/* CVC Variation Swatches Styles */

.cvc-swatches-wrapper {
    margin: 10px 0;
    font-family: inherit;
}

.cvc-swatches {
    margin-bottom: 15px;
}

.cvc-swatches-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: inherit;
    font-size: 14px;
}

.cvc-swatches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.cvc-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--blue);
    background: #fff;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    position: relative;
    min-width: 36px;
    min-height: 36px;
}

.cvc-swatch:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cvc-swatch:focus {
    outline: none;
    border-color: var(--blue);
}

.cvc-swatch.is-selected {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}


.cvc-swatch.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.cvc-swatch.is-disabled:hover {
    border-color: #ddd;
    transform: none;
    box-shadow: none;
}

/* Swatch wrapper for tooltip positioning */
.cvc-swatch-wrapper {
    position: relative;
    display: inline-block;
}

/* Out of stock swatch styles */
.cvc-swatch.is-out-of-stock {
    opacity: 0.5;
    position: relative;
    cursor: not-allowed;
}

.cvc-swatch.is-out-of-stock:hover {
    opacity: 0.6;
    border-color: #999;
    transform: none;
    box-shadow: none;
}

.cvc-swatch-wrapper .cvc-swatch-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--blue);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 9999;
}

.cvc-swatch-wrapper .cvc-swatch-tooltip:after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--blue);
}

.cvc-swatch-wrapper:hover .cvc-swatch-tooltip {
    opacity: 1 !important;
    background: var(--blue) !important;
    color: rgba(255, 255, 255, 1) !important;
}

/* Let WooCommerce handle button styling, just add minor tweaks */
.cvc-add-to-cart-btn {
    display: inline-block;
    text-decoration: none !important;
    width: auto;
    max-width: none;
}

.cvc-add-to-cart-btn:disabled,
.cvc-add-to-cart-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Label swatches */
.cvc-swatch-label {
    padding: 8px 12px;
    font-weight: 500;
    white-space: nowrap;
    color: inherit;
    pointer-events: none;
}

.cvc-swatch:hover .cvc-swatch-label {
    color: #000;
}

.cvc-swatch.is-selected .cvc-swatch-label {
    color: #fff;
    font-weight: 600;
}

/* Color swatches */
.cvc-swatch-chip {
    width: 32px;
    height: 32px;
    border-radius: 2px;
    display: block;
    pointer-events: none;
    position: relative;
}

.cvc-swatch .cvc-swatch-chip {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Image swatches */
.cvc-swatch img.cvc-swatch-chip {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 2px;
}

/* Loop context specific styles */
.cvc-loop-swatches {
    margin-top: 8px;
}

.cvc-loop-swatches .cvc-swatches-label {
    font-size: 13px;
    margin-bottom: 6px;
}

.cvc-loop-swatches .cvc-swatch {
    min-width: 32px;
    min-height: 32px;
}

.cvc-loop-swatches .cvc-swatch-chip {
    width: 28px;
    height: 28px;
}

.cvc-loop-swatches .cvc-swatch img.cvc-swatch-chip {
    width: 28px;
    height: 28px;
}

.cvc-loop-swatches .cvc-swatch-label {
    padding: 6px 10px;
    font-size: 12px;
}

/* Product loop specific out-of-stock styles */
.cvc-loop-swatches .cvc-swatch-wrapper .cvc-swatch-tooltip {
    z-index: 9999;
    bottom: -30px;
}


/* Single product context specific styles */
.cvc-single-swatches {
    margin-bottom: 20px;
}

.cvc-single-swatches .cvc-swatches-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
}

.cvc-single-swatches .cvc-swatch {
    min-width: 40px;
    min-height: 40px;
}

.cvc-single-swatches .cvc-swatch-chip {
    width: 36px;
    height: 36px;
}

.cvc-single-swatches .cvc-swatch img.cvc-swatch-chip {
    width: 36px;
    height: 36px;
}

.cvc-single-swatches .cvc-swatch-label {
    padding: 10px 14px;
    font-size: 14px;
}


/* Responsive design */
@media (max-width: 768px) {
    .cvc-swatches-list {
        gap: 6px;
    }
    
    .cvc-swatch {
        min-width: 30px;
        min-height: 30px;
    }
    
    .cvc-swatch-chip {
        width: 26px;
        height: 26px;
    }
    
    .cvc-swatch img.cvc-swatch-chip {
        width: 26px;
        height: 26px;
    }
    
    .cvc-swatch-label {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .cvc-single-swatches .cvc-swatch {
        min-width: 36px;
        min-height: 36px;
    }
    
    .cvc-single-swatches .cvc-swatch-chip {
        width: 32px;
        height: 32px;
    }
    
    .cvc-single-swatches .cvc-swatch img.cvc-swatch-chip {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .cvc-swatches-wrapper {
        margin: 8px 0;
    }
    
    .cvc-swatches {
        margin-bottom: 12px;
    }
    
    .cvc-swatches-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .cvc-swatches-list {
        gap: 4px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .cvc-swatch {
        transition: none;
    }
    
    .cvc-swatch:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cvc-swatch {
        border-width: 3px;
    }
    
    .cvc-swatch:focus {
        outline-width: 3px;
    }
    
    .cvc-swatch.is-selected {
        box-shadow: 0 0 0 2px #007cba;
    }
}

/* Print styles */
@media print {
    .cvc-swatches-wrapper {
        display: none;
    }
}

/* Hide default WooCommerce dropdowns when swatches are present */
.cvc-single-swatches + .variations {
    display: none !important;
}

.variations_form:has(.cvc-single-swatches) .variations {
    display: none !important;
}

/* Fallback for browsers that don't support :has() */
.variations_form .variations {
    transition: opacity 0.3s ease;
}

.cvc-swatches-active .variations {
    display: none !important;
}

/* RTL support */
.rtl .cvc-swatch.is-selected:after {
    right: auto;
    left: -8px;
}

.rtl .cvc-single-swatches .cvc-swatch.is-selected:after {
    right: auto;
    left: -10px;
}

.rtl .cvc-loop-swatches .cvc-swatch.is-selected:after {
    right: auto;
    left: -6px;
}

/* Hide WooCommerce variation price but keep availability visible */
.woocommerce-variation-price {
    display: none !important;
}

/* Ensure the original WooCommerce variation availability element remains visible */
.woocommerce-variation-availability {
    display: block !important;
}