/**
 * DeMV Platform - Vehicle Image Display Styles
 * 
 * This stylesheet provides styles for the vehicle image display components,
 * including image galleries, thumbnails, and responsive image containers.
 */

/* Vehicle Image Base Styles */
.vehicle-image {
    display: block;
    width: 100%;
    height: auto;
    background-color: #f5f5f5;
    transition: opacity 0.3s ease-in-out;
    object-fit: cover;
    border-radius: 4px;
    will-change: opacity; /* Performance optimization for animations */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.vehicle-image.loading {
    opacity: 0.6;
    filter: blur(5px);
}

.vehicle-image.error {
    opacity: 0.8;
    filter: grayscale(100%);
}

/* Vehicle Image Container */
.vehicle-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f5f5f5;
    touch-action: pan-y; /* Optimize for vertical touch scrolling */
}

.vehicle-image-container::before {
    content: "";
    display: block;
    padding-top: 75%; /* 4:3 Aspect Ratio */
}

.vehicle-image-container .vehicle-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Vehicle Type Badge */
.vehicle-type-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

/* Vehicle Image Overlay */
.vehicle-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.vehicle-image-container:hover .vehicle-image-overlay {
    opacity: 1;
}

/* Touch device optimization */
@media (hover: none) {
    .vehicle-image-overlay {
        opacity: 1; /* Always show overlay on touch devices */
        background: linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5) 100%); /* Lighter overlay for better visibility */
    }
}

/* Vehicle Gallery */
.vehicle-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vehicle-gallery .main-image-container {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.vehicle-gallery .main-image-container::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.vehicle-gallery .main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease-in-out;
}

/* Thumbnails */
.vehicle-gallery .thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto; /* Enable horizontal scrolling on small screens */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Hide scrollbar on Firefox */
    padding-bottom: 5px; /* Add padding for scrollbar space */
}

.vehicle-gallery .thumbnails::-webkit-scrollbar {
    display: none; /* Hide scrollbar on Chrome/Safari */
}

.vehicle-gallery .thumbnail-item {
    width: calc(20% - 8px);
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease;
    flex-shrink: 0; /* Prevent thumbnails from shrinking */
    min-width: 80px; /* Minimum width for touch targets */
}

.vehicle-gallery .thumbnail-item::before {
    content: "";
    display: block;
    padding-top: 75%; /* 4:3 Aspect Ratio */
}

.vehicle-gallery .thumbnail-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.2s ease;
}

.vehicle-gallery .thumbnail-item:hover {
    transform: translateY(-2px);
}

.vehicle-gallery .thumbnail-item:hover img {
    filter: brightness(1.1);
}

.vehicle-gallery .thumbnail-item.active {
    box-shadow: 0 0 0 2px #3498db;
}

.vehicle-gallery .thumbnail-item.active img {
    filter: brightness(1.1);
}

/* Touch-friendly indicators for gallery navigation */
.vehicle-gallery .gallery-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    z-index: 3;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.vehicle-gallery .gallery-nav.prev {
    left: 10px;
}

.vehicle-gallery .gallery-nav.next {
    right: 10px;
}

.vehicle-gallery .gallery-nav i {
    color: #333;
    font-size: 18px;
}

/* Show navigation controls on touch devices */
@media (hover: none) {
    .vehicle-gallery .gallery-nav {
        display: flex;
    }
}

/* Vehicle Card Image */
.vehicle-card .vehicle-image-container {
    border-radius: 4px 4px 0 0;
}

.vehicle-card .vehicle-image-container::before {
    padding-top: 60%; /* 5:3 Aspect Ratio */
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .vehicle-gallery .thumbnail-item {
        width: calc(25% - 8px);
    }
}

@media (max-width: 768px) {
    .vehicle-gallery .thumbnail-item {
        width: calc(20% - 8px);
        min-width: 70px;
    }
    
    /* Optimize gallery layout for mobile */
    .vehicle-gallery .thumbnails {
        flex-wrap: nowrap; /* Force single row for horizontal scrolling */
        justify-content: flex-start;
        padding-bottom: 10px;
    }
    
    /* Adjust badge size for better visibility on small screens */
    .vehicle-type-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

@media (max-width: 576px) {
    .vehicle-gallery .thumbnail-item {
        width: 70px; /* Fixed width for consistent touch targets */
        min-width: 70px;
    }
    
    /* Optimize image containers for mobile */
    .vehicle-image-container::before {
        padding-top: 66.67%; /* 3:2 Aspect Ratio - better for mobile */
    }
    
    /* Adjust empty state for mobile */
    .vehicle-empty-state {
        padding: 30px 15px;
    }
    
    .vehicle-empty-state .icon {
        font-size: 36px;
    }
    
    /* Optimize vehicle cards for mobile */
    .vehicle-card .vehicle-image-container::before {
        padding-top: 56.25%; /* 16:9 Aspect Ratio - better for mobile */
    }
}

/* Loading Animation */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.8; }
    100% { opacity: 0.6; }
}

.vehicle-image.loading {
    animation: pulse 1.5s infinite;
}

/* Empty State */
.vehicle-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.vehicle-empty-state .icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.vehicle-empty-state .title {
    font-size: 18px;
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
}

.vehicle-empty-state .message {
    font-size: 14px;
    color: #888;
    max-width: 400px;
    margin-bottom: 16px;
}

.vehicle-empty-state .action-button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    min-height: 44px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: center;
}

.vehicle-empty-state .action-button:hover {
    background-color: #2980b9;
}

/* Vehicle Count Display */
.vehicle-count-display {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: #555;
}

.vehicle-count-display .count {
    font-weight: bold;
    margin: 0 4px;
}

.vehicle-count-display .total {
    color: #888;
    margin-left: 4px;
}

.vehicle-count-display .clear-filters {
    margin-left: auto;
    padding: 4px 8px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    min-height: 36px; /* Minimum touch target size */
    display: flex;
    align-items: center;
}

.vehicle-count-display .clear-filters:hover {
    background-color: #eee;
}

/* Vehicle Details Modal */
.vehicle-details-modal .vehicle-gallery {
    margin-bottom: 20px;
}

.vehicle-details-modal .vehicle-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .vehicle-details-modal .vehicle-info {
        grid-template-columns: repeat(2, 1fr);
    }
}

.vehicle-details-modal .info-item {
    display: flex;
    flex-direction: column;
}

.vehicle-details-modal .info-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.vehicle-details-modal .info-value {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* Vehicle Image Placeholder */
.vehicle-image-placeholder {
    background: linear-gradient(135deg, #f5f5f5 25%, #eee 25%, #eee 50%, #f5f5f5 50%, #f5f5f5 75%, #eee 75%, #eee 100%);
    background-size: 20px 20px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

/* Mobile swipe gallery */
.vehicle-gallery.swipe-enabled {
    position: relative;
    touch-action: pan-x; /* Enable horizontal swiping */
}

.vehicle-gallery.swipe-enabled .main-image-container {
    overflow: hidden;
}

.vehicle-gallery.swipe-enabled .main-image-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
    will-change: transform;
}

.vehicle-gallery.swipe-enabled .main-image-slide {
    flex: 0 0 100%;
    position: relative;
}

/* Pagination indicators for mobile */
.vehicle-gallery .pagination-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.vehicle-gallery .pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    transition: all 0.2s ease;
}

.vehicle-gallery .pagination-dot.active {
    background-color: #3498db;
    transform: scale(1.2);
}
