/**
 * Car Hero Carousel - Custom Implementation
 * Replaces Owl Carousel with swipe functionality
 */

.car-hero-carousel {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* Main image container */
.car-hero-main {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #f8f9fa;
}

.car-hero-main.dragging {
    cursor: grabbing;
}

.car-hero-slides {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.car-hero-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
}

.car-hero-slide img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Loading placeholder */
.car-hero-slide img[data-loading="true"] {
    min-height: 400px;
    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; }
}

/* Thumbnail list - acting as dots replacement */
.car-hero-thumbnails {
    padding: 24px 0;
    margin-top: 20px;
}

.car-hero-thumbnails-container {
    position: relative;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cc0000 #f1f1f1;
}

/* Custom red scrollbar styling */
.car-hero-thumbnails-container::-webkit-scrollbar {
    height: 6px;
}

.car-hero-thumbnails-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.car-hero-thumbnails-container::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #cc0000, #ff4444);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.car-hero-thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #b30000, #e63939);
}

.car-hero-thumbnails-list {
    display: flex;
    gap: 12px;
    padding: 8px 0 16px 0;
    min-width: 100%;
}

.car-hero-thumbnail {
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: #f8f9fa;
    /* Remove button default styling */
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Remove focus ring */
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.car-hero-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(204, 0, 0, 0.2);
    border-color: rgba(204, 0, 0, 0.3);
}

.car-hero-thumbnail.active {
    border-color: #cc0000;
    box-shadow: 0 0 0 1px #cc0000, 0 4px 15px rgba(204, 0, 0, 0.3);
    transform: translateY(-2px);
}

.car-hero-thumbnail.active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #cc0000, #ff4444);
    border-radius: 10px;
    z-index: -1;
}

.car-hero-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.car-hero-thumbnail:hover img {
    transform: scale(1.05);
}

/* Active indicator for current thumbnail */
.car-hero-thumbnail.active .car-hero-thumbnail-indicator {
    opacity: 1;
}

.car-hero-thumbnail-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #cc0000;
    border: 2px solid #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Touch feedback */
.car-hero-carousel.touch-active .car-hero-main {
    transition: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .car-hero-main {
        border-radius: 12px;
    }

    .car-hero-slide img {
        max-height: 50vh;
        border-radius: 12px;
    }

    .car-hero-thumbnails {
        padding: 20px 0;
        margin-top: 16px;
    }

    .car-hero-thumbnail {
        width: 70px;
        height: 52px;
    }

    .car-hero-thumbnails-list {
        gap: 10px;
        padding: 6px 0 12px 0;
    }
}

@media (max-width: 480px) {
    .car-hero-main {
        border-radius: 10px;
    }

    .car-hero-slide img {
        max-height: 40vh;
        min-height: 250px;
        border-radius: 10px;
    }

    .car-hero-thumbnails {
        padding: 16px 0;
        margin-top: 12px;
    }

    .car-hero-thumbnail {
        width: 60px;
        height: 45px;
    }

    .car-hero-thumbnails-list {
        gap: 8px;
        padding: 6px 0 12px 0;
    }

    .car-hero-thumbnails-container::-webkit-scrollbar {
        height: 4px;
    }
}

/* 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-slide.slide-in-right {
    animation: slideInFromRight 0.3s ease-out;
}

.car-hero-slide.slide-in-left {
    animation: slideInFromLeft 0.3s ease-out;
}

/* Ensure images maintain aspect ratio */
.car-hero-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Accessibility improvements */
.car-hero-thumbnail:focus {
    outline: none !important;
    box-shadow: none !important;
}

.car-hero-thumbnail:focus-visible {
    outline: 2px solid #cc0000 !important;
    outline-offset: 2px !important;
}

.car-hero-thumbnail:active {
    outline: none !important;
    box-shadow: 0 6px 20px rgba(204, 0, 0, 0.2) !important;
}

.car-hero-main:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .car-hero-thumbnail {
        border-width: 3px;
    }

    .car-hero-thumbnail.active {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .car-hero-slides,
    .car-hero-thumbnail,
    .car-hero-thumbnail img {
        transition: none;
    }

    .car-hero-slide.slide-in-right,
    .car-hero-slide.slide-in-left {
        animation: none;
    }
}