/* ===== RESPONSIVE IMAGE SYSTEM ===== */

/* Base Image Optimization */
.img-optimized {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.img-optimized:hover {
    transform: scale(1.02);
}

/* ===== ASPECT RATIO CONTAINERS ===== */

/* Square Aspect Ratio (1:1) */
.aspect-square {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
}

.aspect-square img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Circular Images */
.aspect-circle {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 50%;
}

.aspect-circle img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Rectangle Aspect Ratios */
.aspect-4-3 {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
}

.aspect-4-3 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aspect-16-9 {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
}

.aspect-16-9 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== SIZE VARIANTS (Maps to i100, i280, i350, i500 directories) ===== */

/* Small Images (uses i100 directory) */
.img-sm {
    width: 60px;
    height: 60px;
}

.img-sm.aspect-square,
.img-sm.aspect-circle {
    width: 60px;
    height: 60px;
}

/* Medium Images (uses i280 directory) */
.img-md {
    width: 120px;
    height: 120px;
}

.img-md.aspect-square,
.img-md.aspect-circle {
    width: 120px;
    height: 120px;
}

/* Large Images (uses i350 directory) */
.img-lg {
    width: 180px;
    height: 180px;
}

.img-lg.aspect-square,
.img-lg.aspect-circle {
    width: 180px;
    height: 180px;
}

/* Extra Large Images (uses i500 directory) */
.img-xl {
    width: 250px;
    height: 250px;
}

.img-xl.aspect-square,
.img-xl.aspect-circle {
    width: 250px;
    height: 250px;
}

/* ===== RESPONSIVE GRID IMAGES ===== */

/* Festival Grid Images */
.festival-grid-img {
    width: 100%;
    max-width: 80px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #f8f9fa;
    transition: all 0.3s ease;
}

.festival-grid-img:hover {
    border-color: #28a745;
    transform: scale(1.1);
}

/* Card Images */
.card-img-top {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Widget Images */
.widget-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.widget-img:hover {
    transform: scale(1.05);
}

/* ===== LOADING STATES ===== */

.img-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; }
}

/* ===== OVERLAY EFFECTS ===== */

.img-overlay {
    position: relative;
    overflow: hidden;
}

.img-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(40, 167, 69, 0.1), rgba(255, 193, 7, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.img-overlay:hover::after {
    opacity: 1;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Mobile First Approach */
@media (max-width: 576px) {
    .img-sm { width: 50px; height: 50px; }
    .img-md { width: 80px; height: 80px; }
    .img-lg { width: 120px; height: 120px; }
    .img-xl { width: 150px; height: 150px; }
    
    .festival-grid-img {
        max-width: 60px;
    }
    
    .widget-img {
        width: 60px;
        height: 60px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .img-sm { width: 55px; height: 55px; }
    .img-md { width: 100px; height: 100px; }
    .img-lg { width: 150px; height: 150px; }
    .img-xl { width: 200px; height: 200px; }
    
    .festival-grid-img {
        max-width: 70px;
    }
    
    .widget-img {
        width: 70px;
        height: 70px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .img-sm { width: 60px; height: 60px; }
    .img-md { width: 110px; height: 110px; }
    .img-lg { width: 160px; height: 160px; }
    .img-xl { width: 220px; height: 220px; }
}

@media (min-width: 993px) {
    .img-sm { width: 60px; height: 60px; }
    .img-md { width: 120px; height: 120px; }
    .img-lg { width: 180px; height: 180px; }
    .img-xl { width: 250px; height: 250px; }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Lazy Loading Support */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* WebP Support */
.webp .img-optimized {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ===== ACCESSIBILITY ===== */

.img-optimized:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .img-overlay::after {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .img-optimized,
    .festival-grid-img,
    .card-img-top,
    .widget-img {
        transition: none;
    }
    
    .img-optimized:hover,
    .festival-grid-img:hover,
    .card:hover .card-img-top,
    .widget-img:hover {
        transform: none;
    }
}

/* ===== UTILITY CLASSES ===== */

.img-grayscale {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.img-grayscale:hover {
    filter: grayscale(0%);
}

.img-blur {
    filter: blur(2px);
    transition: filter 0.3s ease;
}

.img-blur:hover {
    filter: blur(0);
}

.img-brightness {
    filter: brightness(0.8);
    transition: filter 0.3s ease;
}

.img-brightness:hover {
    filter: brightness(1);
}

/* ===== MODERN CARD DESIGNS ===== */

.modern-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modern-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.modern-card .card-img-container {
    position: relative;
    overflow: hidden;
}

.modern-card .card-img-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(255, 193, 7, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-card:hover .card-img-container::after {
    opacity: 1;
}

/* ===== ENHANCED FESTIVAL CARDS ===== */

.festival-card-enhanced {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.festival-card-enhanced:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.festival-card-enhanced .festival-img {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #f8f9fa;
    transition: border-color 0.3s ease;
}

.festival-card-enhanced:hover .festival-img {
    border-color: #28a745;
}

.festival-card-enhanced .festival-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}