/* ============================================================
   Meu IPTV — visual do app web (azul) adaptado para TV
   (escala aumentada; painel EPG ampliado; lista de canais enxuta)
   ============================================================ */
:root {
  --accent: #0a84ff;
  --accent-hover: #3395ff;
  --accent-soft: rgba(10, 132, 255, 0.15);
  --accent-glow: rgba(10, 132, 255, 0.4);
  --danger: #ff453a;
  --success: #30d158;
  --star: #ffd60a;

  --bg: #000000;
  --bg-2: #0c0c0e;
  --bg-3: #121214;
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --text: #f5f5f7;
  --text-2: #98989d;
  --text-3: #6c6c70;

  --radius: 14px;
  --radius-lg: 22px;

  --focus-ring: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent), 0 0 26px 5px var(--accent-glow);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 24px;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(10, 132, 255, 0.08), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(48, 209, 88, 0.05), transparent 45%),
    radial-gradient(circle at 50% 50%, #121214, #000000);
}

img { display: block; }
button {
  font-family: inherit; font-size: inherit; color: inherit;
  background: none; border: none; cursor: pointer;
}
.hidden { display: none !important; }

/* Foco estilo TV — glow azul */
:focus { outline: none; }
button:focus-visible, input:focus-visible, li[tabindex]:focus-visible, [tabindex]:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: var(--radius);
  z-index: 5;
  position: relative;
}

/* ============ TELAS ============ */
.screen {
  display: none;
  position: fixed; inset: 0;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ============ BOTÕES / INPUTS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 18px 34px;
  border-radius: var(--radius);
  font-size: 22px; font-weight: 600;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn svg { width: 28px; height: 28px; fill: currentColor; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 28px -8px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn-ghost {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-glass-strong); }
.btn-danger {
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.4);
  color: var(--danger);
}
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  border-radius: var(--radius);
  background: var(--bg-glass);
  border: 1px solid var(--border);
}
.icon-btn svg { width: 30px; height: 30px; fill: var(--text); }
.icon-btn:hover { background: var(--bg-glass-strong); }

.input {
  width: 100%;
  padding: 20px 22px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 22px;
  caret-color: var(--accent);
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); background: var(--bg-glass-strong); }

/* Campo com prefixo fixo (http://) */
.input-prefix {
  display: flex; align-items: center;
  padding: 0;
  cursor: text;
}
.input-prefix .prefix {
  flex-shrink: 0;
  padding: 20px 4px 20px 22px;
  color: var(--text-3);
  font-size: 22px;
  user-select: none;
}
.input-prefix input {
  flex: 1; min-width: 0;
  background: transparent; border: none;
  padding: 20px 22px 20px 0;
  color: var(--text);
  font-size: 22px;
  caret-color: var(--accent);
}
.input-prefix input::placeholder { color: var(--text-3); }
.input-prefix input:focus { outline: none; box-shadow: none; border: none; background: transparent; }
.input-prefix:focus-within { border-color: var(--accent); background: var(--bg-glass-strong); }

.field { margin-bottom: 22px; }
.field label {
  display: block;
  font-size: 16px; font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 10px;
}

/* ============ SPINNER / LOADER ============ */
.spinner {
  width: 76px; height: 76px;
  border: 5px solid var(--bg-glass-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.loader p { color: var(--text-2); font-size: 26px; }

/* ============ LOGIN ============ */
#screen-login {
  align-items: center; justify-content: center;
  background: #050505;
}
.login-decor {
  position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: .28; pointer-events: none;
}
.decor-1 { width: 520px; height: 520px; background: var(--accent); top: -140px; left: -140px; animation: flutuar 11s ease-in-out infinite; }
.decor-2 { width: 420px; height: 420px; background: var(--danger); bottom: -120px; right: -100px; animation: flutuar 13s ease-in-out infinite reverse; }
.decor-3 { width: 300px; height: 300px; background: var(--success); bottom: 12%; left: 8%; animation: flutuar 9s ease-in-out infinite; }
@keyframes flutuar { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,-30px) scale(1.12); } }

