:root {
    --primary-color: #e50914;
    --dark-color: #141414;
    --light-dark-color: #222;
    --text-color: #fff;
    --gray-color: #8c8c8c;
    --header-height: 60px;
    --sidebar-width: 260px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; background-color: var(--dark-color); color: var(--text-color); overflow: hidden; }

/* --- NAVEGAÇÃO GLOBAL --- */
#global-header { height: var(--header-height); background-color: var(--light-dark-color); display: none; align-items: center; justify-content: space-between; padding: 0 40px; position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; }
#global-header.visible { display: flex; }
.logo { font-size: 1.5rem; font-weight: bold; color: var(--primary-color); }
#main-nav { display: flex; gap: 20px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-link { color: var(--gray-color); text-decoration: none; font-size: 1rem; padding: 10px; border-bottom: 2px solid transparent; transition: color 0.3s, border-color 0.3s; }
.nav-link:hover { color: var(--text-color); }
.nav-link.active { color: var(--text-color); font-weight: bold; border-bottom-color: var(--primary-color); }
.header-right { display: flex; align-items: center; gap: 20px; }
.search-container { display: flex; align-items: center; background-color: #101010; border: 1px solid var(--gray-color); border-radius: 4px; padding: 0 8px; }
.search-icon { width: 20px; height: 20px; fill: var(--gray-color); }
#search-input { background: none; border: none; outline: none; color: var(--text-color); padding: 8px; font-size: 1rem; width: 200px; }
#logout-btn { background-color: transparent; border: 1px solid var(--gray-color); color: var(--text-color); padding: 8px 16px; border-radius: 4px; cursor: pointer; transition: all 0.3s; }
#logout-btn:hover { background-color: var(--primary-color); border-color: var(--primary-color); }

/* --- ESTRUTURA DAS TELAS --- */
#screen-container { margin-top: var(--header-height); height: calc(100vh - var(--header-height)); overflow: hidden; }
.screen { display: none; width: 100%; height: 100%; animation: fadeIn 0.5s ease-in-out; }
.screen.active { display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#login-screen { justify-content: center; align-items: center; margin-top: 0; height: 100vh; }
.login-container { background-color: var(--light-dark-color); padding: 40px 60px; border-radius: 8px; width: 100%; max-width: 450px; text-align: center; }
.login-container h1 { font-size: 2.5rem; color: var(--primary-color); }
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 5px; color: var(--gray-color); }
.input-group input { width: 100%; padding: 12px; border-radius: 4px; border: 1px solid var(--gray-color); background-color: #333; color: var(--text-color); font-size: 1rem; }
#login-form button { width: 100%; padding: 15px; background-color: var(--primary-color); color: var(--text-color); border: none; border-radius: 4px; font-size: 1.1rem; cursor: pointer; transition: background-color 0.3s; margin-top: 20px; }
#login-form button:hover { background-color: #f6121d; }

/* --- LAYOUT DE CONTEÚDO PRINCIPAL --- */
.content-layout { display: flex; flex-grow: 1; height: 100%; }
#category-sidebar { width: var(--sidebar-width); background-color: #181818; overflow-y: auto; flex-shrink: 0; }
.category-link { padding: 12px 20px; cursor: pointer; color: var(--gray-color); border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-link:hover { background-color: var(--light-dark-color); }
.category-link.active { background-color: var(--light-dark-color); color: var(--text-color); border-left-color: var(--primary-color); font-weight: bold; }
#content-area { flex-grow: 1; overflow-y: auto; padding: 20px 40px; }
#scroll-sentinel { height: 50px; width: 100%; }
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.content-item { background-color: var(--light-dark-color); border-radius: 5px; cursor: pointer; transition: transform 0.3s; overflow: hidden; position: relative; aspect-ratio: 2 / 3; }
.content-item:hover { transform: scale(1.05); }
.content-item img { width: 100%; height: 100%; object-fit: cover; position: absolute; }
.content-item-title { position: absolute; bottom: 0; width: 100%; background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); padding: 20px 10px 10px 10px; }
.channel-item { aspect-ratio: 16 / 9; }

/* ESTILOS PARA FAVORITOS */
.favorite-icon {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    background-color: rgba(0,0,0,0.5);
    border-radius: 50%;
    padding: 4px;
    cursor: pointer;
    z-index: 5;
    transition: transform 0.2s;
}
.favorite-icon svg { width: 100%; height: 100%; fill: #fff; }
.favorite-icon:hover { transform: scale(1.1); }
.favorite-icon.favorited svg { fill: var(--primary-color); }
.favorites-category-title {
    width: 100%;
    font-size: 1.8rem;
    margin-top: 30px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-color);
    grid-column: 1 / -1; /* Ocupa toda a largura da grid */
}
.favorites-category-title:first-child { margin-top: 0; }

/* --- LAYOUT INTEGRADO DE CANAIS --- */
#channel-preview-container { display: none; }
#preview-player { width: 100%; background-color: #000; aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 20px; }
#epg-info { background-color: var(--light-dark-color); padding: 20px; border-radius: 8px; }
#epg-info h2 { font-size: 1.8rem; color: var(--primary-color); margin-bottom: 10px; }
#epg-time { font-weight: bold; color: var(--text-color); margin-bottom: 15px; }

/* --- TELAS DE INFORMAÇÕES E PLAYER --- */
.screen-header { padding: 20px 40px; background-color: var(--light-dark-color); flex-shrink: 0; }
.back-btn { background-color: transparent; border: 1px solid var(--gray-color); color: var(--text-color); padding: 8px 16px; border-radius: 4px; cursor: pointer; transition: all 0.3s; }
.back-btn:hover { background-color: var(--primary-color); border-color: var(--primary-color); }
.info-layout { display: flex; padding: 40px; gap: 40px; flex-grow: 1; overflow-y: auto; }
.info-left { flex-basis: 300px; flex-shrink: 0; }
.info-left img { width: 100%; border-radius: 8px; }
.info-right { flex-grow: 1; display: flex; flex-direction: column; }
.info-right h1, #series-title-info { font-size: 2.2rem; margin-bottom: 15px; }
#movie-details { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.info-right p { color: var(--gray-color); line-height: 1.6; margin-top: 20px; }
.play-button { padding: 15px; background-color: var(--primary-color); color: var(--text-color); border: none; border-radius: 5px; font-size: 1.2rem; cursor: pointer; transition: background-color 0.3s; margin-top: auto; }
#series-info-screen .info-right h2 { font-size: 1.5rem; margin-bottom: 15px; padding-bottom: 5px; border-bottom: 1px solid var(--light-dark-color); }
#season-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.season-btn { padding: 10px 15px; background-color: var(--light-dark-color); border: 1px solid var(--gray-color); color: var(--text-color); border-radius: 20px; cursor: pointer; }
.season-btn.active { background-color: var(--primary-color); border-color: var(--primary-color); font-weight: bold; }
#episode-list .content-item-title { font-size: 0.9rem; text-align: center; }
#player-screen { background-color: #000; position: relative; }
#video-player { width: 100%; height: 100%; }
#player-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
#player-overlay .screen-header { background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent); border: none; display: flex; justify-content: space-between; align-items: center; }
#player-overlay .back-btn, #player-overlay #close-player-btn { pointer-events: auto; }
#close-player-btn { font-size: 2.5rem; color: var(--text-color); background: rgba(0,0,0,0.4); border: none; border-radius: 50%; width: 50px; height: 50px; line-height: 50px; text-align: center; cursor: pointer; transition: background-color 0.3s; }
#close-player-btn:hover { background-color: rgba(229, 9, 20, 0.8); }
.loader-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 9999; display: none; justify-content: center; align-items: center; }
.loader-spinner { border: 8px solid var(--gray-color); border-top: 8px solid var(--primary-color); border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- RESPONSIVIDADE --- */
@media (max-width: 992px) { #main-nav { display: none; } #global-header { justify-content: space-between; } }
@media (max-width: 768px) { #global-header { padding: 0 15px; } .logo { display: none; } .header-right { width: 100%; } .search-container { flex-grow: 1; } #logout-btn { font-size: 0.8rem; } #content-area { padding: 15px; } .content-layout { flex-direction: column; } #category-sidebar { width: 100%; max-height: 150px; border-bottom: 1px solid #333; } .info-layout { flex-direction: column; padding: 20px; } }