﻿/* ===== DIV PAI (WRAPPER) ===== */
.carousel-wrapper {
    width: 100%;
    min-height: 100vh;
    padding: 2rem 1rem;

    /* Centralização perfeita horizontal + vertical */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== TÍTULO ===== */
.carousel-wrapper h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    text-transform: uppercase;
    color: #e0e0e0;
    text-align: center;
}

/* ===== CARROSSEL CONTAINER ===== */
.carousel {
    position: relative;
    width: 90%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    background: #1a1a2e;

    /* Garante centralização do conteúdo interno */
    flex-shrink: 0;
}

/* ===== ÁREA DAS IMAGENS ===== */
.carousel__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel__slide {
    position: absolute;
    inset: 0;

    /* Centraliza a imagem horizontal e verticalmente dentro do slide */
    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transform: scale(1.03);
    pointer-events: none;
}

.carousel__slide.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    z-index: 1;
}

.carousel__slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}

/* ===== SETAS DE NAVEGAÇÃO ===== */
.carousel__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
}

.carousel__btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.carousel__btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel__btn--prev {
    left: 16px;
}

.carousel__btn--next {
    right: 16px;
}

.carousel__btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== INDICADORES (DOTS) ===== */
.carousel__dots {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.carousel__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    cursor: pointer;
    transition: all 0.35s ease;
    outline: none;
    padding: 0;
}

.carousel__dot:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.15);
}

.carousel__dot.active {
    background: #fff;
    border-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* ===== CONTADOR ===== */
.carousel__counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== BARRA DE PROGRESSO ===== */
.carousel__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
}

.carousel__progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    border-radius: 0 2px 2px 0;
    transition: width 0.08s linear;
}

/* ===== LEGENDA ===== */
.carousel__caption {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 60%;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.4s ease 0.2s;
}

.carousel__caption.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== CONTROLES INFERIORES (centralizados dentro do wrapper) ===== */
.carousel__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.carousel__play-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
}

.carousel__play-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
}

.carousel__play-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .carousel-wrapper h1 {
        font-size: 1.3rem;
        margin-bottom: 1.2rem;
    }

    .carousel-wrapper {
        padding: 1.5rem 0.5rem;
        min-height: auto;
    }

    .carousel {
        width: 95%;
        border-radius: 12px;
    }

    .carousel__btn {
        width: 38px;
        height: 38px;
    }

    .carousel__btn--prev { left: 8px; }
    .carousel__btn--next { right: 8px; }

    .carousel__btn svg {
        width: 16px;
        height: 16px;
    }

    .carousel__caption {
        font-size: 0.75rem;
        padding: 6px 12px;
        max-width: 55%;
    }

    .carousel__counter {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}

@media (max-width: 576px) {
    .carousel-wrapper {
        padding: 1rem 0.5rem;
        min-height: auto;
    }

    .carousel {
        width: 98%;
        border-radius: 10px;
    }

    .carousel__btn {
        width: 32px;
        height: 32px;
    }

    .carousel__btn--prev { left: 5px; }
    .carousel__btn--next { right: 5px; }

    .carousel__btn svg {
        width: 14px;
        height: 14px;
    }

    .carousel__controls {
        gap: 1rem;
        margin-top: 1rem;
    }

    .carousel__play-btn {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .carousel__caption {
        display: none;
    }
}

/* ===== ANIMAÇÃO DE LOADING ===== */
.carousel__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    z-index: 5;
    transition: opacity 0.4s ease;
}

.carousel__loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.carousel__loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
