@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --tv-bg: #07090e;
  --tv-surface: #0f1320;
  --tv-surface-light: #181f33;
  --tv-border: rgba(255, 255, 255, 0.1);
  --tv-accent: #00dfd8;
  --tv-primary: #7928ca;
  --tv-focus-glow: 0 0 25px rgba(0, 223, 216, 0.7);
  --tv-text: #f8fafc;
  --tv-text-dim: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: #030407;
  color: var(--tv-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Simulator Container */
.simulator-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  width: 100%;
  max-width: 1600px;
  height: 96vh;
}

/* TV Frame */
.tv-bezel {
  flex: 1;
  aspect-ratio: 16 / 9;
  max-height: 90vh;
  background: #000;
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 50px rgba(121, 40, 202, 0.15);
  border: 3px solid #1e2538;
  position: relative;
  display: flex;
  flex-direction: column;
}

.tv-brand-logo {
  text-align: center;
  font-size: 9px;
  letter-spacing: 2px;
  color: #475569;
  font-weight: 700;
  margin-top: 4px;
}

/* Actual TV Screen */
.tv-screen {
  flex: 1;
  background: var(--tv-bg);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* TV Ambient Glow */
.tv-screen::before {
  content: '';
  position: absolute;
  top: -150px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(121, 40, 202, 0.15) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
  z-index: 1;
}

/* TV Topbar */
.tv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 36px;
  background: linear-gradient(180deg, rgba(7, 9, 14, 0.95) 0%, rgba(7, 9, 14, 0) 100%);
  z-index: 20;
}

.tv-logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-logo-box h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #00dfd8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tv-meta-status {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tv-clock {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--tv-text);
  letter-spacing: 1px;
}

/* TV Focusable Item Styling */
.tv-focusable {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  outline: none;
  cursor: pointer;
}

.tv-focusable.focused {
  transform: scale(1.05) !important;
  box-shadow: var(--tv-focus-glow) !important;
  border-color: var(--tv-accent) !important;
  background: var(--tv-surface-light) !important;
  z-index: 50;
}

/* Activation / First Boot Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  z-index: 10;
}

.welcome-header {
  margin-bottom: 16px;
  text-align: center;
}

.welcome-title {
  font-family: 'Outfit', sans-serif;
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 8px;
}

.welcome-desc {
  font-size: 16px;
  color: var(--tv-text-dim);
  max-width: 750px;
  line-height: 1.5;
}

/* Legal Disclaimer Banner */
.disclaimer-banner {
  background: rgba(255, 171, 0, 0.08);
  border: 1px solid rgba(255, 171, 0, 0.25);
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 12px;
  color: #ffb74d;
  max-width: 840px;
  margin-bottom: 22px;
  text-align: center;
  line-height: 1.4;
}

/* Dual Activation Card: QR & Codes */
.activation-card-container {
  display: flex;
  gap: 24px;
  align-items: stretch;
  max-width: 860px;
  width: 100%;
}

.activation-card {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.activation-card.qr-card {
  align-items: center;
  text-align: center;
}

.card-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tv-accent);
  margin-bottom: 12px;
}

.qr-wrapper {
  background: #fff;
  padding: 8px;
  border-radius: 10px;
  margin-bottom: 12px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tv-qr-box {
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-qr-box img {
  width: 130px;
  height: 130px;
}

.qr-instruction {
  font-size: 12px;
  color: var(--tv-text-dim);
  margin-bottom: 4px;
  line-height: 1.3;
}

.portal-link-text {
  font-family: monospace;
  font-size: 12px;
  color: var(--tv-accent);
  font-weight: 700;
  word-break: break-all;
}

.code-details-card {
  justify-content: space-between;
}

.code-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--tv-border);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 10px;
}

