/* DanielTV Web - 10-Foot TV Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #07090e;
  --bg-surface: #12151f;
  --bg-surface-elevated: #1a1f2e;
  --bg-glass: rgba(18, 21, 31, 0.75);
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.45);
  --accent-gold: #f59e0b;
  --accent-emerald: #10b981;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --card-radius: 12px;
  --focus-ring: 0 0 0 3.5px #6366f1, 0 12px 35px rgba(99, 102, 241, 0.5);
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  cursor: none; /* Optimized for TV remote */
}

/* App Container */
#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: scale(0.98);
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: scale(1);
}

/* Focusable Elements */
.focusable {
  outline: none;
  transition: var(--transition-smooth);
}

.focusable.focused {
  box-shadow: var(--focus-ring);
  transform: scale(1.05);
  z-index: 10;
}

/* ==========================================================================
   1. Profile Selection Screen
   ========================================================================== */
#profile-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #171b29 0%, #07090e 80%);
}

.profile-header {
  text-align: center;
  margin-bottom: 50px;
}

.profile-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.profile-title {
  font-size: 24px;
  color: var(--text-secondary);
  font-weight: 400;
}

.profiles-grid {
  display: flex;
  gap: 36px;
  align-items: center;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  background: transparent;
  border: 3px solid transparent;
}

.profile-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, #374151, #1f2937);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 46px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-card.focused {
  transform: scale(1.12);
}

.profile-card.focused .profile-avatar {
  border-color: var(--accent-primary);
  box-shadow: 0 0 30px var(--accent-glow);
}

/* ==========================================================================
   2. Main Home Screen
   ========================================================================== */
#home-screen {
  display: flex;
  flex-direction: column;
}

/* Top Navbar */
.top-navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 55px;
  background: linear-gradient(to bottom, rgba(7, 9, 14, 0.95) 0%, transparent 100%);
  z-index: 100;
}

.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-tabs {
  display: flex;
  gap: 16px;
}

.nav-tab {
  padding: 8px 20px;
  border-radius: 30px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  border: none;
}

.nav-tab.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.nav-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 500;
}

.nav-profile-badge .badge-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* Scroll Container */
.main-scroll-container {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.main-scroll-container::-webkit-scrollbar {
  display: none;
}

/* Hero Section */
.hero-section {
  position: relative;
  width: 100%;
  height: 58vh;
  min-height: 480px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  padding: 0 55px 40px 55px;
  transition: background-image 0.5s ease;
}

.hero-overlay-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to top, var(--bg-primary) 0%, rgba(7, 9, 14, 0.7) 40%, transparent 100%),
    linear-gradient(to right, rgba(7, 9, 14, 0.95) 0%, rgba(7, 9, 14, 0.6) 45%, transparent 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-rating {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-category {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge-year {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  color: #ffffff;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}

.hero-overview {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 22px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: 10px;
  background: #ffffff;
  color: #07090e;
  font-size: 16px;
  font-weight: 700;
  border: none;
}

.btn-primary.focused {
  background: #ffffff;
  box-shadow: 0 0 0 3.5px var(--accent-primary), 0 0 30px rgba(255, 255, 255, 0.6);
  transform: scale(1.08);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  backdrop-filter: blur(10px);
}

.btn-secondary.focused {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: var(--focus-ring);
  transform: scale(1.08);
}

/* Catalog Rows */
.catalog-rows-container {
  padding: 10px 0 60px 0;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.carousel-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row-title {
  padding: 0 55px;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.carousel-track {
  display: flex;
  gap: 18px;
  overflow-x: scroll;
  padding: 10px 55px;
  scroll-behavior: smooth;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* Poster Cards (2:3 aspect) */
.poster-card {
  flex: 0 0 160px;
  height: 240px;
  border-radius: var(--card-radius);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}

.poster-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 9, 14, 0.9) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0.9;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtext {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Landscape / Continue Watching Cards (16:9) */
.landscape-card {
  flex: 0 0 260px;
  height: 155px;
  border-radius: var(--card-radius);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}

.progress-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
}

/* ==========================================================================
   3. Show Details Screen
   ========================================================================== */
#detail-screen {
  background: var(--bg-primary);
  overflow-y: scroll;
}

#detail-screen::-webkit-scrollbar {
  display: none;
}

.detail-header {
  position: relative;
  width: 100%;
  height: 50vh;
  min-height: 420px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  padding: 0 55px 30px 55px;
}

.detail-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.detail-seasons-row {
  padding: 20px 55px;
  display: flex;
  gap: 12px;
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 50;
}

.season-pill {
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.season-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.episodes-list {
  padding: 10px 55px 60px 55px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.episode-item {
  display: flex;
  gap: 22px;
  padding: 16px;
  border-radius: var(--card-radius);
  background: var(--bg-surface);
  border: 2px solid transparent;
}

.episode-still {
  width: 180px;
  height: 105px;
  border-radius: 8px;
  background: #1e2433;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

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

.episode-number {
  font-size: 13px;
  font-weight: 700;
  color: #818cf8;
  margin-bottom: 4px;
}

.episode-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.episode-overview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   4. Video Player Screen
   ========================================================================== */
#player-screen {
  background: #000;
  z-index: 1000;
}

#video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 55px;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.player-overlay.hidden {
  opacity: 0;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 20px;
}

.player-show-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.player-ep-title {
  font-size: 16px;
  color: var(--text-secondary);
}

.player-bottom {
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: auto;
}

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

.time-text {
  font-family: monospace;
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 60px;
}

.player-timeline {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  cursor: pointer;
}

.player-timeline-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-primary);
  width: 0%;
}

.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.player-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  backdrop-filter: blur(8px);
}

.player-btn.primary {
  width: 65px;
  height: 65px;
  background: #fff;
  color: #000;
  font-size: 24px;
}

/* Loading Spinner */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 500;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Subtitle modal */
.subtitle-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface-elevated);
  border-radius: 16px;
  padding: 24px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  z-index: 1200;
}

.subtitle-modal h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.sub-option {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}
