/* ==========================================================================
   PRIMER PLAY - MODO SMART TV v3 (CONTROLE REMOTO, OK DUPLO E PLAYER AMPLIADO)
   ========================================================================== */

/* Botões do Topo (Versão Smart TV e Abrir Menu) */
.btn-tv-mode,
.btn-tv-menu {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    text-decoration: none !important;
    white-space: nowrap;
}

.btn-tv-mode:hover,
.btn-tv-menu:hover {
    border-color: #e50914;
    background: linear-gradient(135deg, #e50914 0%, #b80710 100%);
    color: #ffffff !important;
}

.btn-tv-mode .tv-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #94a3b8;
    display: inline-block;
}

body.tv-mode-active .btn-tv-mode {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #34d399;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.45);
}

body.tv-mode-active .btn-tv-mode .tv-dot {
    background-color: #6ee7b7;
    box-shadow: 0 0 8px #6ee7b7;
}

/* Garante que o Menu Lateral apareça em qualquer resolução quando aberto no Modo TV */
.sidebar-one.active,
body.tv-mode-active .sidebar-one.tv-sidebar-open {
    left: 0px !important;
    z-index: 1060 !important;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.85) !important;
}

/* Evita que o container do Splide corte a borda luminosa do item focado */
body.tv-mode-active .splide__track {
    padding-top: 14px !important;
    padding-bottom: 18px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Destaque Visual Forte de Foco do Controle Remoto (Estilo Netflix / Smart TV) */
.tv-focused {
    outline: 3px solid #ffffff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px #e50914, 0 12px 28px rgba(229, 9, 20, 0.9) !important;
    transition: transform 0.14s ease, box-shadow 0.14s ease !important;
    z-index: 999 !important;
    position: relative !important;
}

/* Cards de Filmes, Séries e Canais quando selecionados pela seta */
.splide-item-image.tv-focused,
.stream-list .item.tv-focused,
.perfil-selecionar-item.tv-focused {
    border: 3px solid #ffffff !important;
    outline: 4px solid #e50914 !important;
    outline-offset: 0px !important;
    box-shadow: 0 0 25px rgba(229, 9, 20, 0.95), inset 0 0 16px rgba(229, 9, 20, 0.55) !important;
    transform: scale(1.06) !important;
    background-color: rgba(229, 9, 20, 0.22) !important;
}

/* Tarja "APERTE OK" dentro do Card selecionado na TV */
.splide-item-image.tv-focused::after,
.stream-list .item.tv-focused::after {
    content: "▶ APERTE OK";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #e50914 0%, #b80710 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    padding: 3px 4px;
    letter-spacing: 0.5px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    z-index: 1001;
    pointer-events: none;
}

/* Destaque nos itens do Menu Lateral (Sidebar) quando selecionados pela seta */
.sidebar-one .list-group-item.tv-focused,
.sidebar-one .accordion-button.tv-focused {
    background: linear-gradient(90deg, #e50914 0%, #99060d 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    padding-left: 18px !important;
    outline: 3px solid #ffffff !important;
    outline-offset: -3px !important;
    box-shadow: 0 4px 18px rgba(229, 9, 20, 0.85) !important;
}

.sidebar-one .list-group-item.tv-focused i,
.sidebar-one .accordion-button.tv-focused i,
.sidebar-one .accordion-button.tv-focused .title {
    color: #ffffff !important;
}

/* Destaque na barra lateral inteira quando o foco está no Menu */
body.tv-mode-active .sidebar-one.tv-zone-active {
    border-right: 3px solid #e50914 !important;
}

/* Destaque no Player de Vídeo quando focado */
#videojs-player.tv-focused {
    outline: 3px solid #e50914 !important;
    box-shadow: 0 0 24px rgba(229, 9, 20, 0.6) !important;
}

/* Ajustes Gerais da Página em Modo Smart TV */
body.tv-mode-active {
    overscroll-behavior: none;
    user-select: none;
}

/* Amplia o player, inclusive nas TVs que recusam a API de fullscreen.
   Mantém a proporção original do vídeo; as faixas pretas do conteúdo são normais. */
.primer-player-actions .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
}

#primer-player-exit-fullscreen {
    display: none;
}

body.tv-player-fullscreen #primer-player-exit-fullscreen {
    display: inline-flex;
    position: absolute;
    top: 12px;
    right: 12px;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    z-index: 10050;
    background: rgba(10, 10, 16, 0.88);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    font: 600 14px Arial, sans-serif;
}

#primer-player-exit-fullscreen:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

html.tv-player-fullscreen,
body.tv-player-fullscreen {
    overflow: hidden !important;
    background: #000 !important;
}

body.tv-player-fullscreen .sidebar-one,
body.tv-player-fullscreen .navbar-one,
body.tv-player-fullscreen .container-player-info,
body.tv-player-fullscreen .container-player-temp,
body.tv-player-fullscreen .page-content-opacity,
body.tv-player-fullscreen #tv-remote-hud {
    display: none !important;
}

body.tv-player-fullscreen .container-player {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #000 !important;
    z-index: 10001 !important;
}

body.tv-player-fullscreen #videojs-player {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    outline: none !important;
    box-shadow: none !important;
    background: #000 !important;
}

body.tv-player-fullscreen #videojs-player video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

#videojs-player #tv-osd-toast {
    top: 24px;
    max-width: 90%;
    text-align: center;
}

/* Barra Guia / Controle Interativo na Parte Inferior (HUD) */
#tv-remote-hud {
    position: fixed;
    bottom: 12px;
    right: 16px;
    z-index: 9998;
    background: rgba(10, 10, 16, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-left: 4px solid #e50914;
    border-radius: 10px;
    padding: 7px 12px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.85);
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

body.tv-mode-active #tv-remote-hud {
    display: flex;
}

body.tv-mode-active #tv-remote-hud.hud-hidden {
    opacity: 0;
    pointer-events: none;
}

#tv-remote-hud .hud-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}

#tv-remote-hud .hud-btn:hover,
#tv-remote-hud .hud-btn:active {
    background: #e50914;
    border-color: #ffffff;
}

#tv-remote-hud .hud-btn-menu {
    background: linear-gradient(135deg, #e50914 0%, #b80710 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Toast / Feedback Visual Grande na Tela da TV (OSD) */
#tv-osd-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: rgba(12, 12, 20, 0.96);
    border: 2px solid #e50914;
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

@media screen and (max-width: 767px) {
    #tv-remote-hud {
        left: 8px;
        right: 8px;
        bottom: 8px;
        font-size: 11px;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }
    .btn-tv-mode span:not(.tv-dot),
    .btn-tv-menu span {
        font-size: 11px;
    }
}

/* v1.7.2: also suppress the obsolete floating exit label if an old JS is cached. */
#primer-player-exit-fullscreen,
body.tv-player-fullscreen #primer-player-exit-fullscreen,
#videojs-player #primer-player-exit-fullscreen {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