.code-label {
  font-size: 11px;
  color: var(--tv-text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-weight: 700;
}

.code-value {
  font-family: monospace;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
}

.code-value.highlight {
  color: var(--tv-accent);
}

/* Dynamic Pairing Code (YouTube TV Model OTP) */
.pairing-code-box {
  background: linear-gradient(135deg, rgba(0, 223, 216, 0.09) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1.5px solid rgba(0, 223, 216, 0.4);
  box-shadow: 0 0 25px rgba(0, 223, 216, 0.15), inset 0 0 15px rgba(0, 223, 216, 0.05);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 12px;
  text-align: center;
  position: relative;
}

.pairing-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pairing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--tv-accent, #00dfd8);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--tv-accent, #00dfd8);
  box-shadow: 0 0 8px var(--tv-accent, #00dfd8);
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.pairing-code-display {
  font-family: 'Outfit', monospace;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 22px rgba(0, 223, 216, 0.6);
  margin: 4px 0 6px 0;
  user-select: all;
  line-height: 1.1;
}

.pairing-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--tv-text-dim);
}

.pairing-timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.pairing-timer.warning {
  color: #ffb703;
  border-color: rgba(255, 183, 3, 0.4);
  background: rgba(255, 183, 3, 0.1);
}

.pairing-timer.danger {
  color: #ff4d6d;
  border-color: rgba(255, 77, 109, 0.4);
  background: rgba(255, 77, 109, 0.15);
  animation: pulse-glow 1s infinite;
}

.btn-refresh-pair {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--tv-border);
  color: #fff;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-refresh-pair:hover, .btn-refresh-pair.focused {
  border-color: var(--tv-accent);
  color: var(--tv-accent);
  background: rgba(0, 223, 216, 0.15);
  box-shadow: 0 0 12px rgba(0, 223, 216, 0.3);
}

.pairing-hint {
  font-size: 11px;
  color: var(--tv-text-dim);
  margin-top: 6px;
  line-height: 1.3;
}

/* Privacy Shield Row in Settings */
.privacy-shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.settings-protected-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 8px;
}

.welcome-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.tv-btn {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-btn-primary {
  background: linear-gradient(135deg, var(--tv-primary) 0%, #ff0080 100%);
}

.tv-btn-cyan {
  background: linear-gradient(135deg, #0070f3 0%, var(--tv-accent) 100%);
  color: #000;
}

/* TV Player Main Interface */
.tv-main-view {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  z-index: 10;
}

/* Left Sidebar: Categories */
.tv-categories-panel {
  width: 280px;
  background: rgba(11, 14, 23, 0.85);
  border-right: 1px solid var(--tv-border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cat-item {
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--tv-text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cat-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 223, 216, 0.4);
}

.cat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}

.cat-count {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--tv-text-dim);
  flex-shrink: 0;
}

.cat-item.active .cat-count,
.cat-item.focused .cat-count {
  background: rgba(0, 223, 216, 0.25);
  color: var(--tv-accent);
}

.panel-header-title {
  padding: 8px 12px 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--tv-accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

/* Middle: Channels List */
.tv-channels-panel {
  width: 360px;
  background: rgba(15, 19, 32, 0.95);
  border-right: 1px solid var(--tv-border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-item {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.channel-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--tv-accent);
  width: 28px;
}

.channel-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  object-fit: contain;
  padding: 4px;
}

.channel-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Right: Video Preview & Details */
.tv-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: #000;
  position: relative;
}

.tv-video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050608;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--tv-border);
}

#tvVideoPlayer {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.playing-meta-box {
  margin-top: 20px;
}

