/**
 * Product Variations Swatches Styles
 * Styles for color swatches, size options, material/pattern swatches
 */

/* ============================================================================
   VARIATION WRAPPER
   ============================================================================ */
.product-variations-wrapper {
    background: #fff;
    padding: 20px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.variation-group {
    margin-bottom: 20px;
}

.variation-group:last-child {
    margin-bottom: 0;
}

.variation-label {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    display: block;
}

.selected-variation-value {
    font-weight: 400;
    color: #d4a574 !important;
    font-size: 15px;
}

.variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================================================
   BASE VARIATION OPTION STYLES
   ============================================================================ */
.variation-option {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e5e5e5;
    background: #fff;
    padding: 0;
    overflow: hidden;
}

.variation-option:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.variation-option.active {
    border-color: #d4a574;
    box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.2);
}

.variation-option:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.variation-option.out-of-stock {
    position: relative;
}

/* ============================================================================
   COLOR SWATCHES
   ============================================================================ */
.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-swatch .color-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover:not(:disabled) {
    border-color: #d4a574;
}

.color-swatch.active .color-circle {
    box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Stock line (diagonal line for out of stock colors) */
.color-swatch .stock-line {
    position: absolute;
    width: 120%;
    height: 2px;
    background: #dc3545;
    top: 50%;
    left: -10%;
    transform: rotate(-45deg);
    z-index: 1;
}

/* ============================================================================
   IMAGE SWATCHES (Material/Pattern)
   ============================================================================ */
.image-swatch {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-swatch .swatch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-swatch .swatch-text {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    text-align: center;
    padding: 5px;
    word-break: break-word;
}

.image-swatch:hover:not(:disabled) {
    border-color: #d4a574;
}

.image-swatch.active {
    border-color: #d4a574;
    border-width: 3px;
}

.image-swatch .stock-line {
    position: absolute;
    width: 120%;
    height: 3px;
    background: #dc3545;
    top: 50%;
    left: -10%;
    transform: rotate(-45deg);
    z-index: 1;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.3);
}

/* ============================================================================
   BUTTON SWATCHES (Size, etc.)
   ============================================================================ */
.button-swatch {
    min-width: 60px;
    height: 45px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.button-swatch:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #d4a574;
}

.button-swatch.active {
    background: #d4a574;
    color: #fff;
    border-color: #d4a574;
}

.button-swatch:disabled {
    background: #f5f5f5;
    color: #999;
    text-decoration: line-through;
}

.button-swatch .stock-indicator {
    font-size: 12px;
    color: #dc3545;
    margin-left: 3px;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 768px) {
    .product-variations-wrapper {
        padding: 15px;
    }

    .variation-label {
        font-size: 14px;
    }

    .color-swatch {
        width: 45px;
        height: 45px;
    }

    .image-swatch {
        width: 70px;
        height: 70px;
    }

    .button-swatch {
        min-width: 50px;
        height: 40px;
        padding: 8px 15px;
        font-size: 13px;
    }

    .variation-options {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .color-swatch {
        width: 40px;
        height: 40px;
    }

    .image-swatch {
        width: 60px;
        height: 60px;
    }

    .button-swatch {
        min-width: 45px;
        height: 38px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .variation-options {
        gap: 6px;
    }
}

/* ============================================================================
   TOOLTIP STYLES (for hover on swatches)
   ============================================================================ */
.variation-option[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    pointer-events: none;
}

.variation-option[title]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    margin-bottom: 3px;
    pointer-events: none;
}

/* Hide tooltip for disabled items */
.variation-option:disabled[title]:hover::before,
.variation-option:disabled[title]:hover::after {
    display: none;
}

/* ============================================================================
   ANIMATION STYLES
   ============================================================================ */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(212, 165, 116, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 165, 116, 0);
    }
}

.variation-option.active {
    animation: pulse 0.6s;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */
.variation-option.loading {
    pointer-events: none;
    opacity: 0.6;
}

.variation-option.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #d4a574;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================================================
   PRICE UPDATE INDICATOR
   ============================================================================ */
.price-updating {
    animation: priceFlash 0.5s ease-in-out;
}

@keyframes priceFlash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */
.variation-option:focus-visible {
    outline: 2px solid #d4a574;
    outline-offset: 2px;
}

.variation-option:disabled {
    cursor: not-allowed;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
