﻿/* Image Display Fixes for WhyWeRent - Enhanced Card Sizing */

/* Base image styling */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

/* Category Images - Smaller Cards */
.category-image,
.brand-image,
.model-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 6px;
    box-sizing: border-box;
    display: block;
    background: #f4f4f4;
}

.image-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

/* Vehicle Images */
.vehicle-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.3s ease;
    background: #f5f5f5;
}

.vehicle-image:hover {
    transform: scale(1.02);
}

/* Property Images */
.property-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.3s ease;
    background: #f5f5f5;
}

.property-image:hover {
    transform: scale(1.02);
}

/* Sponsor Images */
.sponsor-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: block;
    border: 2px solid #ffc107;
    transition: all 0.3s ease;
}

.sponsor-image:hover {
    transform: scale(1.1);
    border-color: #ffcd38;
}

/* Thumbnail Images */
.thumbnail-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.thumbnail-image:hover {
    border-color: #ffc107;
    transform: scale(1.1);
}

/* Enhanced Card Layouts - Smaller & Compact */
.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    max-width: 220px;
    margin: 0 auto;
}

.image-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-color: #ffc107;
}

.image-card .image-wrapper {
    position: relative;
    overflow: hidden;
}

.image-card .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.image-card .card-content {
    padding: 1rem;
}

.image-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.image-card .card-subtitle {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Responsive Grid Layouts - Smaller Cards */
.images-grid {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.images-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.images-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.images-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* Compact Grid for Browse Pages */
.category-grid,
.brand-grid,
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.category-card,
.brand-card,
.model-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    max-width: 220px;
    margin: 0 auto;
}

.category-card:hover,
.brand-card:hover,
.model-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.category-card .card-content,
.brand-card .card-content,
.model-card .card-content {
    padding: 0.6rem 0.8rem 0.8rem;
    text-align: center;
}

.category-card h3,
.brand-card h3,
.model-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.category-card p,
.brand-card p,
.model-card p {
    color: #666;
    font-size: 0.75rem;
    margin: 0;
}

.brand-count,
.model-count {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-block;
    margin-top: 0.3rem;
}

/* Loading States */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error States */
.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.8rem;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    text-align: center;
}

.image-error::before {
    content: "📷";
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
    display: block;
}

/* Mobile Responsive - Even Smaller Cards */
@media (max-width: 768px) {
    .category-image,
    .brand-image,
    .model-image {
        height: 100px;
    }
    
    .vehicle-image,
    .property-image {
        height: 140px;
    }
    
    .sponsor-image {
        width: 60px;
        height: 60px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .category-grid,
    .brand-grid,
    .model-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.8rem;
    }
    
    .image-card .card-content,
    .category-card .card-content,
    .brand-card .card-content,
    .model-card .card-content {
        padding: 0.6rem;
    }
    
    .image-card .card-title,
    .category-card h3,
    .brand-card h3,
    .model-card h3 {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .category-image,
    .brand-image,
    .model-image,
    .vehicle-image,
    .property-image {
        height: 120px;
    }
    
    .images-grid,
    .category-grid,
    .brand-grid,
    .model-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.6rem;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .image-card,
    .category-card,
    .brand-card,
    .model-card {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .image-card .card-title,
    .category-card h3,
    .brand-card h3,
    .model-card h3 {
        color: #e0e0e0;
    }
    
    .image-card .card-subtitle,
    .category-card p,
    .brand-card p,
    .model-card p {
        color: #999;
    }
    
    .image-error {
        background: #333;
        color: #999;
        border-color: #555;
    }
}