/* Carousel Styles for Multi-Image Posts */

/* Gallery Card Carousel */
.carousel-card {
    position: relative;
}

.carousel-container {
    position: relative;
    overflow: hidden;
}

.carousel-images {
    position: relative;
    width: 100%;
    height: 320px;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-slide.active {
    opacity: 1;
}

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

/* Carousel Navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    z-index: 2;
}

.carousel-container:hover .carousel-nav {
    opacity: 1;
}

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

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* Carousel Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
}

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

.indicator-dot.active {
    background: white;
    transform: scale(1.2);
}

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

/* Carousel Counter */
.carousel-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 2;
}

/* Carousel Badge */
.carousel-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #9ca3af;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    vertical-align: middle;
}

/* Lightbox Carousel */
.lightbox-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: inherit;
}

.lightbox-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox-slide.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Lightbox Carousel Navigation */
.lightbox-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-carousel-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

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

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

/* Lightbox Indicators */
.lightbox-indicators {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 25px;
}

.lightbox-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-indicator.active {
    background: white;
    transform: scale(1.3);
}

.lightbox-indicator:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Lightbox Counter */
.lightbox-counter {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
    padding: 6px 12px;
    background: var(--light-gray);
    border-radius: 20px;
    display: inline-block;
}

/* Touch/Swipe Support */
.carousel-images,
.lightbox-carousel {
    touch-action: pan-y pinch-zoom;
}

/* Responsive Design */
@media (max-width: 768px) {
    .carousel-nav {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .carousel-prev {
        left: 5px;
    }

    .carousel-next {
        right: 5px;
    }

    .carousel-container:hover .carousel-nav,
    .carousel-nav {
        opacity: 1; /* Always visible on mobile */
    }

    .lightbox-carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .lightbox-carousel-prev {
        left: 10px;
    }

    .lightbox-carousel-next {
        right: 10px;
    }

    .carousel-indicators {
        bottom: 10px;
        padding: 4px 8px;
    }

    .indicator-dot {
        width: 6px;
        height: 6px;
    }
}

@media (max-width: 480px) {
    .carousel-counter {
        top: 10px;
        right: 10px;
        font-size: 11px;
        padding: 3px 8px;
    }

    .carousel-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Animation for smooth transitions */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.carousel-slide.next {
    animation: slideIn 0.3s ease;
}

/* Loading state for carousel images */
.carousel-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Accessibility */
.carousel-nav:focus,
.lightbox-carousel-nav:focus,
.indicator-dot:focus,
.lightbox-indicator:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}