/* ============================================================================
   NOVOS EPISÓDIOS E LANÇAMENTOS — Lancamentos Section
   Prefixo: .lancamentos-* | Totalmente modular e isolado
   ============================================================================ */

/* ── Seção wrapper ──────────────────────────────────────────── */
.lancamentos-section {
    margin-bottom: 0px !important;
    margin-top: -20px !important;
    position: relative;
}

/* ── Header: Título + Tabs ──────────────────────────────────── */
.lancamentos-header {
    display: flex;
    flex-direction: column;
    margin-top: 32px;
    margin-bottom: 24px;
    padding: 0 4%;
}

.lancamentos-title {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex-shrink: 0;
}

.lancamentos-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #E63946;
    border-radius: 2px;
    flex-shrink: 0;
    order: 0;
    box-shadow: 0 0 10px rgba(230, 57, 70, 0.4);
}

.lancamentos-title i {
    font-size: 20px;
    color: var(--text-muted, #8E98A5);
    order: -1;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.lancamentos-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
    position: relative;
    z-index: 10;
    margin-top: 14px;
}

.lancamentos-tabs::-webkit-scrollbar {
    display: none;
}

.lancamentos-tab {
    background: none;
    border: none;
    color: #888888;
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 15px;
    font-weight: 500;
    padding: 10px 0 12px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.lancamentos-tab:hover {
    color: #ffffff;
}

.lancamentos-tab.is-active {
    color: #ffffff;
    font-weight: 600;
}

.lancamentos-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2.5px;
    background: #E63946;
    border-radius: 2px 2px 0 0;
    transform: scaleX(0);
    transition: transform var(--dur-base, 240ms) var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.5);
}

.lancamentos-tab.is-active::after {
    transform: scaleX(1);
}

/* ── Link "Ver Todos" (Footer) ─────────────────────────────── */
.lancamentos-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 4%;
    margin-top: 8px;
}

.lancamentos-ver-todos {
    font-family: var(--font-display, 'Outfit', sans-serif);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    position: relative;
    transition: color 0.2s ease;
}

.lancamentos-ver-todos:hover {
    color: #E63946;
}

.lancamentos-ver-todos::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: #E63946;
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(230, 57, 70, 0.4);
}