.playing-title {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.playing-category {
  font-size: 15px;
  color: var(--tv-accent);
  font-weight: 600;
}

/* EPG Broadcast Guide Card */
.epg-guide-card {
  background: rgba(18, 22, 34, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.epg-now-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.epg-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 46, 99, 0.18);
  color: #ff2e63;
  border: 1px solid rgba(255, 46, 99, 0.4);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.epg-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff2e63;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

.epg-now-time {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.epg-remaining {
  font-size: 11px;
  color: var(--tv-text-dim);
  font-weight: 600;
}

.epg-now-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-now-desc {
  font-size: 12px;
  color: var(--tv-text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epg-progress-container {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.epg-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00dfd8, #0072ff);
  border-radius: 3px;
  transition: width 0.6s ease;
  box-shadow: 0 0 10px rgba(0, 223, 216, 0.5);
}

.epg-next-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--tv-text-dim);
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.epg-next-badge {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #bbb;
  letter-spacing: 0.5px;
}

.epg-next-title {
  color: #e0e0e0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.epg-next-time {
  font-family: monospace;
  font-size: 11px;
  color: var(--tv-text-dim);
}

/* Fullscreen OSD Banner */
.tv-osd-banner {
  position: absolute;
  bottom: 28px;
  left: 36px;
  right: 36px;
  background: rgba(10, 14, 24, 0.96);
  border: 1.5px solid rgba(0, 223, 216, 0.4);
  border-radius: 18px;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 25px rgba(0, 223, 216, 0.2);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tv-osd-banner.hidden {
  display: none !important;
}

.tv-osd-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tv-osd-channel-num {
  font-family: 'Outfit', sans-serif;
  font-size: 38px;
  font-weight: 900;
  color: var(--tv-accent);
  background: rgba(0, 223, 216, 0.12);
  padding: 4px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 223, 216, 0.3);
}

.tv-osd-channel-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.tv-osd-prog-title {
  font-size: 15px;
  color: #cbd5e1;
  margin-top: 4px;
}

.tv-osd-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.tv-osd-time {
  font-family: monospace;
  font-size: 14px;
  color: #00dfd8;
  font-weight: 700;
}

.tv-osd-progress-container {
  width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.tv-osd-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00dfd8, #0072ff);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.tv-osd-next {
  font-size: 12px;
  color: #94a3b8;
}

/* Fullscreen Video Overlay */
.fullscreen-mode .tv-preview-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  z-index: 100;
}

.fullscreen-mode .tv-video-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
}

.fullscreen-mode .tv-categories-panel,
.fullscreen-mode .tv-channels-panel,
.fullscreen-mode .tv-topbar {
  display: none !important;
}

.fullscreen-mode .playing-meta-box {
  display: none !important;
}

/* TV Remote Control (Realistic D-Pad Simulator) */
.remote-controller {
  width: 240px;
  background: linear-gradient(180deg, #1e2230 0%, #121520 100%);
  border-radius: 36px;
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.1);
  border: 2px solid #2d3448;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.remote-header {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #64748b;
  font-weight: 800;
}

.remote-top-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 8px;
}

.btn-remote-power {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #dc2626;
  border: none;
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-remote-source {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  border: none;
  color: white;
  cursor: pointer;
}

/* D-Pad Circle */
.dpad-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #191c28;
  border: 2px solid #2d3448;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.5);
}

.dpad-btn {
  position: absolute;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 18px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, color 0.1s;
}

.dpad-btn:active {
  color: var(--tv-accent);
  transform: scale(0.9);
}

.dpad-up { top: 6px; }
.dpad-down { bottom: 6px; }
.dpad-left { left: 6px; }
.dpad-right { right: 6px; }

.dpad-ok {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3148 0%, #1a1e2d 100%);
  border: 2px solid #3b4562;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.dpad-ok:active {
  background: var(--tv-accent);
  color: #000;
}

/* Navigation Buttons (Back / Home) */
.remote-nav-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 12px;
}

.remote-pill-btn {
  padding: 8px 14px;
  border-radius: 20px;
  background: #242a3e;
  border: 1px solid #374151;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.remote-pill-btn:active {
  background: #374151;
  color: #fff;
}

/* Color Buttons Row */
.remote-colors-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 10px;
}

