/* ==================== Variables de Optimización Adaptativa ==================== */
:root {
  --blur-amount: 12px;
  --animation-speed: 0.3s;
  --shadow-complexity: 3;
  --card-primary: #72d6ff;
  --card-secondary: #ff7fff;
  --card-accent: #4ade80;
  --card-glow: rgba(114, 214, 255, 0.4);
  --card-transition: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --hologram-layers: 3;
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --bg-card: rgba(20, 25, 45, 0.9);
  --radius: 16px;
}

/* Detección automática de capacidad del dispositivo */
@media (hover: none) and (pointer: coarse) {
  :root {
    --blur-amount: 4px;
    --animation-speed: 0.2s;
    --shadow-complexity: 1;
    --card-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

@media (min-width: 1024px) and (hover: hover) {
  :root {
    --blur-amount: 16px;
    --animation-speed: 0.4s;
    --shadow-complexity: 4;
  }
}

/* ==================== Main Content ==================== */
main {
  position: relative;
  z-index: 2;
}

/* ==================== Channels Section ==================== */
.channels-section {
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* ==================== Section Title con Efectos Mejorados ==================== */
.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, 
    var(--card-primary) 0%, 
    var(--card-secondary) 25%,
    var(--card-accent) 50%,
    var(--card-secondary) 75%,
    var(--card-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% 100%;
  margin-bottom: 1rem;
  letter-spacing: -1px;
  position: relative;
  padding-bottom: 1.5rem;
  text-shadow: 0 0 40px rgba(114, 214, 255, 0.3);
}

/* Animación solo en PC */
@media (min-width: 1024px) and (hover: hover) {
  .section-title {
    animation: titleFlow 8s ease-in-out infinite;
  }

  @keyframes titleFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
  }
}

/* Línea decorativa bajo el título */
.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  max-width: 90%;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--card-primary) 20%, 
    var(--card-secondary) 50%,
    var(--card-primary) 80%, 
    transparent);
  border-radius: 2px;
  box-shadow: 0 0 20px rgba(114, 214, 255, 0.6);
}

/* ==================== LISTA VERTICAL (modificado del grid original) ==================== */
.channels-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  perspective: 1500px;
}

/* ==================== CARDS HOLOGRÁFICAS (LAYOUT HORIZONTAL) ==================== */
.channel-card {
  border-radius: 20px;
  overflow: visible;
  cursor: pointer;
  padding: 1rem;
  border: 2px solid transparent;
  min-height: 80px;
  
  /* CAMBIO PRINCIPAL: de column a row */
  display: flex;
  flex-direction: row;
  align-items: center;
  
  position: relative;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transform-style: preserve-3d;
  transition: all var(--card-transition);
  
  /* Fondo del original */
  background: linear-gradient(135deg,
    rgba(20, 25, 45, 0.95) 0%,
    rgba(25, 30, 50, 0.9) 50%,
    rgba(20, 25, 45, 0.95) 100%);
  
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Borde holográfico animado - IGUAL AL ORIGINAL */
.channel-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg,
    var(--card-primary) 0%,
    var(--card-secondary) 25%,
    var(--card-accent) 50%,
    var(--card-secondary) 75%,
    var(--card-primary) 100%);
  background-size: 400% 400%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
}

/* Capas holográficas de profundidad - IGUAL AL ORIGINAL */
.channel-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: 
    radial-gradient(circle at 30% 30%, rgba(114, 214, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(255, 127, 255, 0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ==================== IMAGEN CON EFECTO HOLOGRÁFICO ==================== */
.channel-card img {
  width: 60px;
  height: 60px;
  min-width: 60px;
  object-fit: cover;
  border-radius: 50%;
  
  /* Sin margin-bottom porque ya no está en column */
  margin-bottom: 0;
  
  border: 3px solid transparent;
  background: linear-gradient(135deg, rgba(114, 214, 255, 0.3), rgba(255, 127, 255, 0.3));
  background-clip: padding-box;
  position: relative;
  transition: all var(--card-transition);
  box-shadow: 
    0 0 30px rgba(114, 214, 255, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
  z-index: 2;
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

/* ==================== TEXTO CON EFECTOS MEJORADOS ==================== */
.channel-card span {
  display: block;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.4;
  text-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(114, 214, 255, 0.3);
  pointer-events: none;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  
  /* CAMBIO: alineación a la izquierda */
  text-align: left;
  flex: 1;
}

/* ==================== BADGES ==================== */
.channel-card .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #ff0844, #ff7f50);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 
    0 0 20px rgba(255, 8, 68, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
  animation: badgePulse 2s ease-in-out infinite;
  z-index: 3;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 8, 68, 0.6); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 8, 68, 0.8); }
}

/* Quality Badge */
.channel-card .quality-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 40, 0.9));
  backdrop-filter: blur(10px);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 3;
}

