:root {
    --bg-dark: #0a0a0c;
    --bg-sidebar: #121216;
    --accent: #e50914; 
    --text-main: #ffffff;
    --text-muted: #8a8a93;
    --success: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; }

/* TELAS DE BLOQUEIO */
.overlay-screen { display: none; justify-content: center; align-items: center; flex-direction: column; width: 100%; height: 100vh; background: radial-gradient(circle at center, #1a1a24 0%, var(--bg-dark) 100%); z-index: 200; position: fixed; inset: 0; }
.login-box { background: rgba(20, 20, 25, 0.95); padding: 40px; border-radius: 12px; border: 1px solid #333; width: 90%; max-width: 350px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.login-box .logo { padding:0; margin-bottom: 5px; font-size: 32px; text-align: center; color: var(--accent); font-weight: 900;}
.login-box p { color: var(--text-muted); margin-bottom: 25px; text-align: center; font-size: 14px; }
.login-box input { background: #222; border: 1px solid #444; padding: 12px; color: white; border-radius: 6px; margin-bottom: 15px; outline: none; font-size: 16px; text-align: center; letter-spacing: 2px;}
.login-box button { background: var(--accent); color: white; border: none; padding: 12px; border-radius: 6px; font-size: 16px; font-weight: bold; cursor: pointer; }
#msgErro { color: var(--accent); margin-top: 15px; font-size: 13px; text-align: center; display: none; }

/* PERFIS */
.profiles-title { font-size: 35px; font-weight: bold; margin-bottom: 40px; text-shadow: 2px 2px 4px #000; }
.profiles-container { display: flex; gap: 30px; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: 0.3s; outline: none; }
.profile-card:hover, .profile-card:focus { transform: scale(1.1); }
.profile-card:hover .profile-avatar, .profile-card:focus .profile-avatar { border-color: white; }
.profile-avatar { width: 120px; height: 120px; border-radius: 12px; border: 3px solid transparent; display: flex; justify-content: center; align-items: center; font-size: 40px; font-weight: bold; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: 0.3s; }
.avatar-1 { background: linear-gradient(135deg, var(--accent), #ff7b00); }
.avatar-2 { background: linear-gradient(135deg, #00b4db, #0083b0); }
.profile-name { font-size: 18px; color: #aaa; font-weight: 600; transition: 0.3s;}
.profile-card:hover .profile-name, .profile-card:focus .profile-name { color: white; }
.btn-logout { margin-top: 40px; color: var(--text-muted); font-size: 12px; cursor: pointer; }

/* ESTRUTURA PRINCIPAL */
#app-container { display: none; width: 100%; height: 100vh; flex-direction: row; }
aside { width: 250px; background-color: var(--bg-sidebar); border-right: 1px solid #222; display: flex; flex-direction: column; padding: 20px 0; z-index: 20; }
aside .logo { color: var(--accent); font-size: 24px; font-weight: 900; padding: 0 20px 30px; letter-spacing: 1px; text-align: center;}
.menu-item { padding: 15px 20px; color: var(--text-muted); cursor: pointer; font-weight: 600; font-size: 14px; transition: 0.2s; display: flex; align-items: center; gap: 10px; outline: none; }
.menu-item:hover, .menu-item.active, .menu-item:focus { color: var(--text-main); background-color: rgba(255,255,255,0.05); border-left: 4px solid var(--accent); }
.spacer { flex-grow: 1; }

main { flex: 1; overflow-y: auto; position: relative; background-color: var(--bg-dark); }
.top-bar { padding: 20px 30px; display: flex; flex-direction: column; gap: 15px; background: rgba(10,10,12,0.9); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); }
.top-bar-main { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 15px;}

/* BUSCA E GÊNEROS */
.search-box { display: flex; background: #222; border-radius: 6px; overflow: hidden; border: 1px solid #444; width: 100%; max-width: 400px; }
.search-box input { flex: 1; background: transparent; border: none; padding: 10px 15px; color: white; outline: none; }
.search-box button { background: var(--accent); color: white; border: none; padding: 0 20px; cursor: pointer; font-weight: bold; transition: 0.2s; outline: none;}
.genres-bar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.genres-bar::-webkit-scrollbar { display: none; }
.genre-btn { background: #1a1a24; color: #aaa; border: 1px solid #333; padding: 6px 15px; border-radius: 20px; font-size: 12px; cursor: pointer; white-space: nowrap; transition: 0.2s; outline: none;}
.genre-btn:hover, .genre-btn.active, .genre-btn:focus { background: var(--accent); color: white; border-color: var(--accent); }

/* PERFIL TOPO */
.user-profile { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 5px 15px 5px 5px; border-radius: 50px; border: 1px solid rgba(255, 255, 255, 0.2); white-space: nowrap; cursor: pointer; transition: 0.2s;}
.user-profile:hover { border-color: white; background: rgba(255,255,255,0.1);}
.user-avatar { width: 35px; height: 35px; background: #333; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 16px; }
.cloud-badge { font-size: 10px; background: #22c55e; padding: 2px 6px; border-radius: 10px; margin-left: 5px;}

/* GRADES DE FILMES */
.view-section { padding: 0 30px 30px; display: block; }
.row-title { font-size: 20px; margin: 20px 0 15px; font-weight: 700; color: #fff; border-left: 4px solid var(--accent); padding-left: 10px;}
.row-container { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 15px; scroll-behavior: smooth; }
.row-container::-webkit-scrollbar { height: 8px; }
.row-container::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.movie-card { border-radius: 8px; cursor: pointer; transition: 0.3s; aspect-ratio: 2/3; position: relative; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.5); background: #222; outline: none; }
.movie-card:hover, .movie-card:focus { transform: scale(1.05) translateY(-5px); box-shadow: 0 10px 20px rgba(229, 9, 20, 0.5); z-index: 2; border: 2px solid var(--accent); }
.row-container .movie-card { width: 160px; flex: 0 0 auto; }
.movie-grid .movie-card { width: 100%; }
.movie-poster { width: 100%; height: 100%; object-fit: cover; }
.movie-card-title { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, #000, transparent); padding: 20px 10px 10px; font-size: 11px; font-weight: bold; text-align: center; }
.historico-badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: white; padding: 2px 6px; font-size: 10px; font-weight: bold; border-radius: 4px; z-index: 5; }
#loading-spinner { text-align: center; padding: 20px; color: var(--accent); font-weight: bold; display: none; }

/* DETALHES GERAL */
#view-details { display: none; min-height: 100%; flex-direction: column; padding-bottom: 50px; }
.banner { height: 50vh; min-height: 300px; background-size: cover; background-position: center top; position: relative; }
.banner-overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-dark) 0%, rgba(10,10,12,0.4) 100%); }
.btn-voltar { position: absolute; top: 20px; left: 20px; background: rgba(0,0,0,0.6); color: white; border: 1px solid #444; padding: 8px 15px; border-radius: 4px; cursor: pointer; z-index: 10; font-weight: bold; backdrop-filter: blur(5px); outline: none;}
.btn-voltar:focus { border-color: var(--accent); }
.details-content { padding: 0 40px; position: relative; z-index: 2; margin-top: -80px; display: flex; gap: 40px; }
.details-main { flex: 1; }
.details-sidebar { width: 300px; }
.details-title { font-size: 40px; font-weight: 900; margin-bottom: 10px; text-shadow: 2px 2px 4px #000; }
.details-meta { font-size: 14px; color: #ddd; font-weight: bold; margin-bottom: 20px; display: flex; gap: 15px; align-items: center; flex-wrap: wrap;}
.rating-badge { background: #f5c518; color: #000; padding: 3px 8px; border-radius: 4px; font-weight: 900; }
.providers-list { display: flex; gap: 8px; margin-left: 10px; }
.provider-logo { width: 24px; height: 24px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.details-desc { color: #ccc; line-height: 1.6; margin-bottom: 30px; font-size: 15px; text-shadow: 1px 1px 2px #000; max-width: 900px; }

/* BOTOES AÇÃO */
.action-buttons { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.btn-play { background-color: var(--accent); color: white; border: none; padding: 12px 24px; font-size: 15px; font-weight: bold; border-radius: 6px; cursor: pointer; transition: 0.2s; outline: none; }
.btn-play:focus, .btn-list:focus, .btn-trailer:focus { outline: 2px solid white; }
.btn-list, .btn-trailer { background-color: rgba(255,255,255,0.1); color: white; border: 1px solid #555; padding: 12px 20px; font-size: 14px; font-weight: bold; border-radius: 6px; cursor: pointer; backdrop-filter: blur(5px); outline: none;}
.btn-list.in-list { border-color: var(--accent); color: var(--accent); }

/* ELENCO LATERAL */
.cast-section { margin-top: 20px; }
.cast-list { display: flex; flex-direction: column; gap: 10px; }
.cast-item { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px; border-radius: 8px; transition: 0.2s; border: 1px solid transparent;}
.cast-item:hover { background: rgba(255,255,255,0.05); border-color: #444; }
.cast-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #333; }
.cast-name { font-size: 13px; font-weight: bold; color: #ddd;}
.cast-role { font-size: 12px; color: var(--text-muted); }

/* EPISÓDIOS E PROGRESSO */
.episodes-section { margin-top: 30px; }
.season-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap;}
.season-selector { background: #222; color: #fff; border: 1px solid #444; padding: 10px 15px; border-radius: 6px; outline: none; font-weight: bold; cursor: pointer; min-width: 150px;}
.progress-container { flex: 1; min-width: 200px; max-width: 400px; }
.progress-text { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: bold; display: flex; justify-content: space-between;}
.progress-bar-bg { width: 100%; height: 6px; background: #333; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.4s ease; }
.episode-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; padding-right: 10px;}
.episode-item { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.05); padding: 12px 20px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; outline: none; transition: 0.2s;}
.episode-item:hover, .episode-item:focus { background: rgba(255,255,255,0.1); border-color: #333; }
.episode-item.highlight { border-color: var(--accent); background: rgba(229, 9, 20, 0.1); }
.episode-item.highlight .ep-play { color: var(--accent); font-weight: bold;}
.episode-item.watched { opacity: 0.6; }
.episode-item.watched .ep-title { text-decoration: line-through; color: #888; }
.check-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #555; display: flex; justify-content: center; align-items: center; margin-right: 15px; transition: 0.2s; flex-shrink: 0;}
.episode-item.watched .check-btn { background: var(--success); border-color: var(--success); color: #fff; }
.check-btn::after { content: '?'; font-size: 14px; font-weight: bold; opacity: 0; }
.episode-item.watched .check-btn::after { opacity: 1; }
.ep-info { display: flex; align-items: center; flex: 1; }
.ep-number { font-weight: bold; color: var(--text-muted); margin-right: 15px; width: 25px; display: inline-block; }
.ep-title { font-weight: 600; flex: 1; transition: 0.2s;}
.ep-play { font-size: 13px; background: #333; padding: 4px 10px; border-radius: 4px;}

/* PLAYER E MINI-PLAYER (PIP) */
#view-player { display: none; height: 100vh; background: #000; flex-direction: column; position: absolute; top: 0; left: 0; right: 0; z-index: 150; transition: all 0.3s ease; }
.player-header { padding: 15px 20px; background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent); position: absolute; width: 100%; z-index: 10; display: flex; align-items: center; justify-content: space-between; transition: 0.3s;}
.player-header-left { display: flex; align-items: center; gap: 15px; }
.player-servers { display: flex; gap: 10px; }
.btn-server { background: #222; color: #fff; border: 1px solid #444; padding: 5px 15px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: bold; outline: none;}
.btn-server:focus { border-color: white; }
.btn-server.active { background: var(--accent); border-color: var(--accent); }
.player-wrapper { flex: 1; display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }
iframe { width: 100%; height: 100%; border: none; }

#view-player.mini-player {
    position: fixed; top: auto; left: auto; bottom: 20px; right: 20px; 
    width: 400px; height: 225px; border-radius: 12px; overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.9); z-index: 999; border: 2px solid #444;
}
#view-player.mini-player .player-header { opacity: 0; }
#view-player.mini-player:hover .player-header { opacity: 1; }
#view-player.mini-player .player-header .btn-voltar { display: none; }

/* MODAL TRAILER */
#modal-trailer { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 300; justify-content: center; align-items: center; padding: 20px; }
.modal-content { width: 100%; max-width: 900px; aspect-ratio: 16/9; position: relative; background: #000; border: 2px solid #333; }
.modal-content iframe { width: 100%; height: 100%; }
.close-modal { position: absolute; top: -40px; right: 0; color: white; font-size: 30px; cursor: pointer; }

/* ======== IPTV E PASTAS ======== */
.main-category-card { background: linear-gradient(135deg, #1a1a24, #2a2a35); padding: 40px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; transition: 0.3s; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; outline: none; }
.main-category-card:hover, .main-category-card:focus { transform: translateY(-10px); border-color: var(--accent); box-shadow: 0 10px 25px rgba(229, 9, 20, 0.4); }
.main-category-icon { font-size: 60px; margin-bottom: 15px; }
.main-category-title { font-size: 24px; font-weight: bold; color: white; }

.folder-card { background: #1a1a24; border-radius: 8px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; cursor: pointer; transition: 0.3s; border: 1px solid #333; outline: none; text-align: center; aspect-ratio: 1; }
.folder-card:hover, .folder-card:focus { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3); }
.folder-icon { font-size: 40px; }
.folder-count { font-size: 11px; color: var(--text-muted); background: rgba(255,255,255,0.1); padding: 3px 8px; border-radius: 10px; }

.channel-card { background: #1a1a24; border-radius: 8px; padding: 15px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: 0.3s; border: 1px solid #333; outline: none; text-align: center; }
.channel-card:hover, .channel-card:focus { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3); }
.channel-logo-wrapper { width: 80px; height: 80px; background: #fff; border-radius: 50%; display: flex; justify-content: center; align-items: center; padding: 5px; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); }
.channel-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.channel-name { font-size: 13px; font-weight: bold; color: #fff; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-voltar-iptv { display: inline-block; margin-bottom: 20px; background: #333; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-voltar-iptv:hover { background: var(--accent); }

/* RESPONSIVIDADE MOBILE */
@media (max-width: 768px) {
    #app-container { flex-direction: column; }
    aside { width: 100%; height: 60px; flex-direction: row; border-right: none; border-top: 1px solid #222; padding: 0; justify-content: space-around; order: 3; position: sticky; bottom: 0;}
    aside .logo, .spacer { display: none; } 
    .menu-item { flex: 1; justify-content: center; font-size: 12px; border-left: none; border-bottom: 3px solid transparent; }
    .menu-item:hover, .menu-item.active { border-left: none; border-bottom: 3px solid var(--accent); }
    main { order: 1; padding-bottom: 10px; }
    .details-content { flex-direction: column; padding: 0 20px; margin-top: -40px; gap: 20px;}
    .details-sidebar { width: 100%; }
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .row-container .movie-card { width: 120px; }
    .details-title { font-size: 28px; }
    .top-bar-main { flex-direction: column; align-items: stretch; }
    .user-profile { justify-content: center; }
    .season-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .progress-container { max-width: 100%; }
    #view-player.mini-player { width: 90%; right: 5%; bottom: 80px; height: 200px; }
}