:root {
    --dark-bg: #000;
    --dark-header: #1a2a40;
    --dark-sidebar: rgba(10, 20, 32, 0.95);
    --dark-card: #2c2c2c;
    --blue-highlight: #007bff;
    --primary-brand: #8a79f8;
    --text-light: #fff;
    --text-muted: #818181;
    --card-hover-scale: 1.05;
}

body { font-family: 'Poppins', sans-serif; margin: 0; padding: 0; background-color: var(--dark-bg); color: var(--text-light); overflow-x: hidden; display: flex; flex-direction: column; min-height: 100vh; }
.header { background: linear-gradient(to right, var(--dark-header), #0a1420); color: var(--text-light); padding: 15px; display: flex; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0; z-index: 100; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }
.header-left { display: flex; align-items: center; }
.hamburger-icon { font-size: 30px; cursor: pointer; margin-right: 15px; }
.search-bar { flex-grow: 1; position: relative; }
.search-bar input { width: 100%; padding: 8px 15px; padding-left: 40px; border-radius: 20px; border: none; background-color: #334; color: var(--text-light); }
.search-bar .search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #8899a6; }
.sidebar { height: 100%; width: 0; position: fixed; z-index: 101; top: 0; left: 0; background-color: var(--dark-sidebar); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow-x: hidden; transition: 0.5s; padding-top: 20px; box-shadow: 2px 0 10px rgba(0, 0, 0, 0.7); }
.sidebar-header { padding: 20px 25px; margin-bottom: 10px; text-align: center; font-size: 1.5em; font-weight: bold; color: var(--primary-brand); background: rgba(47, 50, 76, 0.2); border-bottom: 1px solid rgba(138, 121, 248, 0.2); text-shadow: 0 0 10px rgba(138, 121, 248, 0.5); }
.sidebar a { padding: 15px 25px 15px 32px; text-decoration: none; font-size: 18px; color: var(--text-muted); display: flex; align-items: center; transition: 0.3s; }
.sidebar a:hover, .sidebar a.active { color: var(--text-light); background-color: var(--dark-card); }
.sidebar a i { margin-right: 15px; font-size: 20px; }
.close-btn { position: absolute; top: 10px; right: 25px; font-size: 36px; color: var(--text-light); }
.overlay { height: 100%; width: 0; position: fixed; z-index: 98; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); transition: 0.5s; }
.main-content { padding-top: 70px; padding-bottom: 60px; flex-grow: 1; }
.page { padding: 20px; }
.content-row { margin-bottom: 30px; }
.content-row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.content-row-header h2 { font-size: 24px; margin: 0; }
.content-row .list-container { display: flex; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; padding-bottom: 10px; }
.content-row .list-container::-webkit-scrollbar { display: none; }
.content-row .list-container { -ms-overflow-style: none; scrollbar-width: none; }
.content-row .movie-card { flex-shrink: 0; width: 150px; margin-right: 15px; position: relative; cursor: pointer; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease, outline-color 0.2s ease; outline: 3px solid transparent; }
.content-row .movie-card:hover { transform: scale(var(--card-hover-scale)); }
.content-row .movie-card img { width: 100%; display: block; }
.movie-info { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent); padding: 10px; text-align: center; }
.movie-info h3 { margin: 0; font-size: 14px; }
.hero-section { position: relative; width: 100%; height: 400px; margin-bottom: 40px; overflow: hidden; background-size: cover; background-position: center; }
.hero-info { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent); padding: 40px 20px 20px; }
.hero-info h2 { font-size: 2.5em; margin: 0; }
.hero-info p { margin: 5px 0 0; color: var(--text-muted); }
.hero-info button { background-color: var(--blue-highlight); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; margin-top: 15px; }

