/* ===== Animated Carousel Styles ===== */

/* Home page carousel background wrapper only */
.carousel-background-wrapper {
    position: relative;
    /* overflow: hidden; */
    /* border-radius: 10px; */
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Fixed background layer for home page carousel only */
.carousel-background-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #32326f 50%, #f0862a00 100%),
                url('/images/gallery/ppusmb1.jpg') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    background-position: center center;
    z-index: 1;
    /* opacity: 0.9; */
    pointer-events: none; /* Allow carousel interactions */
}

/* Home page carousel container with wrapper */
#carouselExampleIndicators {
    position: relative;
    background: transparent; /* No background conflict */
    z-index: 2; /* Above background layer */
    border-radius: 10px;
    overflow: hidden;
}

/* News detail carousel container without wrapper */
#newsImagesCarousel {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* General carousel styling */
.carousel {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

/* Carousel Item Styling - No background needed, handled by wrapper */
.carousel-item {
    /* position: relative; */
    z-index: 3; /* Above background and carousel container */
}

/* Image styling with hover effect */
.carousel-item img {
    transition: transform 0.5s ease, filter 0.5s ease;
    border-radius: 10px;
    width: 100%;
    height: 400px;
    object-fit: cover;
    filter: brightness(0.9);
    position: relative;
    z-index: 4; /* Above carousel items */
}

.carousel-item:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Ken Burns Effect - Slow zoom and pan animation (DISABLED - Using random effects now) */
/* Uncomment below to enable Ken Burns as default instead of random effects */
/*
.carousel-item.active:not([class*="effect-"]) img {
    animation: kenBurnsEffect 8s ease-out infinite alternate;
}

@keyframes kenBurnsEffect {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.1) translate(-2%, -2%);
    }
}
*/

/* Alternative: Zoom in effect when slide becomes active (DISABLED) */
/*
.carousel-item.active .carousel-image-wrapper img {
    animation: zoomIn 1s ease-out forwards;
}

@keyframes zoomIn {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
*/

/* Slide from left animation for images (DISABLED) */
/*
.carousel-item-next .carousel-image-wrapper img,
.carousel-item-prev .carousel-image-wrapper img {
    animation: slideImage 0.6s ease-out;
}

@keyframes slideImage {
    0% {
        transform: translateX(-30px) scale(0.95);
        opacity: 0.5;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}
*/

/* Content area styling */
.carousel-content {
    position: relative;
    z-index: 3; /* Higher than images and background */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    /* Removed initial transform and animation for better compatibility */
}

/* Title animation */
.carousel-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.carousel-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    animation: underlineGrow 1s ease-out 0.5s forwards;
}

@keyframes underlineGrow {
    to {
        width: 100%;
    }
}

/* Date and category styling */
.carousel-meta {
    margin-bottom: 20px;
}

.carousel-meta .btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.carousel-meta .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.carousel-meta .btn:hover::before {
    left: 100%;
}

