/* ===================================================
   MeuPlayer TV - Folha de Estilos para Smart TVs e MSX
   Design Premium 1080p / 4K com Navegação Espacial
   =================================================== */

:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(20, 28, 45, 0.85);
  --bg-card-hover: rgba(30, 42, 68, 0.95);
  --primary: #0088ff;
  --primary-glow: rgba(0, 136, 255, 0.6);
  --accent: #ff0055;
  --text-main: #ffffff;
  --text-dim: #9aa5b8;
  --border-focus: #00d2ff;
  --focus-glow: 0 0 25px rgba(0, 210, 255, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 30%, rgba(20, 30, 60, 0.6) 0%, rgba(10, 14, 23, 0.95) 100%), url('../assets/bg.jpg');
  background-size: cover;
  background-position: center;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--text-main);
}

/* ================= FOCO VISUAL PARA CONTROLE REMOTO ================= */
.focusable {
  outline: none;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

.focusable.tv-focused,
.focusable:focus {
  transform: scale(1.05);
  box-shadow: var(--focus-glow) !important;
  border-color: var(--border-focus) !important;
  z-index: 10;
}

/* Telas */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  padding: 30px 50px;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ================= HEADER DO APP ================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
}

.header-logo {
  height: 60px;
  object-fit: contain;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 25px;
}

.live-clock {
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1px;
}

.live-date {
  font-size: 1.1rem;
  color: var(--text-dim);
  text-transform: capitalize;
}

/* ================= LETREIRO DE AVISO / MENSAGEM MÓVEL ================= */
.moving-message-bar {
  width: 100%;
  background: rgba(0, 136, 255, 0.15);
  border: 1px solid rgba(0, 136, 255, 0.3);
  border-radius: 8px;
  padding: 8px 15px;
  margin-bottom: 20px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.moving-message-bar .ticker-tag {
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 15px;
  white-space: nowrap;
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  animation: tickerScroll 25s linear infinite;
  font-size: 1.05rem;
  color: #e0f2fe;
}

@keyframes tickerScroll {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ================= TELA DE LOGIN ================= */
#screen-login {
  justify-content: center;
  align-items: center;
}

.login-container {
  width: 580px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo {
  height: 90px;
  margin-bottom: 25px;
}

.login-title {
  font-size: 1.3rem;
  color: var(--text-dim);
  margin-bottom: 25px;
  letter-spacing: 2px;
  font-weight: 600;
}

.input-group {
  width: 100%;
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.input-group input {
  width: 100%;
  height: 52px;
  background: rgba(10, 15, 25, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0 18px;
  color: #fff;
  font-size: 1.15rem;
}

.login-btn {
  width: 100%;
  height: 55px;
  background: linear-gradient(90deg, #0088ff 0%, #0055ff 100%);
  border: 2px solid transparent;
  border-radius: 10px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 10px;
  box-shadow: 0 6px 15px rgba(0, 100, 255, 0.4);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 20px;
  text-decoration: underline;
  padding: 8px 15px;
  border-radius: 6px;
}

.login-error {
  color: #ff3366;
  font-size: 0.95rem;
  margin-top: 15px;
  text-align: center;
  min-height: 20px;
}

/* ================= TELA HOME / DASHBOARD ================= */
.home-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 35px;
  flex: 1;
  align-items: center;
  padding: 20px 0;
}

.menu-card {
  height: 380px;
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 20%, rgba(0, 136, 255, 0.15), transparent 70%);
}

.menu-card-icon {
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin-bottom: 25px;
}

.menu-card-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.home-footer-bar {
  height: 60px;
  background: rgba(15, 22, 36, 0.7);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 25px;
  font-size: 1.05rem;
}

.footer-user-details {
  display: flex;
  gap: 30px;
}

.logout-btn {
  background: rgba(255, 50, 80, 0.2);
  border: 1px solid rgba(255, 50, 80, 0.4);
  color: #ff6688;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ================= TELA DE CANAIS AO VIVO ================= */
.live-layout {
  display: grid;
  grid-template-columns: 280px 420px 1fr;
  gap: 20px;
  flex: 1;
  height: calc(100vh - 160px);
}

.list-panel {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title {
  padding: 15px 20px;
  font-size: 1.2rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.scroll-container::-webkit-scrollbar {
  width: 6px;
}
.scroll-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.category-item {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 1.05rem;
  border: 2px solid transparent;
  color: var(--text-dim);
}

.category-item.active {
  background: rgba(0, 136, 255, 0.2);
  color: #ffffff;
  font-weight: 600;
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 2px solid transparent;
  background: rgba(10, 15, 25, 0.4);
}

.channel-num {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--text-dim);
  width: 35px;
}

.channel-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-right: 15px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
}

.channel-name {
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.live-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-player-box {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  position: relative;
}

.channel-info-box {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  flex: 1;
}

.current-ch-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.current-ch-epg {
  font-size: 1.1rem;
  color: var(--text-dim);
}

/* ================= GRID DE FILMES E SÉRIES ================= */
.vod-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 25px;
  flex: 1;
  height: calc(100vh - 160px);
}

.vod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 15px;
  overflow-y: auto;
}

.vod-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 2px solid transparent;
  overflow: hidden;
  background: rgba(15, 22, 35, 0.7);
}

.poster-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.vod-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rating-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffb703;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
}

.vod-title {
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ================= MODAL DE DETALHES (VOD / SÉRIES) ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.9);
  backdrop-filter: blur(25px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 100px;
}

.modal-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  gap: 50px;
  align-items: flex-start;
}

.modal-poster {
  width: 320px;
  aspect-ratio: 2/3;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

.modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-title {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 15px;
}

.modal-meta {
  display: flex;
  gap: 25px;
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 25px;
}

.modal-plot {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #d1d5db;
  margin-bottom: 35px;
  max-height: 180px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 20px;
}

.btn-play-action {
  background: var(--primary);
  border: 2px solid transparent;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 15px 40px;
  border-radius: 12px;
}

.btn-close-action {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  color: #fff;
  font-size: 1.25rem;
  padding: 15px 30px;
  border-radius: 12px;
}

/* ================= SÉRIES - EPISÓDIOS ================= */
.seasons-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.season-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid transparent;
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 1.05rem;
  white-space: nowrap;
}

.season-btn.active {
  background: var(--primary);
}

.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.episode-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: rgba(20, 28, 42, 0.7);
  border-radius: 10px;
  border: 2px solid transparent;
}

.ep-badge {
  background: rgba(0, 136, 255, 0.2);
  color: var(--primary);
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 6px;
  margin-right: 15px;
}

/* ================= PLAYER CONTAINER & TELA CHEIA ================= */
#player-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#player-container.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: #000;
}

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

/* OSD do Player */
.player-osd {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 30px 50px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-osd.visible {
  opacity: 1;
  pointer-events: auto;
}

.osd-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.osd-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.osd-progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.osd-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
}

.osd-time {
  font-size: 1.1rem;
  color: var(--text-dim);
  text-align: right;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.loading-text {
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 600;
}

.hidden {
  display: none !important;
}
