/* ========================================
   IPTV Brasil — Prime Video + Netflix Style
   Dark/Light Theme, CSS Variables
   ======================================== */

/* --- CSS Custom Properties --- */
:root,
[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-alt: #242424;
  --primary: #00a8e1;
  --primary-hover: #0090c4;
  --accent: #e50914;
  --accent-hover: #f40612;
  --text: #ffffff;
  --text-sec: #b3b3b3;
  --text-muted: #666666;
  --border: #333333;
  --overlay: rgba(0, 0, 0, 0.85);
  --overlay-light: rgba(0, 0, 0, 0.6);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --grad-hero: linear-gradient(to top, #0f0f0f 0%, rgba(15,15,15,0.7) 30%, transparent 60%);
  --grad-left: linear-gradient(to right, #0f0f0f 0%, transparent 30%);
  --grad-card: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
  --radius: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --header-h: 64px;
  --tr: 300ms cubic-bezier(.4, 0, .2, 1);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-alt: #e8e8e8;
  --primary: #0073e6;
  --primary-hover: #005bb5;
  --accent: #e50914;
  --accent-hover: #f40612;
  --text: #1a1a1a;
  --text-sec: #666666;
  --text-muted: #999999;
  --border: #dddddd;
  --overlay: rgba(255, 255, 255, 0.92);
  --overlay-light: rgba(255, 255, 255, 0.7);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --grad-hero: linear-gradient(to top, #f5f5f5 0%, rgba(245,245,245,0.7) 30%, transparent 60%);
  --grad-left: linear-gradient(to right, #f5f5f5 0%, transparent 30%);
  --grad-card: linear-gradient(to top, rgba(255,255,255,0.95), transparent);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

img {
  display: block;
  max-width: 100%;
}

input, select {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-sec);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Profile Screen --- */
.profile-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.profile-screen h1 {
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-sec);
}

.profile-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--tr);
}

.profile-card:hover {
  transform: scale(1.05);
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  border: 3px solid transparent;
  transition: border-color var(--tr);
  color: #fff;
}

.profile-card:hover .profile-avatar {
  border-color: var(--text);
}

.profile-name {
  font-size: 0.9rem;
  color: var(--text-sec);
  transition: color var(--tr);
}

.profile-card:hover .profile-name {
  color: var(--text);
}

.profile-add {
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  border: 2px dashed var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-muted);
  transition: var(--tr);
}

.profile-card:hover .profile-add {
  border-color: var(--text-sec);
  color: var(--text-sec);
}

/* --- Navbar / Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 4%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
  transition: background var(--tr), box-shadow var(--tr);
}

[data-theme="light"] .header {
  background: linear-gradient(to bottom, rgba(255,255,255,0.85), transparent);
}

.header.scrolled {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-right: 32px;
  flex-shrink: 0;
}

.header-logo i {
  font-size: 1.2rem;
}

.header-nav {
  display: flex;
  gap: 18px;
  flex: 1;
}

.header-nav a {
  font-size: 0.88rem;
  color: var(--text-sec);
  transition: color var(--tr);
  white-space: nowrap;
  padding: 4px 0;
  position: relative;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text);
}

.header-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-sec);
  transition: color var(--tr);
  padding: 6px 8px;
  border-radius: var(--radius);
}

.header-btn:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.header-btn i {
  font-size: 1rem;
}

/* Theme Toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--tr), color var(--tr);
}

.theme-toggle:hover {
  background: var(--surface-alt);
}

.theme-toggle .fa-sun,
.theme-toggle .fa-moon {
  font-size: 1rem;
  transition: transform var(--tr), opacity var(--tr);
}

/* Profile Avatar in Header */
.header-profile {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: box-shadow var(--tr);
}

.header-profile:hover {
  box-shadow: 0 0 0 2px var(--text);
}

/* --- Search Overlay --- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--overlay);
  backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  padding: 80px 4% 40px;
  overflow-y: auto;
}

.search-overlay.active {
  display: flex;
}

.search-close {
  position: absolute;
  top: 20px;
  right: 4%;
  font-size: 1.5rem;
  color: var(--text-sec);
  transition: color var(--tr);
}

.search-close:hover {
  color: var(--text);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--text-sec);
  padding-bottom: 10px;
  margin-bottom: 28px;
}

.search-input-wrap i {
  font-size: 1.3rem;
  color: var(--text-sec);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1.8rem;
  color: var(--text);
  font-family: var(--font);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-suggestions h3 {
  font-size: 0.95rem;
  color: var(--text-sec);
  margin-bottom: 12px;
}

.search-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-tag {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface-alt);
  font-size: 0.82rem;
  color: var(--text-sec);
  transition: var(--tr);
}

.search-tag:hover {
  background: var(--surface);
  color: var(--text);
}

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

/* --- Hero Section --- */
.hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease;
}

