/**
 * Car Gallery Slider Styles
 */

.car-slider-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 15px;
}

/* Layout Variations */
.car-slider-left {
    flex-direction: row;
}

.car-slider-right {
    flex-direction: row-reverse;
}

.car-slider-bottom {
    flex-direction: column;
}

/* Main Slider */
.car-main-slider {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
}

.car-slider-bottom .car-main-slider {
    margin-bottom: 20px;
}

.car-main-slider .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.car-main-slider img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    object-position: center;
    display: block;
    max-width: none; /* Override any theme restrictions */
}

/* Navigation Buttons */
.car-main-slider .swiper-button-next,
.car-main-slider .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.car-main-slider .swiper-button-next:hover,
.car-main-slider .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.car-main-slider .swiper-button-next::after,
.car-main-slider .swiper-button-prev::after {
    font-size: 18px;
    font-weight: bold;
}

/* Thumbnail Slider */
.car-thumb-slider {
    flex-shrink: 0;
}

/* Bottom position (default) */
.car-slider-bottom .car-thumb-slider {
    max-width: 100%;
}

/* Left and Right positions (Auto behavior) */
.car-slider-left .car-thumb-slider,
.car-slider-right .car-thumb-slider {
    width: auto; /* Dynamic width based on thumbnail size */
    min-width: 100px; /* Minimum width fallback */
    height: 400px;
    max-height: 400px;
    padding: 0 10px; /* Add some padding around thumbnails */
}

.car-slider-left .car-thumb-slider .swiper-wrapper,
.car-slider-right .car-thumb-slider .swiper-wrapper {
    flex-direction: column;
}

.car-slider-left .car-thumb-slider .swiper-slide,
.car-slider-right .car-thumb-slider .swiper-slide {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
}

/* Orientation Override: Force Horizontal */
.car-slider-orientation-horizontal .car-thumb-slider {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
}

.car-slider-orientation-horizontal .car-thumb-slider .swiper-wrapper {
    flex-direction: row !important;
}

.car-slider-orientation-horizontal .car-thumb-slider .swiper-slide {
    width: auto !important;
    height: auto !important;
    margin-bottom: 0 !important;
    margin-right: 10px;
}

.car-slider-orientation-horizontal .car-thumb-slider .swiper-slide:last-child {
    margin-right: 0;
}

/* Orientation Override: Force Vertical */
.car-slider-orientation-vertical .car-thumb-slider {
    width: 120px !important;
    height: 400px !important;
    max-height: 400px !important;
}

.car-slider-orientation-vertical .car-thumb-slider .swiper-wrapper {
    flex-direction: column !important;
}

.car-slider-orientation-vertical .car-thumb-slider .swiper-slide {
    width: 100% !important;
    height: auto !important;
    margin-bottom: 10px !important;
    margin-right: 0 !important;
}

.car-slider-orientation-vertical .car-thumb-slider .swiper-slide:last-child {
    margin-bottom: 0;
}

/* Adjust container layout for forced orientations */
.car-slider-orientation-vertical.car-slider-bottom {
    flex-direction: row;
}

.car-slider-orientation-horizontal.car-slider-left,
.car-slider-orientation-horizontal.car-slider-right {
    flex-direction: column;
}

.car-thumb-slider .swiper-slide {
    width: auto;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    overflow: hidden;
}

.car-thumb-slider .swiper-slide:hover {
    opacity: 0.8;
}

.car-thumb-slider .swiper-slide-thumb-active {
    opacity: 1;
}

/* Thumbnail hover effects */
.car-thumb-slider .swiper-slide:hover {
    opacity: 0.8;
}

.car-thumb-slider .swiper-slide-thumb-active:hover {
    opacity: 1;
}

.car-thumb-slider img {
    width: 100px; /* Increased default size */
    height: 75px; /* Increased default size */
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 4px;
    max-width: none; /* Override any theme restrictions */
    transition: all 0.3s ease; /* Smooth hover transitions */
    image-rendering: -webkit-optimize-contrast; /* Better image quality */
    image-rendering: crisp-edges;
}

/* Left/Right thumbnail images - inherit sizes from controls */
.car-slider-left .car-thumb-slider img,
.car-slider-right .car-thumb-slider img {
    /* Sizes are now controlled by Elementor controls */
    /* Remove fixed sizes to allow dynamic control */
}

/* Image fit specific adjustments */
.car-slider-container img[style*="object-fit: contain"],
.car-slider-container img[style*="object-fit: none"],
.car-slider-container img[style*="object-fit: scale-down"] {
    background-color: #f5f5f5; /* Fallback background for images that don't fill container */
}

/* Ensure proper image rendering for all fit types */
.car-main-slider .swiper-slide,
.car-thumb-slider .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Empty State */
.car-slider-empty {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

.car-slider-empty p {
    margin: 0;
    font-size: 16px;
}

/* Lazy Loading */
.swiper-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swiper-lazy-loaded {
    opacity: 1;
}

.swiper-lazy-preloader {
    width: 42px;
    height: 42px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -21px;
    margin-top: -21px;
    z-index: 10;
    transform-origin: 50%;
    border: 4px solid #007cba;
    border-radius: 50%;
    border-top: 4px solid transparent;
    animation: swiper-preloader-spin 1s linear infinite;
}

.swiper-lazy-preloader-white {
    border-color: rgba(255, 255, 255, 0.6);
    border-top-color: transparent;
}

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

/* Thumbnail lazy loading specific */
.thumb-lazy {
    background: #f5f5f5;
    min-height: 60px;
}

.car-slider-left .thumb-lazy,
.car-slider-right .thumb-lazy {
    min-height: 75px;
}

/* Dynamic responsive breakpoint - this will be overridden by JavaScript */
.car-slider-container[data-mobile="true"] {
    flex-direction: column !important;
}

.car-slider-container[data-mobile="true"] .car-thumb-slider {
    width: 100% !important;
    max-height: none !important;
}

.car-slider-container[data-mobile-thumbnails="hidden"] .car-thumb-slider {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Stack all layouts vertically on mobile */
    .car-slider-container {
        flex-direction: column !important;
    }
    
    .car-slider-left .car-thumb-slider,
    .car-slider-right .car-thumb-slider {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        padding: 0 !important; /* Remove side padding on mobile */
    }
    
    .car-slider-left .car-thumb-slider .swiper-wrapper,
    .car-slider-right .car-thumb-slider .swiper-wrapper {
        flex-direction: row !important;
    }
    
    .car-slider-left .car-thumb-slider .swiper-slide,
    .car-slider-right .car-thumb-slider .swiper-slide {
        width: auto !important;
        height: auto !important;
        margin-bottom: 0 !important;
    }
    
    .car-main-slider img {
        height: 250px;
    }
    
    .car-thumb-slider img {
        width: 60px;
        height: 45px;
    }
    
    .car-main-slider .swiper-button-next,
    .car-main-slider .swiper-button-prev {
        width: 36px;
        height: 36px;
    }
    
    .car-main-slider .swiper-button-next::after,
    .car-main-slider .swiper-button-prev::after {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .car-main-slider img {
        height: 200px;
    }
    
    .car-thumb-slider img {
        width: 50px;
        height: 38px;
    }
}