/* =========================================================
   StreamPlay - White Label Player
   Design escuro estilo Netflix/Plex, focado em navegação por
   controle remoto (D-pad) em telas de TV.
   ========================================================= */

:root {
  --bg-color: #0a0a0c;
  --bg-elevated: #17171b;
  --card-bg: #1f1f24;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a8;
  --accent: #e50914;
  --accent-soft: rgba(229, 9, 20, 0.25);
  --focus-ring: #ffffff;
  --radius: 8px;
}

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

html, body {
  height: 100%;
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}

/* ---------------------- Telas (screens) ---------------------- */

.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
}

.screen.active {
  display: block;
}

/* ---------------------- Login ---------------------- */

#login-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1a1a1f 0%, #050506 100%);
}

.login-box {
  width: 100%;
  max-width: 380px;
  padding: 40px;
  text-align: center;
}

.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.logo span {
  color: var(--accent);
}

.logo.small {
  font-size: 1.5rem;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input {
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
}

.login-btn {
  background: var(--accent);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.login-hint {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------------------- Foco (D-pad / teclado) ---------------------- */

.focusable {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.focusable.focused,
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: scale(1.04);
}

/* ---------------------- Barra superior ---------------------- */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.top-nav {
  display: flex;
  gap: 28px;
}

.nav-item {
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}

.nav-item.active,
.nav-item.focused {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ---------------------- Galeria / Grid ---------------------- */

main {
  padding: 0 48px 60px;
}

.section-title {
  font-size: 1.3rem;
  margin: 12px 0 20px;
  color: var(--text-primary);
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.movie-card {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-elevated) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><rect width="24" height="24" fill="none"/></svg>');
  display: block;
}

.movie-info {
  padding: 10px 12px 14px;
}

.movie-title {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-year {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.movie-overview {
  display: none;
}

/* ---------------------- Player ---------------------- */

#player-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
}

#video-player {
  width: 100%;
  height: 100%;
  background: #000;
}

.player-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 48px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  pointer-events: none;
}

#player-title {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.player-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ---------------------- Loading ---------------------- */

.loading-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-elevated);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

/* ---------------------- Responsivo TV (telas grandes) ---------------------- */

@media (min-width: 1600px) {
  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 32px;
  }

  .top-bar, main {
    padding-left: 80px;
    padding-right: 80px;
  }
}