.hero-slide.active {
  opacity: 1;
}

.hero-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: var(--grad-hero);
}

.hero-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-left);
}

.hero-content {
  position: absolute;
  bottom: 18%;
  left: 4%;
  max-width: 520px;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: #fff;
}

.hero-badge i {
  font-size: 0.45rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 14px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-sec);
  margin-bottom: 20px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-play,
.btn-list {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  transition: background var(--tr), transform var(--tr);
}

.btn-play {
  background: var(--accent);
  color: #fff;
}

.btn-play:hover {
  background: var(--accent-hover);
  transform: scale(1.03);
}

.btn-list {
  background: rgba(109, 109, 110, 0.6);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.btn-list:hover {
  background: rgba(109, 109, 110, 0.4);
}

.hero-indicators {
  position: absolute;
  bottom: 6%;
  right: 4%;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.hero-dot {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: var(--tr);
}

.hero-dot.active {
  width: 20px;
  background: var(--text);
}

/* --- Content Area --- */
.content-area {
  position: relative;
  z-index: 3;
  margin-top: -80px;
  padding-bottom: 80px;
}

/* --- Carousels --- */
.carousel-row {
  padding: 0 4%;
  margin-bottom: 36px;
}

.carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.carousel-title {
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-title i {
  color: var(--accent);
  font-size: 1rem;
}

.carousel-see-all {
  font-size: 0.82rem;
  color: var(--primary);
  transition: color var(--tr);
}

.carousel-see-all:hover {
  color: var(--text);
}

.carousel-wrap {
  position: relative;
}

.carousel-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

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

.carousel-arrow {
  position: absolute;
  top: 0;
  bottom: 6px;
  width: 44px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-light);
  font-size: 1.3rem;
  color: var(--text);
  opacity: 0;
  transition: opacity var(--tr), background var(--tr);
}

.carousel-wrap:hover .carousel-arrow {
  opacity: 1;
}

.carousel-arrow:hover {
  background: var(--overlay);
}

.carousel-arrow.left {
  left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.carousel-arrow.right {
  right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

/* --- Channel Cards --- */
.channel-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  border-radius: var(--radius);
  overflow: visible;
  position: relative;
  transition: transform var(--tr), z-index 0s;
  cursor: pointer;
}

.channel-card:hover {
  transform: scale(1.08);
  z-index: 10;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-alt);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--tr);
}

.channel-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-thumb .placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
}

.live-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.card-hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity var(--tr);
  border-radius: 0 0 var(--radius) var(--radius);
}

.channel-card:hover .card-hover-info {
  opacity: 1;
}

.card-hover-name {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}

.card-hover-cat {
  font-size: 0.68rem;
  color: var(--text-sec);
  margin-bottom: 6px;
}

.card-hover-actions {
  display: flex;
  gap: 5px;
}

.card-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: var(--tr);
}

.card-action-btn.play-btn {
  background: var(--text);
  color: var(--bg);
}

.card-action-btn.play-btn:hover {
  background: var(--accent);
  color: #fff;
}

.card-action-btn.list-btn {
  border: 2px solid var(--text-sec);
  color: var(--text-sec);
}

.card-action-btn.list-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.card-action-btn.list-btn.in-list {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.card-resolution {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.58rem;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transition: opacity var(--tr);
}

.channel-card:hover .card-resolution {
  opacity: 1;
}

/* Continue Watching */
.continue-card {
  position: relative;
}

.continue-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.continue-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 0 0 0 var(--radius);
}