.color-dot-btn {
  width: 26px;
  height: 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.color-red { background: #ef4444; }
.color-green { background: #10b981; }
.color-yellow { background: #f59e0b; }
.color-blue { background: #3b82f6; }

/* Keyboard Help Box */
.remote-help {
  font-size: 10px;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 8px;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* TV Track Selection Modal (Audio & Subtitle) */
.tv-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

.tv-modal-content {
  background: #0f1320;
  border: 1px solid var(--tv-border);
  border-radius: 16px;
  padding: 28px 32px;
  width: 420px;
  max-width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.track-item {
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--tv-text-dim);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  cursor: pointer;
}

.track-item.active {
  background: rgba(0, 223, 216, 0.15);
  border-color: rgba(0, 223, 216, 0.4);
  color: #fff;
}

/* Settings Modal & Controls */
.settings-modal-box {
  max-width: 680px;
  width: 90%;
  padding: 26px 30px;
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--tv-border);
  padding-bottom: 12px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.setting-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--tv-border);
  border-radius: 12px;
  padding: 12px 18px;
}

.setting-title {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.setting-subtitle {
  font-size: 12px;
  color: var(--tv-text-dim);
  margin-top: 2px;
}

.lang-selector-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--tv-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-pill.active {
  background: rgba(0, 223, 216, 0.2);
  border-color: var(--tv-accent);
  color: var(--tv-accent);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 223, 216, 0.3);
}

.settings-license-badge {
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 223, 216, 0.15);
  color: #00dfd8;
  border: 1px solid rgba(0, 223, 216, 0.3);
}

.settings-disclaimer-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--tv-text-dim);
  line-height: 1.4;
  margin-bottom: 20px;
}

.settings-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Hub View Layout */
.tv-hub-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 30px 48px;
  overflow: hidden;
  position: relative;
  z-index: 2;
  justify-content: space-between;
}
.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.hub-welcome-text h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.hub-welcome-text p {
  color: var(--tv-text-dim);
  font-size: 15px;
  margin-top: 4px;
}
.hub-count-badge {
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 14px;
  font-weight: 700;
  color: #00dfd8;
}
.hub-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin: auto 0;
}
.hub-card {
  background: rgba(15, 19, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  position: relative;
  outline: none;
}
.hub-card:hover, .hub-card.focused {
  transform: translateY(-8px) scale(1.03);
  border-color: #00dfd8;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 223, 216, 0.35);
}
.hub-card-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.04);
}
.live-glow { background: rgba(0, 223, 216, 0.12); box-shadow: 0 0 20px rgba(0, 223, 216, 0.2); }
.movies-glow { background: rgba(168, 85, 247, 0.12); box-shadow: 0 0 20px rgba(168, 85, 247, 0.2); }
.series-glow { background: rgba(59, 130, 246, 0.12); box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
.fav-glow { background: rgba(234, 179, 8, 0.12); box-shadow: 0 0 20px rgba(234, 179, 8, 0.2); }

.hub-card-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.live-badge { color: #00dfd8; background: rgba(0, 223, 216, 0.15); border: 1px solid rgba(0, 223, 216, 0.3); }
.movies-badge { color: #a855f7; background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3); }
.series-badge { color: #3b82f6; background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }
.fav-badge { color: #eab308; background: rgba(234, 179, 8, 0.15); border: 1px solid rgba(234, 179, 8, 0.3); }

.hub-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.hub-card-desc {
  font-size: 13px;
  color: var(--tv-text-dim);
  line-height: 1.4;
}

.hub-footer-shortcuts {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.shortcut-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--tv-text-dim);
  cursor: pointer;
}
.key-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.key-red { background: #ef4444; }
.key-yellow { background: #eab308; color: #000; }
.key-blue { background: #3b82f6; }

/* Custom TV Video Player Overlay (Live & Catchup) */
.video-broadcast-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.overlay-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.live-badge-pill {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #ff4757;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.live-dot-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff4757;
  box-shadow: 0 0 10px #ff4757;
  animation: pulse-live 1.2s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.5; }
}

.catchup-badge-pill {
  background: rgba(0, 223, 216, 0.2);
  border: 1px solid rgba(0, 223, 216, 0.5);
  color: #00dfd8;
  box-shadow: 0 0 15px rgba(0, 223, 216, 0.3);
}

/* Timeshift / Catch-up Bar */
.video-timeshift-container {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  background: rgba(7, 9, 14, 0.92);
  border: 1px solid rgba(0, 223, 216, 0.3);
  border-radius: 12px;
  padding: 10px 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.timeshift-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeshift-rewind-label {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #00dfd8;
}

.btn-return-live {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-return-live:hover, .btn-return-live.focused {
  background: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.timeshift-track-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.timeshift-progress {
  height: 100%;
  background: linear-gradient(90deg, #00dfd8, #00e676);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* VOD / Movie Timeline */
.video-vod-container {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  background: rgba(7, 9, 14, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vod-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text-dim);
}

.vod-track-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.vod-progress {
  height: 100%;
  background: #00dfd8;
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* RTL Support for Arabic */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .tv-topbar,
[dir="rtl"] .hub-header,
[dir="rtl"] .timeshift-info-row,
[dir="rtl"] .vod-time-row,
[dir="rtl"] .settings-modal-header,
[dir="rtl"] .setting-item-row,
[dir="rtl"] .code-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .hub-footer-shortcuts,
[dir="rtl"] .lang-selector-pills {
  flex-direction: row-reverse;
}
[dir="rtl"] .epg-now-header,
[dir="rtl"] .epg-next-row {
  flex-direction: row-reverse;
}

/* Subtitles: Native ::cue and High-Visibility Overlay */
video::cue {
  background-color: rgba(0, 0, 0, 0.85) !important;
  color: #ffffff !important;
  font-family: 'Outfit', sans-serif, system-ui !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9) !important;
  white-space: pre-line !important;
}

.tv-subtitle-overlay {
  position: absolute;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 82%;
  background: rgba(7, 9, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-family: 'Outfit', sans-serif, system-ui;
  font-size: 22px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 8px;
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 125;
  white-space: pre-line;
  transition: opacity 0.2s ease;
}

.fullscreen-mode .tv-subtitle-overlay {
  bottom: 80px;
  font-size: 28px;
  padding: 10px 28px;
}

/* Fullscreen Controls & Options Overlay (Mobile-App Style) */
.fullscreen-controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.15) 30%, rgba(0,0,0,0.15) 70%, rgba(0,0,0,0.92) 100%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 40px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: auto;
}

.fullscreen-controls-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fs-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.fs-back-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.2s;
}

.fs-back-btn:hover, .fs-back-btn.focused {
  background: var(--tv-accent);
  color: #000;
  transform: scale(1.05);
}

.fs-channel-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fs-channel-num {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--tv-accent);
}

.fs-channel-name {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.fs-prog-name {
  font-size: 14px;
  color: var(--tv-text-dim);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 12px;
}

.fs-clock {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.fs-center-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.fs-circle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.fs-circle-btn:hover, .fs-circle-btn.focused {
  background: var(--tv-accent);
  color: #000;
  transform: scale(1.12);
  box-shadow: 0 0 20px rgba(0, 223, 216, 0.5);
}

.fs-circle-btn.fs-play-btn {
  width: 76px;
  height: 76px;
  font-size: 28px;
  border-color: var(--tv-accent);
}

.fs-bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.fs-bottom-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.fs-action-pill {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.fs-action-pill:hover, .fs-action-pill.focused {
  background: var(--tv-accent);
  color: #000;
  border-color: var(--tv-accent);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 223, 216, 0.4);
}





/* High-Performance 60FPS TV List Navigation */
.cat-item.focused,
.channel-item.focused {
  transform: none !important;
  box-shadow: none !important;
  background: rgba(0, 223, 216, 0.22) !important;
  border-color: var(--tv-accent) !important;
  outline: 2px solid var(--tv-accent) !important;
  outline-offset: -2px;
  z-index: 5;
}

.channel-item.active-playing {
  border-left: 4px solid var(--tv-accent) !important;
  background: rgba(0, 223, 216, 0.12) !important;
}

.play-fs-hint {
  font-size: 11px;
  font-weight: 700;
  color: #00dfd8;
  background: rgba(0, 223, 216, 0.18);
  border: 1px solid rgba(0, 223, 216, 0.35);
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: auto;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.tv-categories-panel,
.tv-channels-panel {
  contain: content;
  will-change: scroll-position;
}
