/**
 * Advanced Swatches CSS
 * Estilos avançados para swatches visuais do Expresso Extra Product
 * Superior ao TM Extra Product Options
 */

/* ==========================================================================
   Base Swatch Styles
   ========================================================================== */

.eep-swatch {
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.eep-swatch:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Swatch indicator (checkmark) */
.eep-swatch-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #27ae60;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    z-index: 2;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.eep-swatch.selected .eep-swatch-indicator {
    opacity: 1;
    transform: scale(1);
}

/* Swatch label */
.eep-swatch-label {
    display: block;
    text-align: center;
    font-size: 11px;
    margin-top: 4px;
    color: #666;
    line-height: 1.2;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Swatch Sizes
   ========================================================================== */

.eep-swatch-small {
    width: 24px;
    height: 24px;
}

.eep-swatch-small .eep-swatch-indicator {
    width: 14px;
    height: 14px;
    font-size: 8px;
    top: -1px;
    right: -1px;
}

.eep-swatch-medium {
    width: 40px;
    height: 40px;
}

.eep-swatch-large {
    width: 60px;
    height: 60px;
}

.eep-swatch-large .eep-swatch-indicator {
    width: 22px;
    height: 22px;
    font-size: 12px;
    top: -3px;
    right: -3px;
}

.eep-swatch-extra-large {
    width: 80px;
    height: 80px;
}

.eep-swatch-extra-large .eep-swatch-indicator {
    width: 26px;
    height: 26px;
    font-size: 14px;
    top: -4px;
    right: -4px;
}

/* ==========================================================================
   Swatch Shapes
   ========================================================================== */

.eep-swatch-circle,
.eep-swatch-circle .eep-color-display,
.eep-swatch-circle .eep-swatch-image {
    border-radius: 50%;
}

.eep-swatch-square,
.eep-swatch-square .eep-color-display,
.eep-swatch-square .eep-swatch-image {
    border-radius: 0;
}

.eep-swatch-rounded,
.eep-swatch-rounded .eep-color-display,
.eep-swatch-rounded .eep-swatch-image {
    border-radius: 8px;
}

.eep-swatch-hexagon {
    position: relative;
}

.eep-swatch-hexagon .eep-color-display,
.eep-swatch-hexagon .eep-swatch-image {
    border-radius: 0;
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
}

/* ==========================================================================
   Color Swatches
   ========================================================================== */

.eep-color-display {
    width: 100%;
    height: 100%;
    display: block;
    border: 2px solid rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.eep-color-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.eep-swatch:hover .eep-color-display::before {
    opacity: 1;
}

/* Color swatch with pattern background for transparent colors */
.eep-color-display.has-transparency {
    background-image: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

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

.eep-swatch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: block;
}

.eep-swatch-image.lazy {
    filter: blur(5px);
    opacity: 0.5;
}

.eep-swatch-image.loaded {
    filter: none;
    opacity: 1;
}

/* Image loading overlay */
.eep-swatch-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    color: #666;
    font-size: 12px;
}

.eep-swatch-image-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Icon Swatches
   ========================================================================== */

.eep-icon-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px solid rgba(0,0,0,0.1);
    color: #3498db;
    transition: all 0.3s ease;
    position: relative;
}

.eep-swatch-small .eep-icon-display {
    font-size: 12px;
}

.eep-swatch-medium .eep-icon-display {
    font-size: 18px;
}

.eep-swatch-large .eep-icon-display {
    font-size: 24px;
}

.eep-swatch-extra-large .eep-icon-display {
    font-size: 32px;
}

/* Icon background patterns */
.eep-icon-display.pattern-dots {
    background-image: radial-gradient(circle, rgba(52,152,219,0.1) 1px, transparent 1px);
    background-size: 8px 8px;
}

.eep-icon-display.pattern-lines {
    background-image: linear-gradient(45deg, rgba(52,152,219,0.1) 25%, transparent 25%);
    background-size: 6px 6px;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

/* Scale Effect */
.eep-hover-scale:hover {
    transform: scale(1.1);
}

.eep-hover-scale:active {
    transform: scale(0.95);
}

/* Glow Effect */
.eep-hover-glow:hover {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
}

/* Shadow Effect */
.eep-hover-shadow {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.eep-hover-shadow:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Bounce Effect */
.eep-hover-bounce:hover {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

/* Rotate Effect */
.eep-hover-rotate:hover {
    transform: rotate(15deg);
}

/* ==========================================================================
   Selection States
   ========================================================================== */

.eep-swatch.selected {
    z-index: 1;
}

.eep-swatch.selected .eep-color-display,
.eep-swatch.selected .eep-swatch-image,
.eep-swatch.selected .eep-icon-display {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.eep-swatch.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.eep-swatch.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Swatch Groups & Collections
   ========================================================================== */

.eep-swatch-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.eep-swatch-collection.collection-compact {
    gap: 4px;
}

.eep-swatch-collection.collection-spaced {
    gap: 12px;
}

/* Swatch group with labels */
.eep-swatch-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.eep-swatch-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    text-align: center;
}

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

@media (max-width: 768px) {
    .eep-swatch-large {
        width: 50px;
        height: 50px;
    }
    
    .eep-swatch-extra-large {
        width: 60px;
        height: 60px;
    }
    
    .eep-swatch-collection {
        gap: 6px;
    }
    
    .eep-swatch-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .eep-swatch-large {
        width: 40px;
        height: 40px;
    }
    
    .eep-swatch-extra-large {
        width: 50px;
        height: 50px;
    }
    
    .eep-swatch-collection {
        gap: 4px;
    }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.eep-swatch:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .eep-swatch,
    .eep-color-display,
    .eep-swatch-image,
    .eep-icon-display,
    .eep-swatch-indicator {
        transition: none;
    }
    
    .eep-hover-bounce:hover {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .eep-color-display,
    .eep-swatch-image,
    .eep-icon-display {
        border-width: 3px;
        border-color: currentColor;
    }
    
    .eep-swatch.selected .eep-color-display,
    .eep-swatch.selected .eep-swatch-image,
    .eep-swatch.selected .eep-icon-display {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* ==========================================================================
   Special Effects & Premium Features
   ========================================================================== */

/* Gradient border animation */
.eep-swatch.premium-border {
    position: relative;
    background: linear-gradient(45deg, #3498db, #9b59b6, #e74c3c, #f39c12);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
    padding: 2px;
}

.eep-swatch.premium-border .eep-color-display,
.eep-swatch.premium-border .eep-swatch-image,
.eep-swatch.premium-border .eep-icon-display {
    border: none;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Pulse effect for featured swatches */
.eep-swatch.featured {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Tooltip enhancement */
.eep-swatch[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.eep-swatch[title]:hover::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #2c3e50;
    z-index: 1000;
    pointer-events: none;
}