/* TP WooCommerce Variation Swatches Styles */

/* Hide default select dropdown when swatches are active */
.tp-woo-hidden {
    display: none !important;
}

/* Main swatches container */
.tp-woo-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    padding: 0;
    list-style: none;
}

/* Base swatch styles */
.tp-swatches {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #fff;
}

.tp-swatches:hover {
    border-color: #999;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tp-swatches.selected {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.3);
}

.tp-swatches.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.tp-swatches.unavailable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: #ff0000;
    transform: translateY(-50%) rotate(-45deg);
    z-index: 2;
}

.tp-swatches.unavailable:hover {
    transform: none;
    box-shadow: none;
    border-color: #ddd;
}

/* Loading state */
.tp-woo-swatches.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Click animation */
.tp-swatches.tp-swatch-clicked {
    transform: scale(0.95);
}

/* Color swatches */
.tp-swatches-color {
    border-radius: 50%;
    min-width: 44px;
    min-height: 44px;
    overflow: hidden;
}

.tp-swatches-color .tp-swatch-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

.tp-swatches-color.selected {
    border-width: 3px;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0073aa;
}

/* Image swatches */
.tp-swatches-image {
    padding: 2px;
    min-width: 48px;
    min-height: 48px;
}

.tp-swatches-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.tp-swatches-image.selected {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #0073aa;
}

/* Button swatches */
.tp-swatches-button {
    padding: 8px 16px;
    min-width: auto;
    min-height: 36px;
    border-radius: 20px;
    background: #f8f8f8;
    border-color: #ddd;
}

.tp-swatches-button .tp-swatch-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.tp-swatches-button:hover {
    background: #e8e8e8;
}

.tp-swatches-button.selected {
    background: #0073aa;
    border-color: #0073aa;
}

.tp-swatches-button.selected .tp-swatch-text {
    color: #fff;
}

/* Tooltips */
.tp-swatches-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 5px;
}

.tp-swatches-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
}

.tp-swatches:hover .tp-swatches-tooltip {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .tp-woo-swatches {
        gap: 6px;
    }
    
    .tp-swatches {
        min-width: 36px;
        min-height: 36px;
    }
    
    .tp-swatches-color {
        min-width: 40px;
        min-height: 40px;
    }
    
    .tp-swatches-image {
        min-width: 44px;
        min-height: 44px;
    }
    
    .tp-swatches-button {
        padding: 6px 12px;
        min-height: 32px;
    }
    
    .tp-swatches-button .tp-swatch-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tp-woo-swatches {
        gap: 4px;
    }
    
    .tp-swatches {
        min-width: 32px;
        min-height: 32px;
    }
    
    .tp-swatches-color {
        min-width: 36px;
        min-height: 36px;
    }
    
    .tp-swatches-image {
        min-width: 40px;
        min-height: 40px;
    }
    
    .tp-swatches-button {
        padding: 5px 10px;
        min-height: 28px;
    }
    
    .tp-swatches-button .tp-swatch-text {
        font-size: 12px;
    }
    
    .tp-swatches-tooltip {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Variation form integration */
.variations .value {
    position: relative;
}

.variations .value .tp-woo-swatches {
    margin-top: 5px;
}

/* Stock status styling */
.stock.in-stock {
    color: #0f834d;
    font-weight: 500;
}

.stock.out-of-stock {
    color: #e2401c;
    font-weight: 500;
}

/* Price styling enhancement */
.price {
    font-weight: 600;
    margin: 10px 0;
}

.price del {
    opacity: 0.7;
    font-weight: normal;
}

.price ins {
    text-decoration: none;
    font-weight: 700;
}

/* Animation keyframes */
@keyframes swatchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.tp-swatches.selected {
    animation: swatchPulse 0.3s ease-out;
}

/* Focus states for accessibility */
.tp-swatches:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.tp-swatches:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tp-swatches {
        border-width: 3px;
    }
    
    .tp-swatches.selected {
        border-width: 4px;
    }
    
    .tp-swatches.unavailable {
        opacity: 0.6;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tp-swatches {
        transition: none;
    }
    
    .tp-swatches:hover {
        transform: none;
    }
    
    .tp-swatches.tp-swatch-clicked {
        transform: none;
    }
    
    .tp-swatches.selected {
        animation: none;
    }
}