/* Elementor Product Variation Widget Styles */
.epv-product-variation-widget {
    font-family: inherit;
    max-width: 100%;
}

/* Main Image Styles */
.epv-main-image-container {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* margin-bottom now controlled by Elementor via .epv-variations margin-top */
}

.epv-main-image {
    width: 100%;
    height: 400px;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease-in-out;
    max-width: 100%;
}

.epv-main-image.fade-out {
    opacity: 0;
}

.epv-main-image.fade-in {
    opacity: 1;
}

/* Variations Container */
.epv-variations {
    position: relative;
    margin-top: 20px; /* Default spacing, can be overridden by Elementor */
}

.epv-variations-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.epv-variations-wrapper {
    overflow: hidden;
    flex: 1;
    max-width: 100%;
    position: relative;
    z-index: 1;
    /* Margin now controlled by Elementor */
}

.epv-variations-track {
    display: flex;
    justify-content: space-between;
    transition: transform 0.3s ease-in-out;
    gap: 10px;
    width: 100%; /* Full width for space-between layout */
}

/* When all items fit and should be centered */
.epv-variations-track.center-items {
    justify-content: center;
    gap: 15px; /* Smaller, more controlled gap when centering */
}

/* Variation Items */
.epv-variation-item {
    flex: 1;
    padding: 12px 24px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    font-size: 16px;
    color: #495057;
    white-space: nowrap;
    user-select: none;
    outline: none !important; /* Remove outline from all states */
    max-width: 200px; /* Prevent items from becoming too wide */
}

/* When centering items, don't stretch them */
.epv-variations-track.center-items .epv-variation-item {
    flex: 0 0 auto;
}

.epv-variation-item:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-2px);
}

.epv-variation-item.active {
    background-color: #007cba;
    border-color: #007cba;
    color: #ffffff;
    transform: translateY(-2px);
    /* Box-shadow now controlled by Elementor */
}

.epv-variation-item.active:hover {
    background-color: #005a87;
    border-color: #005a87;
}

/* Navigation Arrows */
.epv-arrow {
    flex: 0 0 auto;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    color: #495057;
    outline: none !important; /* Remove outline from all states */
    z-index: 10; /* Ensure arrows are above variations */
    padding: 12px; /* Default padding, controllable via Elementor */
}

.epv-arrow:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    transform: scale(1.1);
}

.epv-arrow:active {
    transform: scale(0.95);
}

.epv-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.epv-arrow:disabled:hover {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    transform: none;
}

.epv-arrow i {
    font-size: inherit;
}

/* Responsive Design */
@media (max-width: 768px) {
    .epv-variation-item {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .epv-arrow {
        padding: 10px;
        font-size: 14px;
    }
    
    .epv-main-image {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .epv-variation-item {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .epv-arrow {
        padding: 8px;
        font-size: 12px;
    }
    
    .epv-main-image {
        height: 250px;
    }
    
    .epv-variations-container {
        gap: 5px;
    }
    
    .epv-variations-track {
        gap: 5px;
    }
}

/* Loading State */
.epv-main-image.loading {
    opacity: 0.7;
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.epv-main-image.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.epv-main-image.animate-fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

/* Custom scrollbar for variations track (if needed) */
.epv-variations-wrapper::-webkit-scrollbar {
    display: none;
}

.epv-variations-wrapper {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Focus states for accessibility */
.epv-variation-item:focus {
    outline: none !important;
}

.epv-arrow:focus {
    outline: none !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .epv-variation-item {
        border-width: 3px;
    }
    
    .epv-arrow {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .epv-main-image,
    .epv-variations-track,
    .epv-variation-item,
    .epv-arrow {
        transition: none;
    }
    
    .epv-main-image.animate-fade-in,
    .epv-main-image.animate-fade-out {
        animation: none;
    }
}