.continue-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity var(--tr);
}

.channel-card:hover .continue-remove {
  opacity: 1;
}

/* See More Card */
.see-more-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.see-more-card .card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
}

/* --- EPG Panel --- */
.epg-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  z-index: 3000;
  background: var(--surface);
  transform: translateX(100%);
  transition: transform var(--tr);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.epg-panel.open {
  transform: translateX(0);
}

.epg-panel-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.epg-panel-header-bar h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.epg-panel-header-bar h3 i {
  color: var(--accent);
}

.epg-panel-close {
  font-size: 1.1rem;
  color: var(--text-sec);
  transition: color var(--tr);
  padding: 4px;
}

.epg-panel-close:hover {
  color: var(--text);
}

.epg-panel-content {
  flex: 1;
  overflow-y: auto;
}

/* EPG Now Playing (in player) */
.player-epg-info {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  padding: 10px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  z-index: 1;
  transition: opacity 0.4s ease;
}

.epg-now-playing {
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius);
  padding: 10px 14px;
  backdrop-filter: blur(10px);
}

.epg-now-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.epg-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

.epg-live-badge i {
  font-size: 0.35rem;
  animation: pulse 2s infinite;
}

.epg-time-range {
  font-size: 0.72rem;
  color: var(--text-sec);
}

.epg-now-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.epg-now-desc {
  font-size: 0.78rem;
  color: var(--text-sec);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epg-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.epg-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

/* EPG Timeline */
.epg-timeline {
  padding: 6px 0;
}

.epg-timeline-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--tr);
}

.epg-timeline-item:hover {
  background: var(--surface-alt);
}

.epg-timeline-item.epg-now {
  background: rgba(229, 9, 20, 0.1);
  border-left: 3px solid var(--accent);
}

.epg-timeline-item.epg-past {
  opacity: 0.5;
}

.epg-timeline-time {
  font-size: 0.72rem;
  color: var(--primary);
  margin-bottom: 3px;
  font-weight: 600;
}

.epg-timeline-title {
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 3px;
}

.epg-timeline-desc {
  font-size: 0.72rem;
  color: var(--text-sec);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epg-timeline-duration {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.epg-now-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--tr);
}

.epg-now-item:hover {
  background: var(--surface-alt);
}

.epg-now-channel {
  font-size: 0.72rem;
  color: var(--text-sec);
  margin-bottom: 3px;
}

.epg-now-item .epg-now-title {
  font-size: 0.85rem;
}

.epg-now-time {
  font-size: 0.72rem;
  color: var(--primary);
}

.epg-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 50px 18px;
  color: var(--text-sec);
}

.epg-panel-empty i {
  font-size: 2.2rem;
  color: var(--text-muted);
}

.epg-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.epg-panel-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: cover;
}

.epg-panel-logo-placeholder {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* --- Player Modal --- */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.player-modal.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.player-video-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

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

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

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

.player-top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.player-back {
  font-size: 1.2rem;
  padding: 6px;
  transition: color var(--tr);
}

.player-back:hover {
  color: var(--primary);
}

.player-channel-title {
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

.player-live-tag {
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

.player-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.player-big-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  transition: var(--tr);
}

.player-big-play:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.player-bottom-bar {
  padding: 14px 24px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

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

.player-ctrl-btn {
  font-size: 1.1rem;
  padding: 5px;
  color: var(--text);
  transition: color var(--tr);
}

.player-ctrl-btn:hover {
  color: var(--primary);
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.player-spacer {
  flex: 1;
}

.quality-select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 3px 7px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  outline: none;
}

/* Player Loading / Error */
.player-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.6);
}

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

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

.player-error-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.8);
}

.player-error-overlay.active {
  display: flex;
}

.player-error-overlay i {
  font-size: 2.5rem;
  color: var(--accent);
}

.player-error-overlay span {
  color: var(--text-sec);
}

/* --- Player Page (player.html) --- */
.player-page {
  position: fixed;
  inset: 0;
  display: flex;
  background: var(--bg);
}