.login-box {
  position: relative; z-index: 2;
  width: min(580px, 92vw);
  padding: 52px 48px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  box-shadow: 0 30px 90px -20px rgba(0,0,0,.9);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-logo img { width: 52px; height: 52px; }
.login-logo span { font-size: 32px; font-weight: 800; letter-spacing: -.5px; }
.login-logo em { font-style: normal; color: var(--accent); }
.login-box h1 { font-size: 40px; letter-spacing: -.5px; }
.login-sub { color: var(--text-2); margin: 8px 0 32px; font-size: 20px; }
.login-erro { color: var(--danger); font-size: 18px; min-height: 26px; margin-bottom: 12px; }

/* ============ TOPBAR ============ */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 26px 40px;
  background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 800; }
.brand img { width: 40px; height: 40px; }
.brand em { font-style: normal; color: var(--accent); }
.topbar-title { font-size: 30px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.relogio { font-size: 26px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ============ HOME ============ */
.home-main { flex: 1; padding: 36px 60px; overflow-y: auto; }
.home-ola { font-size: 46px; font-weight: 800; letter-spacing: -1px; margin-bottom: 40px; }

.menu-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 52px;
}
.menu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 56px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  font-size: 28px; font-weight: 700;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.menu-tile svg { width: 64px; height: 64px; fill: var(--accent); }
.menu-tile:hover { transform: translateY(-4px) scale(1.02); background: var(--bg-glass-strong); }
.tile-live:hover { box-shadow: 0 18px 44px -14px rgba(255,69,58,.45); }
.tile-live:hover svg { fill: var(--danger); }
.tile-vod:hover { box-shadow: 0 18px 44px -14px var(--accent-glow); }
.tile-series:hover { box-shadow: 0 18px 44px -14px rgba(48,209,88,.45); }
.tile-series:hover svg { fill: var(--success); }

.home-continue h3 { font-size: 28px; margin-bottom: 20px; }
.continue-row { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 12px; }
.cont-card {
  flex: 0 0 280px;
  text-align: left;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: transform .15s ease;
}
.cont-card:hover { transform: translateY(-3px); }
.cont-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; background: var(--bg-3); }
.cont-nome { font-size: 18px; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont-barra { height: 5px; background: var(--bg-glass-strong); border-radius: 5px; margin-top: 10px; overflow: hidden; }
.cont-barra i { display: block; height: 100%; background: var(--accent); }

/* ============ BROWSE ============ */
.search-bar {
  display: flex; align-items: center; gap: 16px;
  margin: 0 40px 18px;
  padding: 12px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.search-icone { width: 30px; height: 30px; fill: var(--text-2); flex-shrink: 0; }
.search-bar .input { flex: 1; background: transparent; border: none; padding: 12px 0; font-size: 28px; }
.search-bar .input:focus { box-shadow: none; border: none; background: transparent; }

.browse-main {
  flex: 1;
  display: flex;
  gap: 22px;
  padding: 0 40px 30px;
  min-height: 0;
}

/* Categorias: mais estreita */
.sidebar {
  flex: 0 0 330px;
  overflow-y: auto;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.cat-list { list-style: none; }
.cat-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 22px; font-weight: 500;
  cursor: pointer;
  margin-bottom: 6px;
}
.cat-list li:hover { background: var(--bg-glass-strong); color: var(--text); }
.cat-list li.active { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.cat-badge {
  font-size: 16px; font-weight: 700;
  background: var(--bg-glass-strong);
  padding: 4px 12px; border-radius: 22px;
  color: var(--text-2);
}

/* Lista de canais (meio): ocupa o restante */
.content-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.browse-toolbar { display: flex; align-items: center; margin-bottom: 16px; }
.browse-info { color: var(--text-2); font-size: 19px; }

.items-container {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  align-content: start;
  padding: 8px;
}
.items-container.lista-canais {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grid-vazio {
  grid-column: 1 / -1;
  text-align: center; color: var(--text-3);
  padding: 70px 0; font-size: 24px;
}

/* ---- card de filme/série ---- */
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
  height: 360px;
  padding: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 16px 40px -12px rgba(0,0,0,.8); z-index: 2; }
.card img { width: 100%; height: 100%; object-fit: cover; }
.card-nome {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 30px 14px 12px;
  font-size: 17px; font-weight: 600; text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,.92), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-fav {
  position: absolute; top: 10px; right: 10px;
  width: 38px; height: 38px;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.6);
  border-radius: 50%;
}
.card:hover .card-fav, .card:focus-visible .card-fav { display: flex; }
.card-fav svg { width: 22px; height: 22px; fill: var(--text-2); }
.card-fav.is-fav svg { fill: var(--star); }
.card-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 5px; background: rgba(255,255,255,.2);
}
.card-progress i { display: block; height: 100%; background: var(--accent); }
.card-ano {
  position: absolute; top: 10px; left: 10px;
  font-size: 14px; font-weight: 700;
  background: rgba(0,0,0,.65);
  padding: 4px 10px; border-radius: 8px;
  color: var(--text-2);
}

/* ---- linha de canal (só nome, sem programação) ---- */
.canal-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg-glass);
  border: 1px solid transparent;
  text-align: left;
  transition: background .12s ease, border .12s ease;
}
.canal-row:hover, .canal-row.selected { background: var(--bg-glass-strong); border-color: var(--border); }
.canal-row img {
  width: 52px; height: 52px; object-fit: contain;
  background: var(--bg-3); border-radius: 10px; padding: 5px;
  flex-shrink: 0;
}
.canal-nome {
  font-size: 21px; font-weight: 600;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- painel EPG + MINI PLAYER (amplo) ---- */
.epg-panel {
  flex: 0 0 580px;
  overflow-y: auto;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.epg-panel h3 { font-size: 26px; margin-bottom: 16px; }
.epg-prog { padding: 13px 0; border-bottom: 1px solid var(--border); }
.epg-prog .epg-hora { color: var(--text-2); font-size: 17px; margin-bottom: 4px; }
.epg-prog.agora .epg-hora { color: var(--accent); font-weight: 700; }
.epg-prog div:last-child { font-size: 20px; }

.live-mini-wrap {
  position: relative;
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 2px solid var(--border);
  margin-bottom: 20px;
  cursor: pointer;
}
.live-mini-wrap:hover { border-color: var(--accent); }
.live-mini-wrap:focus-visible { border-color: var(--accent); }
#live-mini { width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-mini-label {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,.65);
  color: var(--danger);
  font-size: 13px; font-weight: 800; letter-spacing: 1px;
  padding: 5px 12px; border-radius: 8px;
}

/* ============ DETALHES ============ */
#screen-detail { background: var(--bg-2); }
.detail-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 20%;
  filter: blur(40px) brightness(.5) saturate(1.15);
  transform: scale(1.2);
  opacity: .6;
}
.detail-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-2) 10%, transparent 75%);
}
.detail-content {
  position: relative; z-index: 2;
  flex: 1; overflow-y: auto;
  padding: 30px 52px;
}
.detail-voltar { margin-bottom: 26px; }
.detail-grid { display: flex; gap: 48px; align-items: flex-start; }
.detail-poster {
  flex: 0 0 340px;
  width: 340px;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.9);
  background: var(--bg-3);
}
.detail-info { flex: 1; min-width: 0; padding-top: 10px; }
.detail-info h2 { font-size: 48px; font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; }
.detail-meta { color: var(--accent); font-size: 22px; font-weight: 600; margin-bottom: 20px; }
.detail-desc { color: var(--text); font-size: 22px; line-height: 1.55; max-width: 900px; margin-bottom: 30px; }
.detail-actions { display: flex; gap: 16px; margin-bottom: 34px; }

