:root {
    --bg-color: #0b0b0d;
    --primary: #ff6b00;
    --text: #ffffff;
}

body, html { margin: 0; padding: 0; background-color: var(--bg-color); color: var(--text); font-family: system-ui, sans-serif; overflow-x: hidden; width: 100%; height: 100%; }

.focusable { outline: none; transition: background-color 0.15s ease, border-color 0.15s ease; }
.focusable:focus {
    outline: 1px solid rgba(255, 255, 255, 0.4) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    z-index: 99;
}

#technical-preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000000; z-index: 999999; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity 0.3s ease; }
.mini-spinner { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,0.1); border-top: 3px solid var(--primary); border-radius: 50%; animation: miniSpin 0.6s linear infinite; will-change: transform; }
@keyframes miniSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#site-preload-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000000; z-index: 99999; display: none; flex-direction: column; align-items: center; justify-content: center; opacity: 1; visibility: visible; transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.5s; }
#site-preload-overlay.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.netflix-logo-animation { width: 120px; height: auto; transform: scale(0.6); opacity: 0; filter: drop-shadow(0 0 20px rgba(255, 107, 0, 0.3)); will-change: transform, opacity, filter; }
.run-netflix-animation { animation: netflixIntro 3.0s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
@keyframes netflixIntro { 0% { transform: scale(0.5); opacity: 0; filter: blur(10px); } 12% { transform: scale(1.05); opacity: 1; filter: blur(0); } 85% { transform: scale(1); opacity: 1; filter: blur(0); } 100% { transform: scale(1.4); opacity: 0; filter: blur(5px); } }

.navbar-custom { background-color: #0b0b0d; border-bottom: 1px solid #1a1a1f; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 1000; position: relative; }
.top-row { display: flex; justify-content: center; align-items: center; width: 100%; }
.bottom-row { display: flex; justify-content: center; gap: 5px; width: 100%; flex-wrap: nowrap; }

.brand-logo-img { height: 28px; width: auto; object-fit: contain; display: block; }
.header-relogio { display: none; color: #ccc; font-size: 0.8rem; font-weight: 600; background: rgba(255,255,255,0.05); padding: 5px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); white-space: nowrap; }

.btn-menu-top { background: transparent; border: 1px solid #2d2d38; color: #aaa; padding: 5px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: bold; cursor: pointer; white-space: nowrap; display: flex; align-items: center; }
.btn-menu-top:hover { border-color: var(--primary); color: #fff; }

.main-content { padding: 15px; display: flex; flex-direction: column; align-items: center; width: 100%; box-sizing: border-box; position: relative; }

/* CAIXA DE PESQUISA FLUTUANTE */
.search-container { position: absolute; top: 15px; right: 15px; width: 300px; max-width: calc(100% - 30px); z-index: 1050; display: none; box-shadow: 0 4px 20px rgba(0,0,0,0.8); border-radius: 8px; }
.search-input { width: 100%; background: #16161a; border: 1px solid #2d2d38; color: #fff; padding: 10px 12px 10px 38px; border-radius: 8px; font-size: 0.9rem; outline: none; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.3); }
.search-icon-svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; fill: #4a4a5a; pointer-events: none; }

.player-container-full { width: 100%; max-width: 1200px; position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid #1a1a1f; aspect-ratio: 16/9; touch-action: manipulation; }

/* FORÇA O PREENCHIMENTO TOTAL QUANDO O ECRÃ INTEIRO ESTÁ ATIVO */
.player-container-full:fullscreen { height: 100% !important; max-height: 100% !important; aspect-ratio: auto !important; border-radius: 0 !important; border: none !important; }
.player-container-full:-webkit-full-screen { height: 100% !important; max-height: 100% !important; aspect-ratio: auto !important; border-radius: 0 !important; border: none !important; }
.player-container-full:-moz-full-screen { height: 100% !important; max-height: 100% !important; aspect-ratio: auto !important; border-radius: 0 !important; border: none !important; }

.video-js, iframe, #video-placeholder { width: 100%; height: 100%; background-color: #000; position: absolute; top:0; left:0; }

/* VÍDEO PADRÃO */
#my-video { width: 100%; height: 100%; background-color: #000; object-fit: contain; }
#video-placeholder { display: flex; align-items: center; justify-content: center; color: #777; }

.loader-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #000; z-index: 10; }
.spinner { border: 4px solid #333; border-top: 4px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; will-change: transform; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0d0d11; z-index: 12; text-align: center; padding: 20px; }
.error-text-title { color: #ff3e3e; font-weight: bold; font-size: 1rem; margin-bottom: 6px; }
.error-text-subtitle { color: #a0a0ab; font-size: 0.8rem; max-width: 300px; margin-bottom: 15px; line-height: 1.4; }
.btn-retry-channel { background: #22222a; border: 1px solid #3d3d4e; color: #fff; padding: 6px 16px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-retry-channel:hover { background: #2d2d38; border-color: var(--primary); }

.grid-quadrados { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 15px; width: 100%; }
.square-channel { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; aspect-ratio: 1/1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 4px; transition: background 0.2s; overflow: hidden; }
.square-channel:active { background: rgba(255, 107, 0, 0.2); border-color: var(--primary); }
.square-channel img { width: 28px; height: 28px; object-fit: contain; margin-bottom: 4px; border-radius: 4px; }
.square-channel span { font-size: 0.6rem; color: #ccc; text-align: center; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; display: block; }

.footer-credits { border-top: 1px solid rgba(255,255,255,0.05); padding-top: 15px; }

.player-menu-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); z-index: 50; display: none; flex-direction: column; padding: 15px; box-sizing: border-box; }
.menu-overlay-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; margin-bottom: 12px; height: 30px; }
.btn-fechar-menu { background: transparent; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.menu-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px; height: calc(100% - 42px); overflow: hidden; }
.menu-sidebar-abas { overflow-y: auto; padding-right: 5px; border-right: 1px solid rgba(255,255,255,0.1); height: 100%; }
.sidebar-btn { background: transparent; border: none; color: #a0a0ab; padding: 8px 10px; text-align: left; width: 100%; border-radius: 4px; font-size: 0.85rem; margin-bottom: 2px; cursor: pointer; display: block; }
.sidebar-btn.active { color: #fff; background: rgba(255,255,255,0.06); border-left: 3px solid var(--primary); padding-left: 12px; }

.menu-conteudo-canais { overflow-y: auto; padding-right: 5px; height: 100%; }
.canais-coluna-unica { display: flex; flex-direction: column; gap: 6px; }
.chan-row-item { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.05); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.chan-img { width: 30px; height: 30px; object-fit: contain; margin-right: 10px; border-radius: 3px; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

#number-overlay { display: none; position: absolute; top: 20px; right: 20px; font-size: 2.5rem; color: #ffffff; background: transparent; z-index: 999999; font-weight: bold; text-shadow: 2px 2px 5px rgba(0,0,0,0.8); }

#exit-modal, #resume-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 9999999; align-items: center; justify-content: center; }
.exit-modal-content { background: #16161a; border: 1px solid #2d2d38; padding: 25px; border-radius: 12px; text-align: center; max-width: 300px; }
.btn-modal { padding: 8px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; border: none; font-size: 0.9rem; }
.btn-modal-no { background: #333; color: #fff; margin-right: 10px; }
.btn-modal-yes { background: var(--primary); color: #fff; }

#btn-favoritar-atual { padding: 3px 8px !important; font-size: 0.65rem !important; height: auto; white-space: nowrap !important; flex-shrink: 0 !important; display: inline-flex; align-items: center; max-height: 24px; }

/* Acelera animações via GPU */
#site-preload-overlay, .player-menu-overlay, .chan-row-item { will-change: opacity, transform; }
/* Evita repaint ao rolar as listas do menu */
.menu-sidebar-abas, .menu-conteudo-canais { contain: strict; }

/* --- TELA CHEIA FALSA (CORREÇÃO PARA WEBVIEW) --- */
.falsa-tela-cheia { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; z-index: 9999999 !important; background-color: #000 !important; margin: 0 !important; padding: 0 !important; }
body.em-tela-cheia .navbar-custom, body.em-tela-cheia .main-content { display: none !important; }

/* ======== AJUSTES ESPECÍFICOS PARA MODO HORIZONTAL (TVS / PC) ======== */
@media (orientation: landscape) {
    .navbar-custom { flex-direction: row; justify-content: space-between; padding: 5px 15px; height: 50px; }
    .top-row { width: auto; justify-content: flex-start; gap: 15px; }
    .bottom-row { width: auto; justify-content: flex-end; gap: 8px; }
    .header-relogio { display: flex; align-items: center; }
    .main-content { padding: 10px !important; }
    .search-container { top: 10px; right: 10px; }
    .player-container-full { max-width: 100% !important; height: calc(100vh - 105px) !important; aspect-ratio: auto !important; border-radius: 0 !important; border: none !important; }
    .btn-menu-top { padding: 6px 12px; font-size: 0.85rem; }
    .brand-logo-img { height: 24px; }
    .menu-grid { grid-template-columns: 240px 1fr !important; gap: 15px !important; }
    .sidebar-btn { font-size: 1.15rem !important; padding: 12px 15px !important; margin-bottom: 5px !important; }
    .chan-row-item { padding: 12px 15px !important; margin-bottom: 8px !important; }
    .chan-img { width: 50px !important; height: 50px !important; margin-right: 15px !important; }
    .chan-row-item span { font-size: 1.15rem !important; }
    .badge { font-size: 0.95rem !important; padding: 6px 10px !important; }
    #menu-overlay-titulo { font-size: 1.4rem !important; }
    .menu-overlay-header { height: 40px !important; margin-bottom: 20px !important; }
}

/* ======== AJUSTES DE RESPONSIVIDADE P/ CELULAR ======== */
@media (max-width: 768px) {
    html, body { font-size: 14px; }
    .chan-row-item { padding: 6px 8px; }
    .chan-img { width: 25px; height: 25px; }
    .brand-logo-img { height: 22px !important; }
    .square-channel { padding: 2px; }
    .square-channel img { width: 22px; height: 22px; }
    .square-channel span { font-size: 0.55rem; }
    .bottom-info-bar h5 { font-size: 0.85rem !important; }
}

/* ======== AJUSTES DE PROPORÇÃO PARA TVS / TELAS GRANDES ======== */
@media (min-width: 1024px) {
    html { font-size: 1.2vw; }
    .brand-logo-img { height: 2.5vw; min-height: 28px; }
    .netflix-logo-animation { width: 15vw; min-width: 120px; }
    .btn-menu-top { font-size: 1vw; padding: 0.5vw 1vw; }
    .grid-quadrados { grid-template-columns: repeat(6, 1fr) !important; }
    .square-channel img { width: 3vw; height: 3vw; }
    .square-channel span { font-size: 0.8vw; }
}

@media (min-width: 1400px) {
    .grid-quadrados { grid-template-columns: repeat(8, 1fr) !important; }
}


/* ===== CORREÇÃO DEFINITIVA DE FULLSCREEN ===== */
#my-video,
video {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    backface-visibility: hidden !important;
}

#my-video:fullscreen,
#my-video:-webkit-full-screen,
#my-video:-moz-full-screen,
#my-video:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    background: #000 !important;
}

.player-container-full:fullscreen,
.player-container-full:-webkit-full-screen {
    overflow: visible !important;
}

body:fullscreen,
body:-webkit-full-screen {
    background: #000 !important;
}