.player-page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.player-page-video {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

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

.player-page-controls {
  padding: 10px 18px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.player-page-sidebar {
  width: 300px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: width var(--tr);
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.player-page-sidebar.collapsed {
  width: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.92rem;
}

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

.sidebar-ch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--tr);
  border-bottom: 1px solid var(--border);
}

.sidebar-ch-item:hover,
.sidebar-ch-item.active {
  background: var(--surface-alt);
}

.sidebar-ch-thumb {
  width: 56px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.sidebar-ch-name {
  font-size: 0.82rem;
  font-weight: 500;
}

.sidebar-ch-cat {
  font-size: 0.68rem;
  color: var(--text-sec);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  border-left: 4px solid var(--primary);
  color: var(--text);
}

.toast.success {
  border-left-color: #2ecc71;
}

.toast.error {
  border-left-color: var(--accent);
}

.toast.info {
  border-left-color: var(--primary);
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- Skeleton Loading --- */
.skeleton-row {
  padding: 0 4%;
  margin-bottom: 36px;
}

.skeleton-title {
  width: 180px;
  height: 22px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.skeleton-track {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.skeleton-card {
  flex: 0 0 220px;
  aspect-ratio: 16 / 9;
  background: var(--surface-alt);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.5s infinite;
}

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

/* --- Bottom Nav (Mobile) --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 54px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  color: var(--text-sec);
  transition: color var(--tr);
  padding: 4px 12px;
}

.bottom-nav-item i {
  font-size: 1.1rem;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--primary);
}

/* --- No Results --- */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 50px 18px;
  color: var(--text-sec);
}

.no-results i {
  font-size: 2.5rem;
  color: var(--text-muted);
}

/* --- 404 Page --- */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.error-msg {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transition: background var(--tr);
}

.back-btn:hover {
  background: var(--primary-hover);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .channel-card {
    flex: 0 0 190px;
  }
  .channel-card:hover {
    transform: scale(1.12);
  }
  .hero-title {
    font-size: 2rem;
  }
  .header-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .hero {
    height: 50vh;
    min-height: 320px;
  }
  .hero-title {
    font-size: 1.6rem;
  }
  .hero-desc {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
  }
  .hero-content {
    bottom: 22%;
    max-width: 80%;
  }
  .btn-play,
  .btn-list {
    padding: 8px 18px;
    font-size: 0.88rem;
  }
  .channel-card {
    flex: 0 0 145px;
  }
  .channel-card:hover {
    transform: scale(1.05);
  }
  .carousel-row {
    padding: 0 3%;
  }
  .carousel-title {
    font-size: 1.05rem;
  }
  .carousel-arrow {
    display: none;
  }
  .header-actions .header-btn span {
    display: none;
  }
  .bottom-nav {
    display: flex;
  }
  .content-area {
    padding-bottom: 68px;
  }
  .player-page-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    width: 260px;
  }
  .player-page-sidebar.collapsed {
    width: 0;
  }
  .profile-avatar {
    width: 72px;
    height: 72px;
    font-size: 1.6rem;
  }
  .profile-screen h1 {
    font-size: 1.3rem;
  }
  .search-input {
    font-size: 1.2rem;
  }
  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .epg-panel {
    width: 100%;
    max-width: 100%;
  }
  .player-epg-info {
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .channel-card {
    flex: 0 0 130px;
  }
  .hero-title {
    font-size: 1.3rem;
  }
  .hero-buttons {
    flex-direction: column;
    gap: 6px;
  }
  .hero-content {
    left: 3%;
    max-width: 90%;
  }
}

/* --- prefers-color-scheme fallback --- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-alt: #e8e8e8;
    --primary: #0073e6;
    --primary-hover: #005bb5;
    --text: #1a1a1a;
    --text-sec: #666666;
    --text-muted: #999999;
    --border: #dddddd;
    --overlay: rgba(255, 255, 255, 0.92);
    --overlay-light: rgba(255, 255, 255, 0.7);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --grad-hero: linear-gradient(to top, #f5f5f5 0%, rgba(245,245,245,0.7) 30%, transparent 60%);
    --grad-left: linear-gradient(to right, #f5f5f5 0%, transparent 30%);
    --grad-card: linear-gradient(to top, rgba(255,255,255,0.95), transparent);
  }
}