/* --- ESTILOS PROFESIONALES Y LLAMATIVOS PARA EL REPRODUCTOR DE TV --- */
#video-player-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: black; z-index: 3000; justify-content: center; align-items: center; }
.player-container { width: 100%; height: 100%; position: relative; display: flex; justify-content: center; align-items: center; }
.video-wrapper { position: relative; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
#movie-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}
.player-controls { position: absolute; bottom: 0; left: 0; right: 0; height: 60px; background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent); color: white; display: flex; align-items: center; padding: 0 20px; z-index: 3; opacity: 0; transform: translateY(100%); transition: opacity 0.3s ease, transform 0.3s ease; }
.player-controls.visible { opacity: 1; transform: translateY(0); }
.player-controls .play-pause-btn, .player-controls .fullscreen-btn { background: none; border: none; color: white; cursor: pointer; font-size: 1.8em; padding: 10px; }
.player-controls .progress-bar-container { flex-grow: 1; height: 5px; background: rgba(255, 255, 255, 0.3); margin: 0 15px; border-radius: 5px; cursor: pointer; }
.player-controls .progress-bar { width: 0%; height: 100%; background: var(--primary-brand); border-radius: 5px; }

.close-player-btn { position: absolute; top: 20px; right: 20px; background: rgba(0, 0, 0, 0.6); color: white; border-radius: 50%; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 4; font-size: 1.5em; border: 1px solid rgba(255,255,255,0.2); opacity: 0; transition: opacity 0.3s ease; }
.close-player-btn.visible { opacity: 1; }

.player-epg-info { position: absolute; top: 0; left: 0; right: 0; padding: 20px; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent); z-index: 3; color: white; opacity: 0; transform: translateY(-100%); transition: opacity 0.3s ease, transform 0.3s ease; display: flex; align-items: center; }
.player-epg-info.visible { opacity: 1; transform: translateY(0); }
#epg-channel-logo { height: 50px; width: auto; max-width: 120px; object-fit: contain; margin-right: 20px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7)); }
.epg-text-content { display: flex; flex-direction: column; }
#epg-channel-name { margin: 0; font-size: 1.5em; font-weight: 700; text-shadow: 2px 2px 5px rgba(0,0,0,0.9); }
#epg-program-title { margin: 2px 0 0; font-size: 1em; color: #ddd; text-shadow: 1px 1px 3px rgba(0,0,0,0.9); display: flex; align-items: center; }
#epg-program-title i { margin-right: 8px; font-size: 0.9em; color: var(--primary-brand); }

google-cast-launcher {
    --cast-button-color: #ffffff;
    width: 40px;
    height: 40px;
    margin: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 4px solid rgba(255, 255, 255, 0.3); border-top: 4px solid var(--blue-highlight); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; z-index: 2; }
@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }
.bottom-nav { display: flex; justify-content: space-around; align-items: center; height: 60px; background-color: var(--dark-header); border-top: 1px solid rgba(255, 255, 255, 0.1); position: fixed; bottom: 0; width: 100%; z-index: 99; }
.bottom-nav .nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #95a5a6; font-size: 0.7em; text-align: center; transition: color 0.3s; }
.bottom-nav .nav-item.active { color: var(--text-light); }
.bottom-nav .nav-item i { font-size: 1.4em; margin-bottom: 5px; }
.category-filter { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px 0; gap: 10px; margin-bottom: 20px; }
.category-filter::-webkit-scrollbar { display: none; }
.category-filter button { background-color: rgba(44, 44, 44, 0.8); color: var(--text-muted); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 30px; padding: 10px 20px; cursor: pointer; white-space: nowrap; transition: all 0.3s ease; font-weight: bold; font-size: 14px; }
.category-filter button:hover { background-color: var(--dark-card); color: var(--text-light); border-color: #8a79f8; }
.category-filter button.active { background-color: #8a79f8; color: white; border-color: #8a79f8; box-shadow: 0 0 20px rgba(138, 121, 248, 0.6); }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px; }
.tv-card { background: rgba(47, 50, 76, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 15px; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; position: relative; display: flex; justify-content: center; align-items: center; aspect-ratio: 16 / 9; transition: all 0.3s ease; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); overflow: hidden; outline: 3px solid transparent; }
.tv-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 15px; background: radial-gradient(80px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.15), transparent 40%); opacity: 0; transition: opacity 0.3s ease; }
.tv-card:hover::before { opacity: 1; }
.tv-card:hover { transform: scale(1.05); border-color: rgba(138, 121, 248, 0.5); box-shadow: 0 0 30px rgba(138, 121, 248, 0.4); }
.tv-card img { width: 75%; height: auto; max-height: 75%; object-fit: contain; filter: drop-shadow(0 0 10px rgba(0,0,0,0.8)); transition: transform 0.3s ease; }
.tv-card:hover img { transform: scale(1.1); }
.tv-card .channel-name { position: absolute; bottom: -50px; left: 0; width: 100%; text-align: center; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); padding: 8px 5px; font-weight: bold; font-size: 14px; transition: bottom 0.3s ease; }
.tv-card:hover .channel-name { bottom: 0; }
@media (max-width: 600px) { .tv-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; } }

