/* ===== CAROUSEL MODERNO 2024 ===== */

.carousel-home {
    position: relative;
    width: 100%;
    /* Limita a altura para que imagens 1:1 não quebrem o layout */
    max-height: 85vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
}

/* Força o contêiner a não crescer baseado no conteúdo (imagem) */
@supports (aspect-ratio: 16/9) {
    .carousel-home {
        height: auto;
    }
    .carousel-home .carousel,
    .carousel-home .carousel-inner,
    .carousel-home .carousel-item {
        height: 100%;
        width: 100%;
    }
}

.carousel-fullbleed {
    margin-top: -5px !important; /* Remove gap superior */
    border-radius: 0 !important; /* Bordas retas como TV */
    margin-bottom: 2rem !important;
}

/* Gradientes fixos - superior e inferior */
.carousel-home::before,
.carousel-home::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    /* Altura dos gradientes */
    z-index: 5;
    pointer-events: none;
}

/* Gradiente superior */
.carousel-home::before {
    top: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(0, 0, 0, 0.3) 50%,
            transparent 100%);
}

/* Gradiente inferior fade para o BG */
.carousel-home::after {
    bottom: 0;
    height: 180px; 
    background: linear-gradient(0deg,
            #000000 0%,
            #000000e3 15%,
            #000000b3 40%,
            transparent 100%);
}

.carousel-home .carousel-inner {
    border-radius: var(--radius-xl);
    /* Ajustado para variável */
    overflow: hidden;
    height: 100%;
}

.carousel-fullbleed .carousel-inner,
.carousel-fullbleed .carousel-item {
    border-radius: 0 !important;
    box-shadow: none !important;
}

.carousel-home .carousel-item {
    position: relative;
    height: 100%;
    /* Usando altura relativa em vez de fixa */
}

/* Overlay sutil no hover */
.carousel-home .carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    opacity: 0;
}

.carousel-home .carousel-item:hover::before {
    opacity: 1;
}

/* Imagens do carousel com limites */
.carousel-home .carousel-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Indicadores modernizados */
.carousel-home .carousel-indicators {
    bottom: 30px;
    margin-bottom: 0;
    z-index: 15;
    gap: 8px;
}

.carousel-home .carousel-indicators [data-bs-target] {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background-color: transparent;
    margin: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    opacity: 0.8;
    backdrop-filter: blur(10px);
}

.carousel-home .carousel-indicators [data-bs-target]:hover {
    border-color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.3);
    opacity: 1;
}

.carousel-home .carousel-indicators [data-bs-target].active {
    background-color: var(--color-one);
    border-color: var(--color-one);
    transform: scale(1.4);
    opacity: 1;
    box-shadow:
        0 0 15px rgba(229, 9, 20, 0.6),
        0 0 30px rgba(229, 9, 20, 0.3);
}

