/* ===========================================
   MINISTRA TV - CSS SIMPLES PARA TVs ANTIGAS
   Compatível com Chrome 38+ / webOS 3.0
   SEM TAILWIND - PURO CSS
   CORREÇÃO: gap -> margin para WebKit antigo
   =========================================== */

/* RESET AGRESSIVO PARA TVs */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-transition: none;
  transition: none;
  -webkit-animation: none;
  animation: none;
  -webkit-transform: none;
  transform: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  -webkit-filter: none;
  filter: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  text-shadow: none;
}

html, body {
  width: 100%;
  height: 100%;
  background: #141414;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
  /* Forçar GPU em TVs */
  -webkit-transform: translateZ(0);
}

/* 4K: aumentar fonte base */
@media screen and (min-width: 2560px), screen and (min-height: 1440px) {
  html, body {
    font-size: 24px;
  }
}

/* 4K via classe JS */
body.is-4k {
  font-size: 24px !important;
}

#root, #app {
  width: 100%;
  min-height: 100%;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
  background: #E50914;
  border-radius: 4px;
}

/* ===========================================
   LAYOUT BÁSICO
   =========================================== */

.page {
  width: 100%;
  min-height: 100vh;
  background: #141414;
}

.page-dark {
  background: #0d0d0d;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

/* gap não funciona em WebKit antigo - usar margin nos filhos */
.gap-2 > * { margin-right: 8px; margin-bottom: 8px; }
.gap-2 > *:last-child { margin-right: 0; }
.gap-3 > * { margin-right: 12px; margin-bottom: 12px; }
.gap-3 > *:last-child { margin-right: 0; }
.gap-4 > * { margin-right: 16px; margin-bottom: 16px; }
.gap-4 > *:last-child { margin-right: 0; }

.hidden { display: none; }
.block { display: block; }

/* ESPAÇAMENTOS */
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }

.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