.quality-badge.hd {
  border-color: var(--card-accent);
  color: var(--card-accent);
}

.quality-badge.full-hd {
  border-color: var(--card-primary);
  color: var(--card-primary);
}

.quality-badge.ultra-hd {
  border-color: gold;
  color: gold;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* ==================== EFECTOS DE HOVER (Desktop) ==================== */
@media (hover: hover) and (pointer: fine) {
  .channel-card:hover {
    /* CAMBIO: translateX en lugar de translateY */
    transform: translateX(8px) scale(1.02);
    box-shadow: 
      0 20px 60px rgba(0, 0, 0, 0.6),
      0 0 60px var(--card-glow),
      inset 0 0 0 2px rgba(114, 214, 255, 0.3);
    background: linear-gradient(135deg,
      rgba(25, 30, 50, 0.9) 0%,
      rgba(30, 35, 55, 0.8) 50%,
      rgba(25, 30, 50, 0.9) 100%);
  }

  .channel-card:hover::before {
    opacity: 1;
    animation: borderFlow 3s linear infinite;
  }

  @keyframes borderFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
  }

  .channel-card:hover::after {
    opacity: 1;
  }

  .channel-card:hover img {
    transform: scale(1.15) rotate(360deg);
    box-shadow: 
      0 0 50px rgba(114, 214, 255, 0.8),
      0 8px 30px rgba(0, 0, 0, 0.5),
      inset 0 0 30px rgba(255, 255, 255, 0.2);
    border-color: var(--card-primary);
  }

  .channel-card:hover span {
    transform: translateY(-2px) scale(1.02);
    color: var(--card-primary);
    text-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.8),
      0 0 30px rgba(114, 214, 255, 0.8);
  }
}

/* ==================== EFECTOS MÓVIL (Touch) ==================== */
@media (hover: none) and (pointer: coarse) {
  .channel-card:active {
    transform: scale(0.98);
    box-shadow: 
      0 4px 20px rgba(0, 0, 0, 0.5),
      inset 0 0 0 2px rgba(114, 214, 255, 0.4);
  }

  .channel-card:active::before {
    opacity: 1;
  }

  .channel-card:active img {
    transform: scale(1.08);
  }
}

/* ==================== CARDS ESPECIALES - PREMIUM ==================== */
.channel-card.premium {
  background: 
    linear-gradient(135deg,
      rgba(255, 215, 0, 0.1) 0%,
      rgba(255, 140, 0, 0.1) 50%,
      rgba(255, 215, 0, 0.1) 100%),
    rgba(30, 35, 55, 0.9);
  border: 2px solid gold;
  box-shadow: 
    0 8px 32px rgba(255, 215, 0, 0.3),
    inset 0 0 30px rgba(255, 215, 0, 0.1);
  animation: premiumPulse 3s ease-in-out infinite;
}

.channel-card.premium::before {
  background: linear-gradient(135deg,
    gold 0%,
    orange 50%,
    gold 100%);
}

/* Corona de premium */
.channel-card.premium .crown {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 1.5rem;
  filter: drop-shadow(0 0 10px gold);
  animation: crownFloat 3s ease-in-out infinite;
  z-index: 20;
}

@keyframes premiumPulse {
  0%, 100% { 
    box-shadow: 
      0 8px 32px rgba(255, 215, 0, 0.3),
      inset 0 0 30px rgba(255, 215, 0, 0.1);
  }
  50% { 
    box-shadow: 
      0 8px 40px rgba(255, 215, 0, 0.5),
      inset 0 0 40px rgba(255, 215, 0, 0.2);
  }
}