/* --- MODAL DE SINOPSIS Y TEMPORADAS --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 2000; display: none; justify-content: center; align-items: center; animation: fadeIn 0.3s; }
.modal-content { position: relative; width: 100%; height: 100%; background-color: var(--dark-bg); overflow-y: auto; display: flex; flex-direction: column; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 50vh; background-size: cover; background-position: center; z-index: -1; }
.modal-backdrop::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to top, var(--dark-bg) 10%, rgba(0,0,0,0.5) 50%, transparent 100%); }
.modal-header { padding: 20px; }
.modal-close-btn { background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); color: white; border-radius: 50%; width: 40px; height: 40px; font-size: 1.2em; cursor: pointer; }
#modal-body { padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.modal-poster-container { width: 180px; flex-shrink: 0; }
.modal-poster-container img { width: 100%; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.modal-info { margin-top: 20px; }
.modal-info h2 { font-size: 2em; color: var(--text-light); margin: 0; }
.modal-info p { font-size: 1em; color: var(--text-muted); line-height: 1.6; max-width: 600px; margin: 10px auto; }
#modal-action-buttons { margin: 20px 0; width: 100%; max-width: 300px; }
.modal-play-btn { background-color: var(--primary-brand); color: white; font-weight: bold; padding: 15px; border-radius: 8px; border: none; cursor: pointer; transition: background-color 0.2s; font-size: 1.1em; width: 100%; }
.modal-play-btn:hover { background-color: #7a68e8; }
.modal-play-btn i { margin-right: 10px; }
.seasons-list { width: 100%; max-width: 600px; margin: 20px auto; text-align: left; }
.season-item h3 { background-color: var(--dark-card); padding: 15px; border-radius: 8px; cursor: pointer; margin: 10px 0 0; }
.episodes-list { padding: 0 15px 15px; background-color: var(--dark-card); border-radius: 0 0 8px 8px; display: none; }
.episode-item { padding: 10px 0; border-bottom: 1px solid #444; cursor: pointer; }
.episode-item:last-child { border-bottom: none; }
.episode-item:hover { color: var(--primary-brand); }
@media (min-width: 768px) { .modal-content { max-width: 800px; max-height: 90vh; border-radius: 15px; } #modal-body { flex-direction: row; text-align: left; align-items: flex-start; } .modal-info { margin-top: 0; margin-left: 30px; } .modal-info p, #modal-action-buttons { margin: 10px 0; } }

/* --- ESTILOS PARA LA NAVEGACIÓN DE TV BOX --- */
.movie-card:focus,
.tv-card:focus,
.category-filter button:focus,
.nav-item:focus,
.nav-link:focus,
.modal-play-btn:focus,
.episode-item:focus,
.season-item:focus,
.hero-section button:focus,
.hamburger-icon:focus,
#searchInput:focus {
    outline: 3px solid var(--primary-brand);
    outline-offset: 3px;
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-brand);
}

:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
    transform: none;
}
:focus-visible {
    outline: 3px solid var(--primary-brand);
    outline-offset: 3px;
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-brand);
}