/* Controles de navegação premium */
.carousel-home .carousel-control-prev,
.carousel-home .carousel-control-next {
    width: 65px;
    height: 65px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.9;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-home .carousel-control-prev {
    left: 25px;
}

.carousel-home .carousel-control-next {
    right: 25px;
}

.carousel-home .carousel-control-prev:hover,
.carousel-home .carousel-control-next:hover {
    background: rgba(229, 9, 20, 0.9);
    border-color: var(--color-one);
    transform: translateY(-50%) scale(1.15);
    opacity: 1;
    box-shadow:
        0 8px 30px rgba(229, 9, 20, 0.5),
        0 0 0 8px rgba(229, 9, 20, 0.1);
}

/* Ícones dos controles */
.carousel-home .carousel-control-prev span,
.carousel-home .carousel-control-next span {
    font-size: 1.8rem;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.carousel-home .carousel-control-prev:hover span,
.carousel-home .carousel-control-next:hover span {
    color: white;
    transform: scale(1.2);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}

/* Conteúdo sobreposto no carousel */
.carousel-caption {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
    max-width: 800px;
    z-index: 6;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-large);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.carousel-caption h3 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.carousel-caption p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ===== RESPONSIVIDADE MELHORADA ===== */

/* Tablets e desktops menores */
@media (max-width: 1200px) {
    .carousel-home {
        max-width: 100%;
        margin: 0 1rem 2rem 1rem;
        border-radius: var(--radius-xl);
    }

    .carousel-caption {
        width: 85%;
        padding: 1.5rem;
    }

    .carousel-caption h3 {
        font-size: 2rem;
    }

    .carousel-caption p {
        font-size: 1.1rem;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .carousel-home {
        margin-bottom: 2rem;
        border-radius: var(--radius-large);
    }

    .carousel-home::before,
    .carousel-home::after {
        height: 80px;
    }

    .carousel-home .carousel-control-prev,
    .carousel-home .carousel-control-next {
        width: 50px;
        height: 50px;
    }

    .carousel-home .carousel-control-prev {
        left: 15px;
    }

    .carousel-home .carousel-control-next {
        right: 15px;
    }

    .carousel-caption {
        bottom: 80px;
        padding: 1.5rem;
    }

    .carousel-caption h3 {
        font-size: 1.8rem;
    }

    .carousel-caption p {
        font-size: 1rem;
    }
}

/* Smartphones grandes */
@media (max-width: 768px) {
    .carousel-home {
        margin: 0 0.5rem 1.5rem 0.5rem;
        border-radius: var(--radius-medium);
    }

    .carousel-home::before,
    .carousel-home::after {
        height: 60px;
    }

    .carousel-home .carousel-control-prev,
    .carousel-home .carousel-control-next {
        width: 45px;
        height: 45px;
    }

    .carousel-home .carousel-control-prev {
        left: 10px;
    }

    .carousel-home .carousel-control-next {
        right: 10px;
    }

    .carousel-home .carousel-control-prev span,
    .carousel-home .carousel-control-next span {
        font-size: 1.4rem;
    }

    .carousel-home .carousel-indicators {
        bottom: 20px;
    }

    .carousel-home .carousel-indicators [data-bs-target] {
        width: 12px;
        height: 12px;
    }

    .carousel-caption {
        bottom: 60px;
        padding: 1rem;
        width: 90%;
    }

    .carousel-caption h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .carousel-caption p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
}

/* Smartphones */
@media (max-width: 576px) {
    .carousel-home {
        margin: 0 0.5rem 1rem 0.5rem;
        border-radius: var(--radius-medium);
    }

    .carousel-home::before,
    .carousel-home::after {
        height: 50px;
    }

    .carousel-home .carousel-control-prev,
    .carousel-home .carousel-control-next {
        width: 40px;
        height: 40px;
    }

    .carousel-home .carousel-control-prev span,
    .carousel-home .carousel-control-next span {
        font-size: 1.2rem;
    }

    .carousel-home .carousel-indicators [data-bs-target] {
        width: 10px;
        height: 10px;
    }

    .carousel-caption {
        bottom: 50px;
        padding: 0.75rem;
        width: 95%;
    }

    .carousel-caption h3 {
        font-size: 1.3rem;
    }

    .carousel-caption p {
        font-size: 0.85rem;
    }
}

/* Smartphones pequenos */
@media (max-width: 400px) {
    .carousel-fullbleed {
        margin-top: -50px !important; /* Android headers compensation if needed */
    }
    .carousel-home {
        margin: 0 0.25rem 1rem 0.25rem;
        border-radius: var(--radius-small);
    }

    .carousel-home::before,
    .carousel-home::after {
        height: 40px;
    }

    .carousel-home .carousel-control-prev,
    .carousel-home .carousel-control-next {
        width: 35px;
        height: 35px;
    }

    .carousel-home .carousel-control-prev {
        left: 5px;
    }

    .carousel-home .carousel-control-next {
        right: 5px;
    }

    .carousel-home .carousel-control-prev span,
    .carousel-home .carousel-control-next span {
        font-size: 1rem;
    }

    .carousel-caption {
        bottom: 40px;
        padding: 0.5rem;
        width: 98%;
    }

    .carousel-caption h3 {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }

    .carousel-caption p {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }
}

/* Smartphones muito pequenos */
@media (max-width: 320px) {
    .carousel-caption {
        display: none;
        /* Esconde caption em telas muito pequenas */
    }

    .carousel-home .carousel-indicators {
        bottom: 15px;
    }

    .carousel-home .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
    }
}

/* Orientação paisagem em dispositivos móveis */
@media (max-width: 768px) and (orientation: landscape) {
    .carousel-home {
        max-height: 70vh;
    }

    .carousel-caption {
        bottom: 30px;
        padding: 0.75rem;
    }

    .carousel-caption h3 {
        font-size: 1.2rem;
    }

    .carousel-caption p {
        font-size: 0.8rem;
    }
}

/* ===== ANIMAÇÕES E EFEITOS ===== */

.carousel-home {
    animation: slideInFromBottom 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(80px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Efeito de parallax sutil */
.carousel-home .carousel-item {
    transform-style: preserve-3d;
}


/* Loading state */
.carousel-home.loading {
    background: linear-gradient(90deg, var(--color-two) 25%, var(--color-two-secondary) 50%, var(--color-two) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-home.loading::before {
    content: '🎬';
    font-size: 3rem;
    opacity: 0.7;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ===== OTIMIZAÇÕES ===== */

.carousel-home .carousel-item {
    will-change: transform;
}

.carousel-home .carousel-img {
    will-change: transform, filter;
}

.carousel-home .carousel-control-prev,
.carousel-home .carousel-control-next {
    will-change: transform, background, box-shadow;
}

/* Prevenção de CLS */
.carousel-home {
    aspect-ratio: 16/9;
}

.carousel-home .carousel-img {
    display: block;
    width: 100%;
    height: 100%;
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {

    .carousel-home .carousel-item,
    .carousel-home .carousel-img,
    .carousel-home .carousel-control-prev,
    .carousel-home .carousel-control-next {
        transition: none;
        animation: none;
    }

    .carousel-home .carousel-item:hover .carousel-img {
        transform: none;
    }
}

.carousel-home .carousel-control-prev:focus,
.carousel-home .carousel-control-next:focus {
    outline: 3px solid var(--color-one);
    outline-offset: 2px;
}

/* Imagens para admin (mantido do original) */
.carousel-add-editar {
    max-width: 200px;
    height: auto;
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-light);
    transition: transform var(--transition-fast);
}

.carousel-add-editar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

.carousel-table {
    max-width: 100px;
    height: auto;
    border-radius: var(--radius-small);
    transition: transform var(--transition-fast);
    cursor: pointer;
}

.carousel-table:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-light);
}

/*BACKGROUND DO INICIO*/

/* ============================================
   CAROUSEL DE BACKGROUND (Página de Login/Cadastro)
   ============================================ */
.carousel-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.carousel-background .carousel-item {
    height: 100vh;
    position: relative;
}

.carousel-background .carousel-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
    position: relative;
    z-index: 1;
}

/* Overlay escuro no lado esquerdo para contraste */
.carousel-background .carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(0, 0, 0, 1) 0%,
            rgba(0, 0, 0, 0.699) 30%,
            rgba(0, 0, 0, 0.144) 50%,
            rgba(0, 0, 0, 0) 70%,
            rgba(0, 0, 0, 0) 90%,
            transparent 100%);
    z-index: 2;
    pointer-events: none;
}

/* Texto no lado direito */
.carousel-text-right {
    position: absolute;
    top: 50%;
    right: 22%;
    transform: translateY(-40%);
    color: white;
    width: 50%;
    max-width: 500px;
    z-index: 3;
    padding: 10px;
    border-radius: 10px;
}

.carousel-text-right .carousel-title {
    font-size: 2.8rem;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.2;
    text-transform: uppercase;
    position: relative;
    z-index: 4;
}

.carousel-text-right .carousel-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 20px;
    position: relative;
    z-index: 4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.6em * 3);
}

