/**
 * Car Hero Carousel Mobile - Custom Implementation
 * Mobile-specific carousel with swipe functionality and splash-style dots
 */

/* Mobile/Tablet carousel (hidden on desktop) */
.car-hero-carousel-mobile {
    display: none;
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* Show mobile carousel on tablet and mobile screens */
@media (max-width: 1366px) {
    .car-hero-carousel-mobile {
        display: block;
    }

    /* Hide desktop carousel on tablet and mobile */
    .car-hero-carousel {
        display: none;
    }
}

/* Main carousel container */
.car-hero-carousel-mobile .carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.car-hero-carousel-mobile.dragging .carousel-container {
    cursor: grabbing;
}

/* Slides wrapper */
.car-hero-carousel-mobile .carousel-slides {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.car-hero-carousel-mobile.no-transition .carousel-slides {
    transition: none;
}

/* Individual slide */
.car-hero-carousel-mobile .carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.car-hero-carousel-mobile .carousel-slide img {
    width: 100%;
    height: auto;
    max-height: 40vh;
    min-height: 250px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Splash Swiper Style Dots */
.car-hero-carousel-mobile .carousel-dots {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 15px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.car-hero-carousel-mobile .carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.car-hero-carousel-mobile .carousel-dot.active {
    background: #cc0000;
    border-color: #cc0000;
    box-shadow: 0 0 8px rgba(204, 0, 0, 0.5);
}

.car-hero-carousel-mobile .carousel-dot:hover {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.car-hero-carousel-mobile .carousel-dot.active:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(204, 0, 0, 0.7);
}

/* Inner dot element for styling consistency */
.car-hero-carousel-mobile .carousel-dot .dot-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.3s ease;
}

.car-hero-carousel-mobile .carousel-dot.active .dot-inner {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading placeholder */
.car-hero-carousel-mobile .carousel-slide img[data-loading="true"] {
    min-height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Touch indicators */
.car-hero-carousel-mobile.swiping .carousel-container {
    cursor: grabbing;
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1366px) {
    /* Ensure mobile carousel is visible on tablets */
    .car-hero-carousel-mobile {
        display: block !important;
    }

    .car-hero-carousel-mobile .carousel-container {
        border-radius: 16px;
        position: relative;
        max-width: 800px; /* Constrain width for 1366px screens */
        margin: 0 auto; /* Center the carousel */
    }

    .car-hero-carousel-mobile .carousel-slide img {
        max-height: 60vh;
        min-height: 400px;
        border-radius: 16px;
        width: 100%;
        object-fit: contain; /* Maintain aspect ratio */
    }

    .car-hero-carousel-mobile .carousel-slide {
        min-height: 400px;
    }

    /* Force dots to be visible and positioned below */
    .car-hero-carousel-mobile .carousel-dots {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        gap: 10px;
        padding: 10px 20px;
        margin-top: 20px;
        z-index: 10;
        pointer-events: auto;
        width: fit-content !important;
        margin-left: auto !important;
        margin-right: auto !important;
        height: auto !important;
    }

    .car-hero-carousel-mobile .carousel-dot {
        width: 10px !important;
        height: 10px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .car-hero-carousel-mobile .carousel-dot .dot-inner {
        width: 5px;
        height: 5px;
    }

    .car-hero-carousel-mobile .carousel-dot:hover {
        transform: scale(1.2);
    }
}

/* Mobile specific adjustments (smaller tablets and phones) */
@media (max-width: 768px) {
    .car-hero-carousel-mobile .carousel-container {
        border-radius: 12px;
    }

    .car-hero-carousel-mobile .carousel-slide img {
        max-height: 50vh;
        border-radius: 12px;
    }

    .car-hero-carousel-mobile .carousel-thumbnails {
        padding: 20px 0;
        margin-top: 16px;
    }

    .car-hero-carousel-mobile .carousel-dot {
        width: 8px;
        height: 8px;
    }

    .car-hero-carousel-mobile .carousel-dots {
        gap: 8px;
        padding: 8px 16px;
        margin-top: 25px; /* Increased spacing on mobile */
    }
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
    .car-hero-carousel-mobile .carousel-container {
        border-radius: 10px;
    }

    .car-hero-carousel-mobile .carousel-slide img {
        max-height: 35vh;
        min-height: 200px;
        border-radius: 10px;
    }

    .car-hero-carousel-mobile .carousel-slide {
        min-height: 200px;
    }

    .car-hero-carousel-mobile .carousel-dots {
        bottom: 12px;
        gap: 6px;
        padding: 6px 12px;
    }

    .car-hero-carousel-mobile .carousel-dot {
        width: 6px;
        height: 6px;
    }

    .car-hero-carousel-mobile .carousel-dot .dot-inner {
        width: 3px;
        height: 3px;
    }
}

/* Animation for slide transitions */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.car-hero-carousel-mobile .carousel-slide.slide-in-right {
    animation: slideInFromRight 0.3s ease-out;
}

.car-hero-carousel-mobile .carousel-slide.slide-in-left {
    animation: slideInFromLeft 0.3s ease-out;
}

/* Accessibility improvements */
.car-hero-carousel-mobile .carousel-dot:focus-visible {
    outline: 2px solid #cc0000;
    outline-offset: 2px;
}

.car-hero-carousel-mobile .carousel-container:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .car-hero-carousel-mobile .carousel-dot {
        border-width: 2px;
    }

    .car-hero-carousel-mobile .carousel-dot.active {
        border-color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .car-hero-carousel-mobile .carousel-slides,
    .car-hero-carousel-mobile .carousel-dot {
        transition: none;
    }

    .car-hero-carousel-mobile .carousel-slide.slide-in-right,
    .car-hero-carousel-mobile .carousel-slide.slide-in-left {
        animation: none;
    }
}

/* Prevent scroll during swipe */
body.carousel-swiping {
    overflow: hidden;
    touch-action: none;
}