/* Main Carousel Container */
.carousel {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5; /* Fallback color */
    z-index: 1;
}

/* Carousel Inner Container */
.carousel-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Individual Slides */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: translateZ(0); /* Hardware acceleration */
    will-change: opacity; /* Performance optimization */
}

.carousel-slide picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Active Slide */
.carousel-slide.active {
    opacity: 1;
    visibility: visible;
}

/* Loading Placeholder */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    transition: opacity 0.3s ease-in-out;
    z-index: 1;
}

/* Remove placeholder when image is loaded */
.carousel-slide.image-loaded::before {
    opacity: 0;
}

/* Carousel Content Container */
.carousel-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

/* Content Container */
.carousel-content .container {
    padding: 2rem;
    color: #ffffff;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Hero Content Styles */
.hero-content {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(5px);
    transition: transform 0.3s ease;
}

.hero-content h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: clamp(1rem, 2vw, 1.5rem);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 3;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.carousel-arrow:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.prev {
    left: 20px;
}

.carousel-arrow.next {
    right: 20px;
}

.carousel-arrow i {
    color: #ffffff;
    font-size: 1.5rem;
}

/* Navigation Dots */
.carousel-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

.carousel-dot.active {
    background-color: #ffffff;
    transform: scale(1.2);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .carousel-content .container {
        padding: 1.5rem;
    }
}

@media (max-width: 992px) {
    .carousel {
        height: 80vh;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .carousel {
        height: 70vh;
    }

    .hero-content {
        padding: 1.5rem;
    }

    .carousel-arrow {
        width: 35px;
        height: 35px;
    }

    .carousel-arrow i {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .carousel {
        height: 60vh;
    }

    .hero-content {
        padding: 1rem;
    }

    .carousel-arrow {
        width: 30px;
        height: 30px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .carousel-slide::before,
    .carousel-arrow,
    .hero-content,
    .carousel-dot {
        transition: none;
    }
}

/* Image Loading Animation */
@keyframes imageLoadingPulse {
    0% { background-color: #f5f5f5; }
    50% { background-color: #e0e0e0; }
    100% { background-color: #f5f5f5; }
}

.carousel-slide:not(.image-loaded)::before {
    animation: imageLoadingPulse 1.5s ease-in-out infinite;
}

/* Touch Device Optimizations */
@media (hover: none) {
    .carousel-arrow {
        background-color: rgba(255, 255, 255, 0.3);
    }

    .carousel-dot {
        width: 14px;
        height: 14px;
    }
}

/* High Contrast Mode */
@media (forced-colors: active) {
    .carousel-arrow,
    .carousel-dot {
        border: 2px solid currentColor;
    }
}