/* Efeito fade suave do Bootstrap será usado (removidos overrides quebrados) */

/* Responsividade do carousel de background */
@media (min-width: 992px) and (max-width: 1199px) {
    .carousel-text-right {
        right: 15%;
        max-width: 400px;
        padding: 15px;
    }

    .carousel-text-right .carousel-title {
        font-size: 2.3rem;
    }

    .carousel-text-right .carousel-desc {
        font-size: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .carousel-text-right {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        width: 80%;
        max-width: 550px;
        margin: -120px auto 0;
        padding: 20px;
        text-align: center;
    }

    .carousel-text-right .carousel-title {
        font-size: 2.1rem;
    }

    .carousel-background .carousel-item::before {
        background: linear-gradient(to bottom, rgba(0, 0, 0, .95) 0%, rgba(0, 0, 0, .7) 20%, rgba(0, 0, 0, .4) 40%, transparent 80%);
    }
}

@media (max-width: 767px) {
    .carousel-text-right {
        display: none !important;
    }

    .carousel-text-right .carousel-title {
        font-size: 1.7rem;
    }

    .carousel-text-right .carousel-desc {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }

    .carousel-background .carousel-item::before {
        background: linear-gradient(to bottom, rgba(0, 0, 0, .98) 0%, rgba(0, 0, 0, .75) 25%, rgba(0, 0, 0, .45) 45%, transparent 85%);
    }

    .carousel-background .carousel-img {
        filter: brightness(0.4);
    }
    .carousel-iframe-container {
        filter: brightness(0.4);
    }
    .carousel-background .carousel-item::before {
        background: linear-gradient(to bottom, 
            rgba(0, 0, 0, 0.95) 0%, 
            rgba(0, 0, 0, 0.6) 50%, 
            rgba(0, 0, 0, 0.9) 100%) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-fade .carousel-item {
        transition: none;
    }
}

/* Animação Capa - Trailer CSS */
.carousel-img-fade {
    transition: opacity 2s ease-in-out;
}

.carousel-item.active .delay-fade {
    animation: fadeOutCover 3s forwards;
    animation-delay: 2s;
    /* tempo para o YT carregar e iniciar, ~2seg e dá fade-out */
}

@keyframes fadeOutCover {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Base Iframe Containers */
.carousel-iframe-container {
    transition: filter 1s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}