/* Content description */
.carousel-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* Read more button enhancement */
.carousel-read-more {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.carousel-read-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Custom carousel controls */
.carousel-control-prev,
.carousel-control-next {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    border: 2px solid #667eea;
    z-index: 5; /* Highest z-index for controls */
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: #667eea;
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev {
    left: 20px;
}

.carousel-control-next {
    right: 20px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: invert(1);
    transition: all 0.3s ease;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    filter: invert(0);
}

/* Carousel indicators */
.carousel-indicators {
    bottom: 20px;
    z-index: 5; /* Same level as controls */
}

.carousel-indicators li {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 5px;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid #fff;
    transition: all 0.3s ease;
}

.carousel-indicators .active {
    background: #667eea;
    transform: scale(1.2);
}

/* Image wrapper for better control */
.carousel-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    z-index: 2;
}

/* Minimum height for carousel */
.min-vh-50 {
    min-height: 50vh;
}

/* Bootstrap margin utilities for better spacing */
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-2 { margin-left: 0.5rem !important; }

/* Simple fade effect - fixed positioning issue */
.carousel-fade .carousel-item {
    opacity: 0;
    transition-duration: 0.6s;
    transition-property: opacity;
    /* Ensure proper positioning */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.carousel-fade .carousel-item.active {
    opacity: 1;
    position: relative;
}

/* Remove transform conflicts */
.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev {
    transform: none !important;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .carousel-content {
        padding: 25px;
    }

    .carousel-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 992px) {
    .carousel-content {
        padding: 20px;
        margin-top: 20px;
    }

    .carousel-title {
        font-size: 1.6rem;
    }

    .min-vh-50 {
        min-height: 60vh;
    }
}

@media (max-width: 768px) {
    .carousel-content {
        padding: 20px;
        margin: 15px 10px;
    }

    .carousel-title {
        font-size: 1.4rem;
    }

    .carousel-item img {
        height: 250px;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
    }

    .carousel-control-prev {
        left: 10px;
    }

    .carousel-control-next {
        right: 10px;
    }

    .min-vh-50 {
        min-height: 70vh;
    }

    .carousel-meta {
        margin-bottom: 15px;
    }

    .carousel-meta .genric-btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

@media (max-width: 576px) {
    .carousel-content {
        padding: 15px;
        margin: 10px 5px;
    }

    .carousel-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .carousel-description {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .carousel-item img {
        height: 200px;
    }

    .min-vh-50 {
        min-height: auto;
        padding: 30px 0;
    }
}

/* Loading animation for carousel */
.carousel-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.carousel-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Simple content fade-in without positioning conflicts */
/* DISABLED - Using animate-content class with JavaScript instead */
/*
.carousel-item.active .carousel-content {
    animation: contentFadeIn 0.6s ease-out;
}

@keyframes contentFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
*/

/* Ensure active content is always visible */
.carousel-item.active .carousel-content {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Parallax effect for background */
.carousel-parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Viewport animations */
.animate-in-view {
    animation: slideInUp 0.8s ease-out forwards;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced hover effects for other page elements */
.choice_item,
.media,
.card {
    transition: all 0.3s ease;
}

.choice_item:hover,
.media:hover,
.card:hover {
    transform: translateY(-10px);
   /*  box-shadow: 0 20px 40px rgba(0,0,0,0.15); */
}

/* ===== Additional Image Animation Options ===== */

/* Option 1: Pulse effect - uncomment to use */
/*
.carousel-item.active .carousel-image-wrapper img {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}
*/

/* Option 2: Fade + Scale effect - uncomment to use */
/*
.carousel-item.active .carousel-image-wrapper img {
    animation: fadeScale 1.2s ease-out forwards;
}

@keyframes fadeScale {
    0% {
        transform: scale(0.8);
        opacity: 0;
        filter: blur(5px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}
*/

/* Option 3: Rotate + Zoom effect - uncomment to use */
/*
.carousel-item.active .carousel-image-wrapper img {
    animation: rotateZoom 1.5s ease-out forwards;
}

@keyframes rotateZoom {
    0% {
        transform: scale(0.7) rotate(-5deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}
*/

/* Option 4: Flip effect - uncomment to use */
/*
.carousel-item.active .carousel-image-wrapper {
    animation: flipIn 0.8s ease-out;
}

@keyframes flipIn {
    0% {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    100% {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}
*/

/* Image glow effect on hover */
.carousel-image-wrapper:hover {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6),
                0 0 60px rgba(118, 75, 162, 0.4);
    transition: box-shadow 0.3s ease;
}

/* ===== ADVANCED RANDOM EFFECTS ===== */

/* 1. DISSOLVE EFFECT */
.carousel-item.effect-dissolve .carousel-image-wrapper img {
    animation: dissolveEffect 1.8s ease-out forwards;
}

@keyframes dissolveEffect {
    0% {
        opacity: 0;
        filter: blur(20px) brightness(1.5);
        transform: scale(1.1);
    }
    50% {
        opacity: 0.5;
        filter: blur(10px) brightness(1.2);
    }
    100% {
        opacity: 1;
        filter: blur(0) brightness(1);
        transform: scale(1);
    }
}

/* 2. BLINDS EFFECT (Vertical blinds) */
.carousel-item.effect-blinds .carousel-image-wrapper {
    overflow: hidden;
    position: relative;
}

.carousel-item.effect-blinds .carousel-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #000 0px,
        #000 40px,
        transparent 40px,
        transparent 80px
    );
    z-index: 10;
    animation: blindsOpen 1.5s ease-out forwards;
}

@keyframes blindsOpen {
    0% {
        opacity: 1;
        transform: scaleX(1);
    }
    100% {
        opacity: 0;
        transform: scaleX(0);
    }
}

.carousel-item.effect-blinds .carousel-image-wrapper img {
    animation: blindsZoom 1.5s ease-out forwards;
}

@keyframes blindsZoom {
    0% {
        transform: scale(1.2);
        filter: brightness(0.5);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* 3. FADE EFFECT (Simple smooth fade) */
.carousel-item.effect-fade .carousel-image-wrapper {
    overflow: hidden;
    position: relative;
}

.carousel-item.effect-fade .carousel-image-wrapper img {
    animation: simpleFade 1.5s ease-in-out forwards;
}

@keyframes simpleFade {
    0% {
        opacity: 0;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 4. CHECKERBOARD EFFECT (DISABLED) */
/*
.carousel-item.effect-checkerboard .carousel-image-wrapper {
    overflow: hidden;
    position: relative;
}

.carousel-item.effect-checkerboard .carousel-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            0deg,
            #000 0px,
            #000 50px,
            transparent 50px,
            transparent 100px
        ),
        repeating-linear-gradient(
            90deg,
            #000 0px,
            #000 50px,
            transparent 50px,
            transparent 100px
        );
    z-index: 10;
    animation: checkerboardFade 1.2s ease-out forwards;
}

@keyframes checkerboardFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    60% {
        opacity: 0.5;
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

.carousel-item.effect-checkerboard .carousel-image-wrapper img {
    animation: checkerboardReveal 1.2s ease-out forwards;
}

@keyframes checkerboardReveal {
    0% {
        transform: scale(0.9);
        opacity: 0.3;
        filter: contrast(0.5);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: contrast(1);
    }
}
*/

/* 5. VORTEX EFFECT (DISABLED) */
/*
.carousel-item.effect-vortex .carousel-image-wrapper {
    perspective: 1000px;
    overflow: hidden;
}

.carousel-item.effect-vortex .carousel-image-wrapper img {
    animation: vortexSpin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    transform-origin: center center;
}

@keyframes vortexSpin {
    0% {
        transform: rotate(360deg) scale(0.3);
        opacity: 0;
        filter: blur(15px) hue-rotate(180deg);
    }
    50% {
        opacity: 0.7;
        filter: blur(5px) hue-rotate(90deg);
    }
    100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
        filter: blur(0) hue-rotate(0deg);
    }
}
*/

/* 6. PIXELATE EFFECT */
.carousel-item.effect-pixelate .carousel-image-wrapper img {
    animation: pixelateReveal 1.5s steps(20) forwards;
}

@keyframes pixelateReveal {
    0% {
        filter: blur(0) contrast(0);
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        filter: blur(5px) contrast(2);
        opacity: 0.5;
    }
    100% {
        filter: blur(0) contrast(1);
        opacity: 1;
        transform: scale(1);
    }
}

/* 7. WAVE EFFECT */
.carousel-item.effect-wave .carousel-image-wrapper {
    overflow: hidden;
}

.carousel-item.effect-wave .carousel-image-wrapper img {
    animation: waveDistort 1.8s ease-out forwards;
}

@keyframes waveDistort {
    0% {
        clip-path: polygon(
            0% 0%, 100% 0%,
            100% 100%, 0% 100%,
            0% 50%
        );
        transform: translateX(-100%) scale(0.8);
        filter: blur(10px);
    }
    50% {
        clip-path: polygon(
            0% 10%, 100% 0%,
            100% 90%, 0% 100%,
            0% 50%
        );
        filter: blur(5px);
    }
    100% {
        clip-path: polygon(
            0% 0%, 100% 0%,
            100% 100%, 0% 100%,
            0% 0%
        );
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Ensure smooth transitions between effects */
.carousel-item .carousel-image-wrapper,
.carousel-item .carousel-image-wrapper img {
    will-change: transform, opacity, filter;
}

/* Remove conflicting animations when using random effects */
.carousel-item[class*="effect-"] img {
    animation: none !important;
}

/* Disable Ken Burns effect when random effect is active */
.carousel-item.active[class*="effect-"] img {
    animation: none !important;
}

/* Ensure effect animations work properly */
.carousel-item[class*="effect-"].active .carousel-image-wrapper {
    position: relative;
    z-index: 2;
}

/* Effect indicator (optional) - shows effect name */
.carousel-item[class*="effect-"]::before {
    content: attr(data-effect);
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show effect name on hover (for debugging) */
.carousel-item[class*="effect-"]:hover::before {
    opacity: 0.8;
}

/* Smooth hardware acceleration for all effects */
.carousel-item .carousel-image-wrapper,
.carousel-item .carousel-image-wrapper img,
.carousel-item .carousel-image-wrapper::before {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}