/* ===== CAROUSEL CONTAINER ===== */
.carousel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a0000 0%, #3d0000 100%);
}

.carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ===== CAROUSEL ITEMS - SMOOTH SLIDING ===== */
.carousel-item {
    position: relative;
    transition: 
        transform 1s cubic-bezier(0.645, 0.045, 0.355, 1),
        opacity 1s ease-in-out;
    will-change: transform, opacity;
}

/* Slide เข้า-ออกอย่างนุ่มนวล */
.carousel-item-next,
.carousel-item-prev {
    position: absolute;
    top: 0;
}

.carousel-item-next {
    transform: translateX(100%);
}

.carousel-item-prev {
    transform: translateX(-100%);
}

.carousel-item-next.carousel-item-start,
.carousel-item-prev.carousel-item-end {
    transform: translateX(0);
}

.carousel-item.active {
    transform: translateX(0);
    opacity: 1;
}

/* ===== IMAGE EFFECTS - PREMIUM ANIMATION ===== */
.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition:
        opacity 1s cubic-bezier(0.4, 0, 0.2, 1),
        transform 8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        filter 1s ease-in-out;
    opacity: 0;
    transform: scale(1);
    filter: brightness(0.95) contrast(1);
    will-change: transform, opacity, filter;
}

/* เมื่อ slide active - Ken Burns Effect */
.carousel-item.active img {
    opacity: 1;
    transform: scale(1.08);
    filter: brightness(1) contrast(1.05);
    animation: kenBurns 8s ease-out forwards;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.08) translate(-2%, -1%);
    }
}

/* ===== FADE EFFECTS - SMOOTH TRANSITIONS ===== */
/* เมื่อกำลังจะออก */
.carousel-item-next:not(.carousel-item-start) img,
.carousel-item-prev:not(.carousel-item-end) img,
.carousel-item.active.carousel-item-end img,
.carousel-item.active.carousel-item-start img {
    opacity: 0;
    transform: scale(1.02);
    filter: brightness(0.8);
}

/* ===== CROSSFADE EFFECT ===== */
.carousel-fade .carousel-item {
    opacity: 0;
    transition: 
        opacity 1.2s ease-in-out,
        transform 8s ease-out;
    transform: translateX(0);
}

.carousel-fade .carousel-item.active {
    opacity: 1;
}

.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev {
    transform: translateX(0);
    opacity: 0;
}

.carousel-fade .carousel-item-next.carousel-item-start,
.carousel-fade .carousel-item-prev.carousel-item-end {
    opacity: 1;
}

/* ===== OVERLAY GRADIENT ===== */
.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0) 50%,
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
}

.carousel-item.active::before {
    opacity: 1;
}

/* ===== GLOW EFFECT ON EDGES ===== */
.carousel-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: 
        inset 0 0 100px rgba(255, 215, 0, 0.1),
        inset 0 0 50px rgba(255, 100, 0, 0.05);
    z-index: 1;
    opacity: 0;
    animation: glowPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== CAROUSEL CONTROLS - PREMIUM STYLE ===== */
.carousel-control-prev,
.carousel-control-next {
    width: 80px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(255, 215, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    background-color: rgba(255, 215, 0, 0.4);
    border-color: rgba(255, 215, 0, 1);
    transform: scale(1.15);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.6),
        0 0 50px rgba(255, 100, 0, 0.3);
}

/* ===== CAROUSEL INDICATORS ===== */
.carousel-indicators {
    z-index: 10;
    margin-bottom: 2rem;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 6px;
}

.carousel-indicators .active {
    background-color: #ffd700;
    transform: scale(1.4);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.carousel-indicators [data-bs-target]:hover {
    background-color: rgba(255, 215, 0, 0.6);
    transform: scale(1.2);
}

/* ===== CAPTION ANIMATIONS ===== */
.carousel-caption {
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.3s;
}

.carousel-item.active .carousel-caption {
    opacity: 1;
    transform: translateY(0);
}

.carousel-caption h5 {
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.3);
    background: linear-gradient(90deg, #ffd700, #ff8c00, #ffd700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 3s linear infinite;
}

@keyframes textShimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.carousel-caption p {
    font-size: 1.2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* ===== PERFORMANCE OPTIMIZATION ===== */
.carousel-item,
.carousel-item img {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .carousel-control-prev,
    .carousel-control-next {
        width: 50px;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 40px;
        height: 40px;
    }
    
    .carousel-caption h5 {
        font-size: 1.8rem;
    }
    
    .carousel-item.active img {
        transform: scale(1.05);
    }
    
    @keyframes kenBurns {
        0% {
            transform: scale(1) translate(0, 0);
        }
        100% {
            transform: scale(1.05) translate(-1%, -0.5%);
        }
    }
}

/* ===== SMOOTH LOADING STATE ===== */
.carousel-item.loading img {
    opacity: 0;
    filter: blur(10px);
}

.carousel-item img.loaded {
    animation: imageReveal 1s ease-out forwards;
}

@keyframes imageReveal {
    0% {
        opacity: 0;
        filter: blur(10px);
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}