/* ── Grid scroll horizontal ─────────────────────────────────── */
@keyframes lancamentosGridFadeIn {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.lancamentos-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 24px 4% 34px;
    margin: -16px 0 -20px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    animation: lancamentosGridFadeIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lancamentos-grid::-webkit-scrollbar {
    display: none;
}

.lancamentos-grid::-webkit-scrollbar-track,
.lancamentos-grid::-webkit-scrollbar-thumb {
    background: transparent;
}

.lancamentos-grid--hidden {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    min-height: 0 !important;
}

/* ── Card Wrapper ──────────────────────────────────────────── */
.lancamentos-card-wrapper {
    position: relative;
    flex-shrink: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* ── Botões de Carrossel (Desktop) ──────────────────────────── */
.lancamentos-carousel-container .carousel-btn {
    z-index: 9999 !important;
}

@media (min-width: 769px) {
    .lancamentos-carousel-container:hover .carousel-btn {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .lancamentos-grid:hover .lancamentos-card-wrapper {
        transform: translateX(-40px);
    }

    .lancamentos-grid .lancamentos-card-wrapper:hover {
        transform: translateX(0) !important;
    }

    .lancamentos-grid .lancamentos-card-wrapper:hover~.lancamentos-card-wrapper {
        transform: translateX(40px);
    }

    .lancamentos-grid .lancamentos-card-wrapper:first-child:hover~.lancamentos-card-wrapper {
        transform: translateX(80px);
    }
}

/* ── Card Poster ───────────────────────────────────────────── */
.lancamentos-card {
    display: block;
    width: 180px;
    min-width: 180px;
    aspect-ratio: 2/3;
    border-radius: var(--radius-m, 16px);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
    background: var(--bg-card, #182636);
    transition: transform var(--dur-slow, 380ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)), 
                box-shadow var(--dur-slow, 380ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
    will-change: transform;
    isolation: isolate;
    text-decoration: none;
}

.lancamentos-card > img:not([class*="badge"]) {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--dur-slow, 380ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

/* Gradiente escuro na parte inferior para destacar título e ano */
.lancamentos-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(7, 11, 19, 0.95) 0%,
        rgba(7, 11, 19, 0.70) 35%,
        rgba(7, 11, 19, 0.20) 65%,
        transparent 100%
    );
    z-index: 2;
    pointer-events: none;
    border-radius: var(--radius-m, 16px);
    transition: opacity var(--dur-base, 240ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

/* Rating Badge no topo direito do card */
.lancamentos-rating-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    line-height: 1;
    pointer-events: none;
}

.lancamentos-rating-badge img {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: 14px !important;
    max-height: 14px !important;
    object-fit: contain !important;
    display: inline-block !important;
    margin: 0 !important;
    margin-top: -1px !important;
    padding: 0 !important;
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    filter: none !important;
}

/* Badge de qualidade (4K, HD, etc) */
.lancamentos-badge {
    position: absolute;
    top: 9px;
    left: 9px;
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    padding: 3px 7px;
    border-radius: 5px;
    z-index: 4;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Informações no rodapé interno do card */
.lancamentos-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 12px 10px;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.lancamentos-card-title {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: -0.1px;
}

.lancamentos-card-year {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 12px;
    font-weight: 500;
    color: #8E98A5;
    margin-top: 3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Efeito hover no desktop */
.lancamentos-card-wrapper:hover .lancamentos-card {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(230, 57, 70, 0.2);
}

.lancamentos-card-wrapper:hover .lancamentos-card > img:not([class*="badge"]) {
    transform: scale(1.06);
}

/* ── Hover Card (Popup expansível) ─────────────────────────── */
.lancamentos-hover-card {
    position: absolute;
    top: -25px;
    bottom: auto;
    left: -70px;
    width: 340px;
    height: auto;
    min-height: auto;
    background-color: #111A25;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92) translateY(8px);
    transform-origin: center top;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 50;
    border: 1px solid rgba(230, 57, 70, 0.2);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lancamentos-card-wrapper.is-active .lancamentos-hover-card,
.lancamentos-card-wrapper:hover .lancamentos-hover-card {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

@media (min-width: 769px) {
    .lancamentos-card-wrapper:first-child .lancamentos-hover-card {
        left: 0 !important;
    }

    .lancamentos-card-wrapper:last-child .lancamentos-hover-card {
        left: auto !important;
        right: 0 !important;
    }
}

.lancamentos-card-wrapper:hover {
    z-index: 50;
}

.lancamentos-card-wrapper.is-active {
    z-index: 50;
}

.lancamentos-hover-img-wrap {
    height: 145px;
    width: 100%;
    position: relative;
    background: #000;
    flex-shrink: 0;
    flex: none;
}

.lancamentos-hover-img-wrap > img:not(.lancamentos-hover-logo) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.lancamentos-hover-logo {
    width: auto !important;
    height: auto !important;
}

.lancamentos-hover-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(to bottom, transparent, #111A25);
}

.lancamentos-hover-content {
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1 1 auto;
}

.lancamentos-hover-title {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lancamentos-hover-rating {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 13px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lancamentos-imdb-icon {
    height: 20px;
    width: auto;
}

.lancamentos-hover-year {
    font-family: var(--font-display, 'Outfit', sans-serif);
    color: #8E98A5;
    font-weight: 500;
}

.lancamentos-age-chip {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 9px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background: #333;
}

.lancamentos-age-chip[data-age="L"] { background: #00a651; }
.lancamentos-age-chip[data-age="10"] { background: #00aef0; }
.lancamentos-age-chip[data-age="12"] { background: #fccc0a; color: #000; }
.lancamentos-age-chip[data-age="14"] { background: #f58220; }
.lancamentos-age-chip[data-age="16"] { background: #ed1c24; }
.lancamentos-age-chip[data-age="18"] { background: #000; border: 1px solid #ed1c24; }

.lancamentos-hover-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.lancamentos-category-tag {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 11px;
    color: #D7DEE8;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.lancamentos-hover-synopsis {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 12px;
    color: #8E98A5;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lancamentos-hover-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.lancamentos-hover-actions .btn-play {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #E63946 0%, #c42d3a 100%);
    color: #ffffff;
    text-decoration: none;
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 7px;
    transition: filter 0.2s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.lancamentos-hover-actions .btn-play:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.lancamentos-hover-actions .btn-save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.lancamentos-hover-actions .btn-save:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(230, 57, 70, 0.4);
}

.lancamentos-hover-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: background 0.2s ease;
}

.lancamentos-hover-close:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* ── Estado vazio ──────────────────────────────────────────── */
.lancamentos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted, #8E98A5);
    gap: 12px;
    text-align: center;
    width: 100%;
}

.lancamentos-empty i {
    font-size: 36px;
    color: var(--text-light, #FFFFFF);
}

.lancamentos-empty p {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 14px;
}

/* ── Responsividade Mobile ─────────────────────────────────── */
@media (max-width: 768px) {
    .lancamentos-grid {
        padding: 12px 6px !important;
        margin: 0 16px !important;
        gap: 10px !important;
        overflow-y: clip !important;
        scroll-snap-type: x mandatory;
    }

    .lancamentos-card,
    .lancamentos-card-wrapper {
        width: calc((100vw - 40px) / 2) !important;
        min-width: calc((100vw - 40px) / 2) !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .lancamentos-card-wrapper.is-active {
        width: 280px !important;
        min-width: 280px !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 50;
    }

    .lancamentos-card-title {
        width: 100% !important;
        font-size: 11px;
    }

    .lancamentos-card-year {
        font-size: 10px;
    }

    /* Desabilita hover no mobile — apenas clique ativa */
    .lancamentos-card-wrapper:hover .lancamentos-hover-card {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: none !important;
    }

    .lancamentos-card-wrapper.is-active {
        transform: none !important;
        z-index: 50;
    }

    .lancamentos-card-wrapper.is-active .lancamentos-hover-card {
        display: flex !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        width: min(330px, 88vw) !important;
        height: auto !important;
        min-height: auto !important;
        max-height: 85vh !important;
        z-index: 99999 !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        border-radius: 14px !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        animation: lancamentosModalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both !important;
    }

    .lancamentos-card-wrapper.is-active .lancamentos-card {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    @keyframes lancamentosModalFadeIn {
        from {
            opacity: 0;
            transform: translate(-50%, -46%) scale(0.92);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }

    .lancamentos-hover-close {
        display: flex;
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(5px);
        opacity: 1;
        pointer-events: auto;
    }

    body.lancamentos-modal-open .main::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 10, 15, 0.6);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 9998;
        cursor: pointer;
        display: block;
    }

    body.lancamentos-modal-open .lancamentos-section,
    body.lancamentos-modal-open .lancamentos-carousel-container {
        position: relative;
        z-index: 9999 !important;
    }

    body.lancamentos-modal-open .lancamentos-card-wrapper:not(.is-active) {
        filter: blur(5px) brightness(0.5);
        opacity: 0.7;
        pointer-events: none;
        transition: filter 0.3s ease, opacity 0.3s ease;
    }
}

@media (max-width: 480px) {
    .lancamentos-card,
    .lancamentos-card-wrapper {
        width: calc((100vw - 50px) / 2.3) !important;
        min-width: calc((100vw - 50px) / 2.3) !important;
    }

    .lancamentos-card-title {
        font-size: 11px;
    }

    .lancamentos-rating-badge {
        padding: 2px 6px;
        font-size: 11px;
    }

    .lancamentos-rating-badge img {
        height: 11px !important;
        max-height: 11px !important;
    }
}
