/* Melhorias no carrossel para experiência mobile otimizada */

/* Container de carrossel */
.carousel-container {
    position: relative;
    margin: 0 -2rem;
    padding: 0 2rem;
    overflow: hidden;
    touch-action: pan-y; /* Permite scroll vertical mas intercepta horizontal */
}

/* Trilha do carrossel - rolagem suave otimizada */
.hb-content-grid, 
.hb-actors-carousel {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity; /* Alterado para proximity - rolagem mais natural */
    scroll-snap-points-x: repeat(100%);
    padding: 1rem 2rem;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    user-select: none;
    cursor: grab;
    /* Otimizações para melhor desempenho */
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Esconde a barra de rolagem */
.hb-content-grid::-webkit-scrollbar,
.hb-actors-carousel::-webkit-scrollbar {
    display: none;
}

/* Estado de arrastar ativo */
.hb-content-grid.dragging,
.hb-actors-carousel.dragging {
    cursor: grabbing !important;
    scroll-behavior: auto !important;
}

/* Items do carrossel - com transições mais suaves */
.hb-content-card,
.hb-actor-card,
.creator-card {
    scroll-snap-align: center; /* Alterado para center em vez de start */
    scroll-snap-stop: always; /* Garante que a rolagem sempre pare nos itens */
    transform: translateZ(0);
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.4s ease-out;
    -webkit-tap-highlight-color: transparent;
    /* Otimizações para iOS */
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
}

/* Estado dos cards durante arrastar */
.dragging .hb-content-card,
.dragging .hb-actor-card,
.dragging .creator-card {
    transition: none !important;
}

/* Feedback visual durante arrastar */
.dragging {
    cursor: grabbing;
}

/* Botões de navegação do carrossel - Design refinado */
.carousel-nav {
    display: flex;
    gap: 1rem;
    z-index: 10;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, background-color, box-shadow;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-btn i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.nav-btn:active {
    transform: scale(0.94);
    background: rgba(255, 51, 51, 0.5);
}

.nav-btn:hover i {
    transform: translateX(-2px);
}

.nav-btn.next:hover i {
    transform: translateX(2px);
}

.nav-btn:not(:disabled):hover {
    background: var(--hot-red);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.4), 0 0 30px rgba(255, 51, 51, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-btn.disabled,
.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Feedback de toque para dispositivos mobile */
@media (hover: none) {
    .hb-content-card:active,
    .hb-actor-card:active,
    .creator-card:active {
        transform: scale(0.98);
    }
}

/* Animação de deslize para novos items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hb-content-card.new-item,
.hb-actor-card.new-item,
.creator-card.new-item {
    animation: slideIn 0.5s ease forwards;
}

/* Ajustes responsivos para o carrossel */
@media (max-width: 768px) {
    .carousel-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }    
    .hb-content-grid, 
    .hb-actors-carousel {
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-btn {
        width: 36px;
        height: 36px;
    }
    
    /* Melhores contrastes e tamanhos para mobile */
    .content-overlay h3 {
        font-size: 1.1rem;
        max-width: 90%;
    }
    
    .watching-info {
        font-size: 0.8rem;
    }
}

/* Para telas menores e toque */
@media (max-width: 480px) {    .hb-content-grid, 
    .hb-actors-carousel {
        scroll-padding-left: 1rem;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

/* Estilos específicos para o Hero */
.hero-slides {
    touch-action: pan-y;
    user-select: none;
}

/* Indicador visual de deslize para usuários novos */
.swipe-indicator {
    position: absolute;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    color: white;
    pointer-events: none;
    z-index: 10;
    animation: fadeIn 1s ease, fadeOut 1s ease 5s forwards;
}

.swipe-indicator i {
    animation: slideLeftRight 1.5s infinite;
}

@keyframes slideLeftRight {
    0%, 100% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

/* Melhorias de acessibilidade para cards clicáveis - Adicionado para resolver problemas de modal */
.hb-content-card, 
.open-video-modal,
.hero .btn-primary.cta,
.hb-hero-slide {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.hb-content-card:hover, 
.open-video-modal:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.hero .btn-primary.cta:hover {
    transform: scale(1.05);
}

/* Adiciona um overlay de foco para melhorar acessibilidade */
.hb-content-card:focus, 
.open-video-modal:focus,
.hero .btn-primary.cta:focus {
    outline: 2px solid #ff3333;
    outline-offset: 2px;
}

/* Garante que todos os componentes do card acionem o evento de clique */
.hb-content-card *, 
.open-video-modal * {
    pointer-events: none;
}

/* Melhora a aparência do botão de play em cards */
.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
}

.hb-content-card:hover .play-overlay,
.open-video-modal:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 51, 51, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.play-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 51, 51, 1);
}