/**
 * Hero Carousel Image Fix - Prevents Image Cropping
 * Ensures all images display properly without being cut off
 */

/* Hero Carousel Container */
#bannerCarousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4f7a 100%);
}

#carouselContainer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Carousel Slide Container */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #1e3a5f;
}

/* Image Styling - Show Full Image Without Cropping */
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain - shows full image */
    object-position: center center;
    display: block;
    margin: 0 auto;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

/* Enhanced Hero Carousel Image Styling - Better Alignment */
.hero-carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Use cover for better fill, but with smart positioning */
    object-position: center center;
    display: block;
    margin: 0 auto;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease-in-out;
    /* Ensure image fills container while maintaining aspect ratio */
    min-width: 100%;
    min-height: 100%;
}

/* Alternative: For images that need to show full content without cropping */
.hero-carousel-image.full-content {
    object-fit: contain;
    object-position: center center;
    background-color: #1e3a5f; /* Match carousel background */
}

/* Smart positioning for different image types */
.hero-carousel-image[src*="main-hero-7"] {
    object-fit: cover;
    object-position: center center;
    /* Focus on center area where main action is */
}

/* For training/event images - focus on center area */
.hero-carousel-image[src*="main-hero-7"],
.hero-carousel-image[src*="main-hero-2"],
.hero-carousel-image[src*="main-hero-3"] {
    object-fit: cover;
    object-position: center 40%; /* Slightly lower to show more content */
}

/* Alternative: If you want to use cover but with better positioning */
.carousel-slide img.hero-image-cover {
    object-fit: cover;
    object-position: center center;
}

/* Ensure images maintain aspect ratio - Enhanced */
.carousel-slide img.hero-carousel-image {
    /* For cover mode - fill container */
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* For contain mode - show full image */
.carousel-slide img.hero-carousel-image.contain-mode {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Responsive adjustments for different screen sizes */
@media (max-width: 640px) {
    .hero-carousel-image {
        object-fit: cover;
        object-position: center center;
        /* On mobile, use cover to fill screen better */
    }
    
    .hero-carousel-image[src*="main-hero-7"] {
        object-position: center 35%; /* Adjust for mobile view */
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .hero-carousel-image {
        object-fit: cover;
        object-position: center center;
    }
    
    .hero-carousel-image[src*="main-hero-7"] {
        object-position: center 40%; /* Tablet view */
    }
}

@media (min-width: 1025px) {
    .hero-carousel-image {
        object-fit: cover;
        object-position: center center;
        /* Desktop - full cover with center focus */
    }
    
    .hero-carousel-image[src*="main-hero-7"] {
        object-position: center 40%; /* Desktop view - show center content */
    }
}

/* Optional: Add subtle background gradient overlay for better visibility */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(30, 58, 95, 0.1) 0%,
        rgba(30, 58, 95, 0.2) 50%,
        rgba(30, 58, 95, 0.3) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Ensure image is above overlay */
.carousel-slide img {
    position: relative;
    z-index: 2;
}

/* Smooth image loading */
.carousel-slide img.lazy-loading {
    opacity: 0.7;
}

.carousel-slide img.lazy-loaded {
    opacity: 1;
    animation: fadeInImage 0.5s ease-in;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(1.05);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ensure navigation and indicators are above images */
#carouselNavigation,
#carouselIndicators {
    position: relative;
    z-index: 10;
}

/* Fix for images that are too wide or too tall */
.carousel-slide {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* If image is portrait (taller than wide) */
.carousel-slide img[data-aspect="portrait"] {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* If image is landscape (wider than tall) */
.carousel-slide img[data-aspect="landscape"] {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* If image is square */
.carousel-slide img[data-aspect="square"] {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Enhanced alignment for specific hero images */
.hero-carousel-image.align-top {
    object-position: top center;
}

.hero-carousel-image.align-bottom {
    object-position: bottom center;
}

.hero-carousel-image.align-center {
    object-position: center center;
}

/* Smart focus for event/training images */
.hero-carousel-image.focus-center {
    object-position: center 40%;
}

/* Ensure no white spaces around images */
.carousel-slide {
    background-color: #1e3a5f;
    background-image: linear-gradient(135deg, #1e3a5f 0%, #2a4f7a 100%);
}