.seasons-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.season-btn {
  padding: 14px 26px;
  border-radius: 28px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  font-size: 20px; font-weight: 600;
}
.season-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.episodes-list { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.ep-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(18, 18, 20, 0.72);
  border: 1px solid transparent;
  text-align: left;
}
.ep-row:hover { border-color: var(--border-strong); }
.ep-row.assistido { opacity: .55; }
.ep-row img { width: 120px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--bg-3); }
.ep-info { flex: 1; min-width: 0; }
.ep-titulo { font-size: 20px; font-weight: 600; }
.ep-sub { color: var(--text-2); font-size: 16px; margin-top: 4px; }
.ep-check {
  flex-shrink: 0;
  color: var(--success);
  font-size: 15px; font-weight: 800;
  background: rgba(48, 209, 88, 0.12);
  border: 1px solid rgba(48, 209, 88, 0.35);
  padding: 5px 12px;
  border-radius: 16px;
  margin-right: 8px;
}

/* ============ PLAYER ============ */
#screen-player { background: #000; }
#video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 20px;
  padding: 30px 44px 26px;
  background: linear-gradient(to top, rgba(0,0,0,.92) 40%, transparent);
  z-index: 5;
}
.pc-btn {
  flex-shrink: 0;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, transform .12s ease;
}
.pc-btn:hover { background: var(--accent); transform: scale(1.06); }
.pc-btn svg { width: 32px; height: 32px; fill: #fff; }
.pc-progresso-wrap { flex: 1; min-width: 0; }
.pc-barra {
  height: 6px;
  background: rgba(255,255,255,.22);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.pc-barra i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.pc-time { color: var(--text-2); font-size: 18px; font-variant-numeric: tabular-nums; }

.player-carregando {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
  pointer-events: none;
}
.player-erro {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background: rgba(0,0,0,.88);
}
.player-erro p { font-size: 28px; }
.player-erro-acoes { display: flex; gap: 16px; }

/* Card "Próximo Episódio" — canto inferior direito */
.proximo-ep-card {
  position: absolute; right: 36px; bottom: 36px;
  display: flex; align-items: center; gap: 14px;
  width: 400px;
  padding: 12px;
  background: rgba(18, 18, 20, 0.94);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  text-align: left;
  z-index: 6;
}
.proximo-ep-card:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.proximo-ep-card img {
  width: 136px; height: 76px; object-fit: cover;
  border-radius: 10px; background: var(--bg-3);
  flex-shrink: 0;
}
.pec-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pec-label { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--accent); }
.pec-label b { font-size: 17px; }
.pec-nome {
  font-size: 16px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-toast {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  padding: 14px 30px;
  background: rgba(0,0,0,.8);
  border: 1px solid var(--border-strong);
  border-radius: 34px;
  font-size: 20px;
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.player-toast.visivel { opacity: 1; }

/* ============ CONFIGURAÇÕES ============ */
#screen-settings {
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  z-index: 50;
}
.settings-box {
  width: min(620px, 92vw);
  padding: 46px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.settings-box h2 { font-size: 36px; margin-bottom: 12px; }
.settings-user { color: var(--text-2); font-size: 19px; margin-bottom: 32px; }
.settings-acoes { display: flex; flex-direction: column; gap: 14px; }
.settings-status { margin-top: 22px; color: var(--accent); font-size: 18px; min-height: 26px; }

/* ============ SCROLLBARS ============ */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-glass-strong); border-radius: 12px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============ TELAS MENORES ============ */
@media (max-width: 1600px) {
  html, body { font-size: 22px; }
  .menu-tiles { gap: 22px; }
  .menu-tile { padding: 44px 20px; font-size: 25px; }
  .menu-tile svg { width: 56px; height: 56px; }
  .sidebar { flex-basis: 300px; }
  .cat-list li { padding: 15px 18px; font-size: 20px; }
  .epg-panel { flex-basis: 470px; padding: 18px; }
  .live-mini-wrap { height: 240px; }
  .items-container { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
  .card { height: 310px; }
  .detail-grid { gap: 36px; }
  .detail-poster { flex-basis: 290px; width: 290px; }
  .detail-info h2 { font-size: 40px; }
  .detail-desc { font-size: 20px; }
  .canal-nome { font-size: 19px; }
  .home-ola { font-size: 40px; }
  .cont-card { flex-basis: 250px; }
  .cont-card img { height: 135px; }
  .epg-panel h3 { font-size: 22px; }
  .epg-prog div:last-child { font-size: 18px; }
  .proximo-ep-card { width: 340px; }
}