/* Carousel Component - Cacao UI Framework */

.carousel {
    position: relative;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    width: 100%;
    height: 300px;
    background-color: #fff;
}

.carousel-items {
    display: flex;
    transition: transform 0.3s ease;
    height: 100%;
}

.carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border-right: 1px solid #eee;
    position: relative;
}

.carousel-item:last-child {
    border-right: none;
}

.carousel-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* Navigation Controls */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav:hover {
    background-color: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background-color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-indicator.active,
.carousel-indicator:hover {
    background-color: #8B4513;
    transform: scale(1.2);
}

.carousel-indicator:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

/* Carousel Content Styling */
.carousel-content {
    text-align: center;
    padding: 20px;
    color: #333;
}

.carousel-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #8B4513;
}

.carousel-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

/* Carousel Placeholder */
.carousel-placeholder {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.carousel-placeholder-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Carousel Sizes */
.carousel.small {
    height: 200px;
}

.carousel.medium {
    height: 300px;
}

.carousel.large {
    height: 400px;
}

/* Autoplay Animation */
.carousel.autoplay .carousel-items {
    animation: carouselAutoplay 12s infinite;
}

@keyframes carouselAutoplay {
    0%, 25% { transform: translateX(0%); }
    33%, 58% { transform: translateX(-100%); }
    66%, 91% { transform: translateX(-200%); }
    100% { transform: translateX(0%); }
}

/* Fade Effect */
.carousel.fade .carousel-items {
    position: relative;
}

.carousel.fade .carousel-item {
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel.fade .carousel-item.active {
    opacity: 1;
}

/* Touch/Swipe Support */
.carousel.touch {
    touch-action: pan-y;
}

.carousel.touch .carousel-items {
    cursor: grab;
}

.carousel.touch .carousel-items:active {
    cursor: grabbing;
}

/* Loading State */
.carousel.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.carousel.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e8e8e8;
    border-top: 4px solid #8B4513;
    border-radius: 50%;
    animation: carouselSpin 1s linear infinite;
}

@keyframes carouselSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .carousel-nav {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .carousel-prev {
        left: 5px;
    }
    
    .carousel-next {
        right: 5px;
    }
    
    .carousel-indicators {
        bottom: 5px;
        gap: 6px;
    }
    
    .carousel-indicator {
        width: 8px;
        height: 8px;
    }
    
    .carousel.large {
        height: 250px;
    }
    
    .carousel.medium {
        height: 200px;
    }
}

/* Accessibility */
.carousel:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .carousel {
        border: 2px solid #000;
    }
    
    .carousel-nav {
        background-color: #000;
        border: 2px solid #fff;
    }
    
    .carousel-indicator {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .carousel-items {
        transition: none;
    }
    
    .carousel-nav {
        transition: none;
    }
    
    .carousel-indicator {
        transition: none;
    }
    
    .carousel.autoplay .carousel-items {
        animation: none;
    }
    
    .carousel.fade .carousel-item {
        transition: none;
    }
    
    @keyframes carouselAutoplay {
        0%, 100% { transform: translateX(0%); }
    }
}