.m-0 { margin: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.ml-auto { margin-left: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* TAMANHOS */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.h-screen { height: 100vh; }

/* TEXTO */
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.text-6xl { font-size: 60px; }

.font-bold { font-weight: bold; }
.font-medium { font-weight: 500; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }

.text-white { color: #fff; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: #E50914; }
.text-green-400 { color: #4ade80; }
.text-yellow-500 { color: #eab308; }

/* BACKGROUNDS */
.bg-black { background: #000; }
.bg-dark { background: #141414; }
.bg-dark-100 { background: #1a1a1a; }
.bg-dark-200 { background: #141414; }
.bg-dark-300 { background: #0d0d0d; }
.bg-gray-800 { background: #1f2937; }
.bg-gray-900 { background: #111827; }
.bg-red-600 { background: #E50914; }

/* BORDAS */
.border { border: 1px solid #333; }
.border-gray-700 { border-color: #374151; }
.border-gray-800 { border-color: #1f2937; }
.border-red-700 { border-color: #b91c1c; }
.rounded { border-radius: 4px; }
.rounded-lg { border-radius: 8px; }
.rounded-full { border-radius: 50%; }

/* POSICIONAMENTO */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }

/* OVERFLOW */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }

/* CURSOR */
.cursor-pointer { cursor: pointer; }

/* ===========================================
   COMPONENTES - LOGIN
   =========================================== */

.login-page {
  width: 100%;
  min-height: 100vh;
  background: #0d0d0d;
  display: flex;
  flex-direction: column;
}

.login-header {
  padding: 24px;
}

.login-header img {
  height: 48px;
  width: auto;
}

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 32px;
}

.login-title {
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 24px;
}

.login-input {
  width: 100%;
  margin-bottom: 16px;
  background: #333;
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 16px;
  cursor: pointer;
}

.login-input.focused {
  border-color: #E50914;
  background: #444;
}

.login-input-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.login-input-field {
  font-size: 16px;
  color: #fff;
  min-height: 24px;
}

.login-input-field .placeholder {
  color: #666;
}

.login-btn {
  width: 100%;
  background: #E50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 16px;
}

.login-btn.focused {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.login-btn:disabled {
  opacity: 0.7;
}

.login-error {
  background: rgba(185, 28, 28, 0.3);
  border: 1px solid #b91c1c;
  border-radius: 4px;
  padding: 12px;
  color: #f87171;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===========================================
   COMPONENTES - NAVBAR
   =========================================== */

.navbar {
  height: 60px;
  background: #0d0d0d;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 0 1.25vw; /* 24px em 1920 = 1.25vw */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.navbar-logo {
  height: 40px;
  width: auto;
}

.navbar-items {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-left: 2.5vw; /* 48px em 1920 = 2.5vw */
}
.navbar-items > * {
  margin-right: 1.25vw; /* 24px em 1920 = 1.25vw */
}
.navbar-items > *:last-child {
  margin-right: 0;
}

.navbar-item {
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 4px;
}

.navbar-item:hover,
.navbar-item.active {
  color: #fff;
}

.navbar-item.focused {
  background: #E50914;
  color: #fff;
}

.navbar-user {
  margin-left: auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}
.navbar-user > * {
  margin-right: 0.83vw; /* 16px em 1920 = 0.83vw */
}
.navbar-user > *:last-child {
  margin-right: 0;
}

.navbar-time {
  text-align: right;
}

.navbar-time-hour {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
}

.navbar-time-date {
  font-size: 12px;
  color: #888;
}

.navbar-settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
}

.navbar-settings-btn:hover,
.navbar-settings-btn.focused {
  background: #E50914;
  transform: scale(1.1);
}

.navbar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #E50914;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

/* ===========================================
   COMPONENTES - HOME / HERO
   =========================================== */

.hero {
  width: 100%;
  height: 500px;
  background: #1a1a1a;
  background-size: cover;
  background-position: center;
  position: relative;
  margin-top: 60px;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
}

.hero-content {
  position: absolute;
  bottom: 80px;
  left: 48px;
  max-width: 500px;
}

.hero-badge {
  display: inline-block;
  background: #E50914;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.1;
}

.hero-description {
  font-size: 16px;
  color: #ccc;
  margin-bottom: 24px;
  line-height: 1.5;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #E50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.hero-btn.focused {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.hero-btn svg {
  width: 24px;
  height: 24px;
}

/* ===========================================
   COMPONENTES - CONTENT ROWS
   =========================================== */

.content {
  padding: 24px 48px;
  padding-bottom: 48px;
}

.row {
  margin-bottom: 32px;
}

.row-title {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16px;
}

.row-items {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.row-items::-webkit-scrollbar {
  height: 4px;
}

/* ===========================================
   COMPONENTES - CARDS
   =========================================== */

.card {
  flex-shrink: 0;
  width: 180px;
  background: #181818;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
}

.card.focused {
  border-color: #E50914;
}

.card-image {
  width: 100%;
  aspect-ratio: 2/3;
  background: #222;
  object-fit: cover;
}

.card-image-landscape {
  aspect-ratio: 16/9;
}

.card-title {
  padding: 8px;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-rating {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #eab308;
  color: #000;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 2px;
}

/* ===========================================
   COMPONENTES - TV AO VIVO
   =========================================== */

.tv-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
}

.tv-header {
  height: 56px;
  background: #000;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 0 0.83vw; /* 16px em 1920 */
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.tv-header > * {
  margin-right: 0.83vw; /* 16px em 1920 */
}
.tv-header > *:last-child {
  margin-right: 0;
}

.tv-header-btn {
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.tv-header-btn.focused {
  background: #E50914;
}

.tv-header-title {
  font-size: 20px;
  font-weight: bold;
  color: #E50914;
}

.tv-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.tv-status-dot.connected {
  background: #22c55e;
}

.tv-status-text {
  font-size: 14px;
  color: #888;
}

.tv-status-text.connected {
  color: #22c55e;
}

.tv-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar categorias */
.tv-sidebar {
  width: 200px;
  background: #111;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tv-sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}

.tv-sidebar-title {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  font-weight: bold;
}

.tv-sidebar-list {
  flex: 1;
  overflow-y: auto;
}

.tv-sidebar-item {
  padding: 10px 16px;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-sidebar-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.tv-sidebar-item.active,
.tv-sidebar-item.focused {
  background: #E50914;
  color: #fff;
}

/* Lista de canais */
.tv-channels {
  width: 280px;
  background: #0a0a0a;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tv-channels-header {
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}

.tv-channels-title {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  font-weight: bold;
}

.tv-channels-list {
  flex: 1;
  overflow-y: auto;
}

.tv-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.tv-channel:hover {
  background: rgba(255,255,255,0.05);
}

.tv-channel.active,
.tv-channel.focused {
  background: rgba(229, 9, 20, 0.3);
  border-left-color: #E50914;
}

.tv-channel-logo {
  width: 32px;
  height: 32px;
  background: #222;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.tv-channel-name {
  flex: 1;
  font-size: 14px;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-channel.active .tv-channel-name,
.tv-channel.focused .tv-channel-name {
  color: #fff;
}

/* Player area */
.tv-player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tv-player {
  flex: 0 0 auto;
  height: 200px;
  max-height: 200px;
  background: #000;
  position: relative;
}

.tv-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tv-epg {
  height: 120px;
  background: #111;
  border-top: 1px solid #333;
  padding: 16px;
  flex-shrink: 0;
}

.tv-epg-info {
  display: flex;
  gap: 16px;
  height: 100%;
}

.tv-epg-channel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-epg-channel-logo {
  width: 48px;
  height: 48px;
  background: #222;
  border-radius: 4px;
  object-fit: contain;
}

.tv-epg-channel-name {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
}

.tv-epg-channel-num {
  font-size: 12px;
  color: #666;
}

.tv-epg-divider {
  width: 1px;
  background: #333;
}

.tv-epg-programs {
  flex: 1;
  overflow: hidden;
}

.tv-epg-programs-title {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  font-weight: bold;
  margin-bottom: 8px;
}

.tv-epg-program {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: #888;
  margin-bottom: 4px;
}

.tv-epg-program.current {
  color: #E50914;
  font-weight: 500;
}

.tv-epg-program-time {
  color: #666;
  flex-shrink: 0;
}

.tv-epg-program-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Placeholder quando sem canal */
.tv-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
}

.tv-placeholder-icon {
  font-size: 60px;
  margin-bottom: 16px;
}

.tv-placeholder-text {
  font-size: 18px;
  color: #888;
}

.tv-placeholder-subtext {
  font-size: 14px;
  color: #555;
  margin-top: 8px;
}

/* ===========================================
   COMPONENTES - FILMES / SÉRIES LISTA
   =========================================== */

.list-page {
  min-height: 100vh;
  background: #141414;
  padding-top: 60px;
}

.list-header {
  padding: 24px 48px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.list-title {
  font-size: 32px;
  font-weight: bold;
  color: #fff;
}

.list-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.list-category {
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.list-category.active,
.list-category.focused {
  background: #E50914;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 0 48px 48px;
}

/* ===========================================
   COMPONENTES - DETALHE FILME/SÉRIE
   =========================================== */

.detail-page {
  min-height: 100vh;
  background: #0d0d0d;
  padding-top: 60px;
}

.detail-hero {
  height: 400px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.detail-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, #0d0d0d 0%, transparent 50%);
}

.detail-content {
  padding: 0 48px 48px;
  margin-top: -100px;
  position: relative;
  z-index: 10;
}

.detail-info {
  display: flex;
  gap: 32px;
}

.detail-poster {
  width: 200px;
  flex-shrink: 0;
}

.detail-poster img {
  width: 100%;
  border-radius: 8px;
}

.detail-meta {
  flex: 1;
}

.detail-title {
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16px;
}

.detail-badges {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-badge {
  font-size: 14px;
  color: #888;
}

.detail-badge-rating {
  background: #eab308;
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.detail-plot {
  font-size: 16px;
  color: #aaa;
  line-height: 1.6;
  margin-bottom: 24px;
}

.detail-actions {
  display: flex;
  gap: 12px;
}

.detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #E50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.detail-btn.focused {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.detail-btn.secondary {
  background: #333;
}

/* ===========================================
   COMPONENTES - TECLADO VIRTUAL
   =========================================== */

.keyboard-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.keyboard {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 24px;
  width: 600px;
  max-width: 90%;
}

.keyboard-title {
  font-size: 18px;
  color: #fff;
  margin-bottom: 16px;
}

.keyboard-input {
  width: 100%;
  background: #333;
  border: 2px solid #E50914;
  border-radius: 4px;
  padding: 16px;
  font-size: 18px;
  color: #fff;
  margin-bottom: 16px;
}

.keyboard-rows,
.keyboard-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyboard-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.keyboard-key {
  width: 44px;
  height: 44px;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-key.focused {
  background: #E50914;
  border-color: #E50914;
}

.keyboard-key.wide {
  width: 88px;
}

.keyboard-key.extra-wide {
  width: 200px;
}

.keyboard-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.keyboard-btn {
  padding: 12px 32px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  border: none;
}

.keyboard-btn-cancel {
  background: #333;
  color: #fff;
}

.keyboard-btn-submit {
  background: #E50914;
  color: #fff;
}

.keyboard-btn.focused {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* TECLADO VIRTUAL OVERLAY */
.virtual-keyboard-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.virtual-keyboard-container {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 24px;
  min-width: 600px;
  max-width: 90%;
}

.keyboard-title {
  font-size: 20px;
  color: #fff;
  text-align: center;
  margin-bottom: 16px;
  font-weight: bold;
}

.keyboard-input-container {
  margin-bottom: 20px;
}

.keyboard-input {
  width: 100%;
  background: #333;
  border: 2px solid #E50914;
  border-radius: 4px;
  padding: 16px;
  font-size: 20px;
  color: #fff;
  min-height: 56px;
  display: flex;
  align-items: center;
}

.keyboard-input .placeholder {
  color: #666;
}

.keyboard-input .cursor {
  animation: blink 1s infinite;
  color: #E50914;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.keyboard-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.keyboard-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.keyboard-key {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-key:hover {
  background: #444;
}

.keyboard-key.focused {
  background: #E50914;
  border-color: #E50914;
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.keyboard-key.special {
  min-width: 80px;
  background: #444;
  font-size: 14px;
}

.keyboard-key.special.focused {
  background: #E50914;
}

.keyboard-hints {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: #888;
  font-size: 12px;
  margin-top: 16px;
}

/* ===========================================
   COMPONENTES - PLAYER
   =========================================== */

.player-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

.player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.player-overlay.visible {
  pointer-events: auto;
}

.player-overlay-top {
  background: rgba(0,0,0,0.8);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-back-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-title {
  font-size: 18px;
  color: #fff;
  font-weight: bold;
}

.player-overlay-bottom {
  margin-top: auto;
  background: rgba(0,0,0,0.9);
  padding: 16px 24px;
}

.player-progress {
  height: 4px;
  background: #333;
  border-radius: 2px;
  margin-bottom: 12px;
  position: relative;
}

.player-progress-bar {
  height: 100%;
  background: #E50914;
  border-radius: 2px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-control-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
}

.player-control-btn.focused {
  color: #E50914;
}

.player-time {
  font-size: 14px;
  color: #fff;
}

.player-p2p-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #888;
}

.player-p2p-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===========================================
   COMPONENTES - SPINNER / LOADING
   =========================================== */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top-color: #E50914;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-page {
  min-height: 100vh;
  background: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-text {
  color: #888;
  font-size: 16px;
  margin-top: 16px;
}

/* ===========================================
   EPISÓDIOS (SÉRIES)
   =========================================== */

.episodes-section {
  margin-top: 32px;
}

.episodes-title {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16px;
}

.season-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.season-btn {
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.season-btn.active,
.season-btn.focused {
  background: #E50914;
}

.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-item {
  display: flex;
  gap: 16px;
  background: #1a1a1a;
  border-radius: 4px;
  padding: 12px;
  cursor: pointer;
  border: 2px solid transparent;
}

.episode-item.focused {
  border-color: #E50914;
}

.episode-thumb {
  width: 160px;
  height: 90px;
  background: #222;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: cover;
}

.episode-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.episode-num {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.episode-title {
  display: block;
  font-size: 16px;
  color: #fff;
  font-weight: bold;
  margin-bottom: 8px;
}

.episode-plot {
  font-size: 14px;
  color: #888;
  line-height: 1.4;
}

.episode-duration {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}

/* ===========================================
   MOVIES/SERIES GRID
   =========================================== */

.movies-grid-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #141414;
}

.movies-grid {
  display: grid !important;
  grid-template-columns: 160px 160px 160px 160px 160px 160px !important;
  gap: 12px !important;
  justify-content: center !important;
}

.movie-card {
  width: 160px !important;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
}

/* 4K: cards maiores */
@media screen and (min-width: 2560px), screen and (min-height: 1440px) {
  .movie-card {
    width: 220px !important;
    border-radius: 6px;
    border-width: 3px;
  }
}

/* 4K via classe JS */
body.is-4k .movie-card {
  width: 220px !important;
  border-radius: 6px;
  border-width: 3px;
}

.movie-card.focused {
  border-color: #E50914;
  background: #2a2a2a;
}

.movie-card-poster {
  position: relative;
  width: 100%;
  padding-top: 150%;
  background: #222;
}

.movie-card-poster img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.movie-card-rating {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #f5c518;
  color: #000;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 2px;
}

.movie-card-title {
  padding: 12px;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grid já é responsivo com auto-fill */

@media (max-width: 600px) {
  .movies-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===========================================
   DETAIL PAGES (Movie/Series)
   =========================================== */

.detail-page {
  min-height: 100vh;
  background: #141414;
  display: flex;
  flex-direction: column;
}

.detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: #888;
}

.detail-back-link {
  margin-top: 16px;
  color: #E50914;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.detail-content {
  flex: 1;
  position: relative;
  padding-bottom: 60px;
}

.detail-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background-size: cover;
  background-position: center;
  background-color: #1a1a1a;
}

.detail-backdrop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(20,20,20,0.3), rgba(20,20,20,1));
}

.detail-info {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  padding: 200px 24px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.detail-poster {
  width: 200px;
  flex-shrink: 0;
}

.detail-poster img {
  width: 100%;
  border-radius: 8px;
}

.detail-meta {
  flex: 1;
}

.detail-title {
  font-size: 32px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-tag {
  padding: 4px 12px;
  background: #333;
  color: #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.detail-tag.rating {
  background: #f5c518;
  color: #000;
  font-weight: bold;
}

.detail-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: #E50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 24px;
}

.detail-play-btn.focused {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 8px;
}

.detail-section-text {
  font-size: 14px;
  color: #999;
  line-height: 1.6;
}

.detail-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-extra-item {
  font-size: 14px;
}

.detail-extra-label {
  color: #666;
}

.detail-extra-value {
  color: #ccc;
  margin-left: 8px;
}

.detail-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px;
  background: rgba(0,0,0,0.9);
  color: #666;
  font-size: 12px;
}

/* Player Fullscreen */
.player-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 100;
}

.player-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 101;
  padding: 8px 16px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

/* ===========================================
   SERIES DETAIL
   =========================================== */

.series-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 60px;
}

.series-info {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 8px;
  cursor: pointer;
}

.series-info.focused {
  outline: 3px solid #E50914;
  background: rgba(229, 9, 20, 0.1);
}

.series-poster {
  width: 150px;
  flex-shrink: 0;
}

.series-poster img {
  width: 100%;
  border-radius: 8px;
}

.series-meta {
  flex: 1;
}

.series-plot {
  font-size: 14px;
  color: #888;
  line-height: 1.5;
  margin-top: 12px;
}

.seasons-bar {
  padding: 16px;
  background: #1a1a1a;
  border-radius: 8px;
  margin-bottom: 16px;
}

.seasons-bar.focused {
  outline: 2px solid #E50914;
}

.seasons-label {
  display: block;
  color: #888;
  font-size: 14px;
  margin-bottom: 12px;
}

.seasons-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.season-btn {
  padding: 10px 20px;
  background: #333;
  color: #ccc;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.season-btn.active {
  background: #E50914;
  color: #fff;
}

.season-btn.focused {
  border-color: #fff;
}

.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episodes-empty {
  text-align: center;
  color: #666;
  padding: 48px;
}

.episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #333;
  color: #666;
  font-size: 24px;
}

/* ===========================================
   TV PLAYER OVERLAY
   =========================================== */

.tv-player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.9) 100%);
}

.tv-player-overlay-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
}

.tv-player-overlay-back {
  padding: 10px 20px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.tv-player-overlay-back.focused {
  background: #E50914;
  border-color: #fff;
}

.tv-player-overlay-title {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}

.tv-player-overlay-bottom {
  margin-top: auto;
  padding: 24px;
}

.tv-player-progress {
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  margin-bottom: 16px;
}

.tv-player-progress-bar {
  height: 100%;
  background: #E50914;
  border-radius: 3px;
  transition: width 0.3s;
}

.tv-player-time {
  color: #fff;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.tv-player-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.tv-player-control {
  padding: 12px 24px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

.tv-player-control.main {
  padding: 14px 32px;
  font-size: 18px;
  font-weight: bold;
}

.tv-player-control.focused {
  background: #E50914;
  border-color: #fff;
}

.tv-player-hint {
  text-align: center;
  padding: 12px;
  color: #666;
  font-size: 12px;
}

.tv-player-mini-hint {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.7);
  color: #888;
  font-size: 12px;
  border-radius: 4px;
}
/* ===========================================
   OVERRIDE GLOBAL PARA WebKit ANTIGO (webOS 3.0)
   O gap em flexbox não funciona - forçar margens
   =========================================== */

/* Hero button gap */
.hero-btn > * { margin-right: 8px; }
.hero-btn > *:last-child { margin-right: 0; }

/* Row items gap */
.row-items > * { margin-right: 12px; }
.row-items > *:last-child { margin-right: 0; }

/* TV Status gap */
.tv-status > * { margin-right: 8px; }
.tv-status > *:last-child { margin-right: 0; }

/* TV Channel gap */
.tv-channel > * { margin-right: 12px; }
.tv-channel > *:last-child { margin-right: 0; }

/* TV EPG Info gap */
.tv-epg-info > * { margin-right: 16px; }
.tv-epg-info > *:last-child { margin-right: 0; }

/* TV EPG Channel gap */
.tv-epg-channel > * { margin-right: 12px; }
.tv-epg-channel > *:last-child { margin-right: 0; }

/* TV EPG Program gap */
.tv-epg-program > * { margin-right: 8px; }
.tv-epg-program > *:last-child { margin-right: 0; }

/* List header gap */
.list-header > * { margin-right: 24px; }
.list-header > *:last-child { margin-right: 0; }

/* List categories gap */
.list-categories > * { margin-right: 8px; margin-bottom: 8px; }
.list-categories > *:last-child { margin-right: 0; }

/* Detail badges/info gap */
.detail-badges > * { margin-right: 12px; }
.detail-badges > *:last-child { margin-right: 0; }

.detail-info > * { margin-right: 32px; }
.detail-info > *:last-child { margin-right: 0; }

.detail-actions > * { margin-right: 12px; }
.detail-actions > *:last-child { margin-right: 0; }

/* Keyboard gap */
.keyboard-rows > *,
.keyboard-keys > * { margin-bottom: 8px; }
.keyboard-rows > *:last-child,
.keyboard-keys > *:last-child { margin-bottom: 0; }

.keyboard-row > * { margin-right: 8px; }
.keyboard-row > *:last-child { margin-right: 0; }

.keyboard-actions > * { margin-right: 12px; }
.keyboard-actions > *:last-child { margin-right: 0; }

.keyboard-hints > * { margin-right: 24px; }
.keyboard-hints > *:last-child { margin-right: 0; }

/* Movies grid gap - usar margin nos cards */
.movies-grid > * { margin-right: 16px; margin-bottom: 16px; }

/* Player controls gap */
.player-controls > * { margin-right: 16px; }
.player-controls > *:last-child { margin-right: 0; }

.player-p2p-stats > * { margin-right: 16px; }
.player-p2p-stats > *:last-child { margin-right: 0; }

/* Season selector gap */
.season-selector > * { margin-right: 8px; }
.season-selector > *:last-child { margin-right: 0; }

/* Episodes list gap - vertical */
.episodes-list > * { margin-bottom: 12px; }
.episodes-list > *:last-child { margin-bottom: 0; }

/* Episode item gap */
.episode-item > * { margin-right: 16px; }
.episode-item > *:last-child { margin-right: 0; }

/* Detail tags gap */
.detail-tags > * { margin-right: 8px; margin-bottom: 8px; }
.detail-tags > *:last-child { margin-right: 0; }

/* Detail extra gap - vertical */
.detail-extra > * { margin-bottom: 8px; }
.detail-extra > *:last-child { margin-bottom: 0; }

/* Detail footer gap */
.detail-footer > * { margin-right: 24px; }
.detail-footer > *:last-child { margin-right: 0; }