@keyframes crownFloat {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-8px); }
}

/* ==================== ANIMACIÓN DE ENTRADA ESCALONADA ==================== */
@media (min-width: 768px) {
  .channel-card {
    animation: cardStaggerIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  }

  .channel-card:nth-child(1) { animation-delay: 0.05s; }
  .channel-card:nth-child(2) { animation-delay: 0.1s; }
  .channel-card:nth-child(3) { animation-delay: 0.15s; }
  .channel-card:nth-child(4) { animation-delay: 0.2s; }
  .channel-card:nth-child(5) { animation-delay: 0.25s; }
  .channel-card:nth-child(6) { animation-delay: 0.3s; }
  .channel-card:nth-child(7) { animation-delay: 0.35s; }
  .channel-card:nth-child(8) { animation-delay: 0.4s; }
  .channel-card:nth-child(n+9) { animation-delay: 0.45s; }
}

@keyframes cardStaggerIn {
  0% {
    opacity: 0;
    transform: translateX(-50px) scale(0.9);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

/* ==================== Card offline ==================== */
.channel-card.offline {
  opacity: 0.5;
  filter: grayscale(0.8);
  pointer-events: none;
}

.channel-card.offline::after {
  content: 'OFFLINE';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: #ff4444;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 2px solid #ff4444;
  z-index: 25;
}

/* LOADING STATE */
.channel-card.loading {
  pointer-events: none;
  opacity: 0.6;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ==================== Loading State Global ==================== */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
  main {
  }

  .channels-section {
  }

  .channel-card {
    padding: 0.75rem;
    min-height: 70px;
  }

  .channel-card img {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .channel-card span {
    font-size: 0.9rem;
  }

  .section-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .channel-card {
    padding: 0.6rem;
    min-height: 65px;
    border-radius: 16px;
  }

  .channel-card img {
    width: 45px;
    height: 45px;
    min-width: 45px;
  }

  .channel-card span {
    font-size: 0.85rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .badge {
    font-size: 0.6rem;
    padding: 3px 8px;
  }

  .quality-badge {
    font-size: 0.6rem;
    padding: 3px 8px;
  }
}

/* ==================== Tabletas y Desktop ==================== */
@media (min-width: 769px) {
  main {
    padding: 2rem;
  }

  .channels-section {
    max-width: 900px;
  }

  .channel-card {
    padding: 1.2rem;
    min-height: 90px;
  }

  .channel-card img {
    width: 70px;
    height: 70px;
    min-width: 70px;
  }

  .channel-card span {
    font-size: 1.05rem;
  }
}

@media (min-width: 1024px) and (hover: hover) {
  .channels-section {
    max-width: 1000px;
  }

  .channel-card {
    min-height: 100px;
  }

  .channel-card img {
    width: 80px;
    height: 80px;
    min-width: 80px;
  }

  .channel-card span {
    font-size: 1.1rem;
  }
}

/* ==================== Accesibilidad ==================== */
.channel-card:focus-visible {
  outline: 3px solid var(--card-primary);
  outline-offset: 3px;
}

/* ==================== Preferencias de Movimiento Reducido ==================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
  }

  .channel-card:hover {
    transform: translateX(4px) scale(1.01);
  }
}

/* ==================== Optimización de Imágenes ==================== */
.channel-card img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

@media (min-width: 1024px) {
  .channel-card img {
    image-rendering: auto;
  }
}

/* ==================== Prevenir Selección No Deseada ==================== */
.channel-card {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.section-title {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ==================== Hardware Acceleration ==================== */
.channel-card {
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

/* ==================== Sin resultados ==================== */
.channels-no-results {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.channels-no-results.active {
  display: block;
}

.no-results-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  opacity: 0.5;
  stroke: var(--card-primary);
}

.no-results-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--card-primary), var(--card-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==================== Skeleton Loading ==================== */
.channel-card.skeleton {
  pointer-events: none;
  background: 
    linear-gradient(90deg,
      rgba(20, 25, 45, 0.8) 25%,
      rgba(30, 35, 55, 0.8) 50%,
      rgba(20, 25, 45, 0.8) 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
}

.channel-card.skeleton * {
  opacity: 0;
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== Fin del CSS ==================== */