<html><head><base href="https://la12hd.com/vivo/canal.php?stream=foxsports">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>NegroTV - Deportes en Vivo</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
    
      body {
          font-family: Arial, sans-serif;
          background: rgba(15, 15, 15, 0.7); /* Color de fondo negro con opacidad */
          color: white;
          display: flex;
          flex-direction: column;
          min-height: 100vh;
      }

      @media (max-width: 768px) { /* Ajusta el tamaño según sea necesario */
          body {
              background-position: bottom right; /* Mueve la imagen a la parte inferior derecha en móviles */
          }
      }
    
      .main-content {
        flex-direction: column;
        max-width: 1280px;
        margin: 0 auto;
        gap: 20px;
        padding: 20px;
      }
    
    
      .container {
        flex: 1;
        padding: 20px 0;
      }
    
      .sidebar {
        width: 100%;
        background: #1a1a1a;
        border-radius: 12px;
        padding: 20px;
        margin-top: 20px;
      }
    
      header {
          background: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); /* Degradado de negro a transparente */
          padding: 10px 0; /* Ajusta el padding para reducir la altura */
          box-shadow: 0 2px 10px rgba(0,0,0,0.3);
          position: sticky;
          top: 0;
          z-index: 100;
      }
    
      h1 {
            text-align: center;
            font-size: clamp(1.5rem, 4vw, 2.5rem);
            background: linear-gradient(45deg, #ff4d4d, #ff0000);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 0 5px #ff4d4d, 0 0 10px #ff4d4d, 0 0 15px #ff0000, 0 0 20px #ff0000;
            margin-top: 1px; /* Ajusta este valor para bajar el título */
            user-select: none; /* Evita que se pueda seleccionar el texto */
            position: relative; /* Necesario para el borde */
            padding: 10px; /* Espacio alrededor del texto */
            border: 5px solid transparent; /* Borde transparente por defecto */
            border-radius: 10px; /* Bordes redondeados */
            animation: neonBorder 1.5s infinite alternate; /* Aplicar la animación */
        }
        
        @keyframes neonBorder {
            0% {
                border-color: #ff4d4d; /* Color inicial */
                box-shadow: 0 0 5px #ff4d4d, 0 0 10px #ff4d4d, 0 0 15px #ff4d4d; /* Resplandor inicial */
            }
            25% {
                border-color: #00ff00; /* Cambia a verde */
                box-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00, 0 0 15px #00ff00; /* Resplandor verde */
            }
            50% {
                border-color: #0000ff; /* Cambia a azul */
                box-shadow: 0 0 5px #0000ff, 0 0 10px #0000ff, 0 0 15px #0000ff; /* Resplandor azul */
            }
            75% {
                border-color: #ff00ff; /* Cambia a magenta */
                box-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff, 0 0 15px #ff00ff; /* Resplandor magenta */
            }
            100% {
                border-color: #ffff00; /* Cambia a amarillo */
                box-shadow: 0 0 5px #ffff00, 0 0 10px #ffff00, 0 0 15px #ffff00; /* Resplandor amarillo */
            }
        }

      .aurora-title {
          font-size: clamp(1.5rem, 4vw, 2.5rem);
          background: linear-gradient(90deg, rgba(255, 0, 150, 1), rgba(0, 204, 255, 1), rgba(255, 0, 150, 1));
          background-size: 300% 100%;
          -webkit-background-clip: text;
          background-clip: text;
          color: transparent;
          animation: aurora 5s ease infinite;
      }

      @keyframes aurora {
          0% { background-position: 0% 50%; }
          50% { background-position: 100% 50%; }
          100% { background-position: 0% 50%; }
      }
      .stream-container {
        margin: 20px auto;
        background: #1a1a1a;
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        max-width: 1280px;
      }
    
      .video-container {
        position: relative;
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
        margin-bottom: 20px;
        border-radius: 12px;
        background: #000;
        transition: all 0.3s ease;
        box-shadow: 0 0 20px rgba(255,0,0,0.1);
      }
    
      .video-container:hover {
        transform: scale(1.01);
        box-shadow: 0 0 30px rgba(255,0,0,0.2);
      }
    
      .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
        background: #000;
        transition: opacity 0.3s ease;
      }
    
      .channel-info {
        background: rgba(255,255,255,0.05);
        padding: 20px;
        border-radius: 12px;
        margin-top: 20px;
        backdrop-filter: blur(10px);
      }
    
      .live-indicator {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        background: linear-gradient(45deg, #ff0000, #ff4d4d);
        border-radius: 20px;
        font-size: 0.8em;
        margin-right: 10px;
        box-shadow: 0 2px 4px rgba(255,0,0,0.2);
      }
    
      .live-indicator::before {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        background: #fff;
        border-radius: 50%;
        margin-right: 6px;
        animation: pulse 1.5s infinite;
      }
    
      @keyframes pulse {
        0% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.2); opacity: 0.5; }
        100% { transform: scale(1); opacity: 1; }
      }
    
      .quality-badge {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        background: linear-gradient(45deg, #007bff, #00a6ff);
        border-radius: 20px;
        font-size: 0.8em;
        box-shadow: 0 2px 4px rgba(0,123,255,0.2);
      }
    
      .channel-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
      }
    
      .channel-item {
          position: relative;
          background: transparent;
          border: 1px solid rgba(255, 255, 255, 0.1);
          transition: all 0.3s ease;
          padding: 15px;
          display: flex;
          align-items: center;
          cursor: pointer;
          color: rgba(255, 255, 255, 0.7);
          border-radius: 8px; /* Bordes redondeados */
          box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Sombra */
      }
    
      .channel-item:hover {
          background: rgba(255, 255, 255, 0.1); /* Color de fondo al pasar el mouse */
          color: rgba(255, 255, 255, 1); /* Color de texto al pasar el mouse */
          transform: scale(1.05); /* Escalado al pasar el mouse */
          box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Sombra más intensa al pasar el mouse */
      }
    
      .channel-item.active {
        background: linear-gradient(145deg, rgba(255,0,0,0.2), rgba(255,0,0,0.1));
        border: 1px solid rgba(255,0,0,0.4);
        box-shadow: 0 0 15px rgba(255,0,0,0.1);
        transform: translateX(10px);
      }
    
      .category-header .flag-icon {
          width: 24px;
          height: auto;
          margin-right: 10px;
          border-radius: 3px;
          box-shadow: 0 1px 3px rgba(0,0,0,0.1);
          transition: transform 0.2s ease;
      }
      .category-header:hover .flag-icon {
          transform: scale(1.1);
      }
      .category-header {
          position: relative;
          background: transparent;
          border: 1px solid rgba(255,255,255,0.1);
          transition: all 0.3s ease;
          padding: 10px;
          display: flex;
          align-items: center;
          cursor: pointer;
          color: rgba(255,255,255,0.7); /* Color de texto suave */
      }

      .category-header::before {
          content: "";
          position: absolute;
          width: 10px;
          height: 2px;
          left: 80%;
          top: -2px;
          border: 2px solid var(--clr);
          background: var(--clr);
          transition: 0.2s;
          opacity: 0;
      }

      .category-header:hover::before {
          opacity: 1;
          width: 20px;
      }

      /* Definir colores para cada región - solo para el efecto de línea */
      .category-header.argentina {
          --clr: #74ACDF;
      }

      .category-header.mexico {
          --clr: #006847;
      }

      .category-header.peru {
          --clr: #FF0000;
      }

      .category-header.chile {
          --clr: #D52B1E;
      }

      .category-header.españa {
          --clr: #AA151B;
      }

      .category-header.mundo {
          --clr: #4A90E2;
      }

      .category-header:hover {
          background: transparent;
          transform: translateX(5px);
      }

      .category-header span {
          transition: color 0.3s ease;
      }

      .category-header:hover span {
          color: var(--clr);
      }

      /* Estilo para la bandera */
      .category-header .flag-icon {
          margin-right: 10px;
          opacity: 0.7;
          transition: opacity 0.3s ease;
      }

      .category-header:hover .flag-icon {
          opacity: 1;
      }.category-header {
          position: relative;
          background: transparent;
          border: 1px solid rgba(255,255,255,0.1);
          transition: all 0.3s ease;
          padding: 10px;
          display: flex;
          align-items: center;
          cursor: pointer;
          color: rgba(255,255,255,0.7); /* Color de texto suave */
      }

      .category-header::before {
          content: "";
          position: absolute;
          width: 10px;
          height: 2px;
          left: 80%;
          top: -2px;
          border: 2px solid var(--clr);
          background: var(--clr);
          transition: 0.2s;
          opacity: 0;
      }

      .category-header:hover::before {
          opacity: 1;
          width: 20px;
      }

      /* Definir colores para cada región - solo para el efecto de línea */
      .category-header.argentina {
          --clr: #74ACDF;
      }

      .category-header.mexico {
          --clr: #006847;
      }

      .category-header.peru {
          --clr: #FF0000;
      }

      .category-header.chile {
          --clr: #D52B1E;
      }

      .category-header.españa {
          --clr: #AA151B;
      }

      .category-header.mundo {
          --clr: #4A90E2;
      }

      .category-header:hover {
          background: transparent;
          transform: translateX(5px);
      }

      .category-header span {
          transition: color 0.3s ease;
      }

      .category-header:hover span {
          color: var(--clr);
      }

      /* Estilo para la bandera */
      .category-header .flag-icon {
          margin-right: 10px;
          opacity: 0.7;
          transition: opacity 0.3s ease;
      }

      .category-header:hover .flag-icon {
          opacity: 1;
      }.category-header {
          position: relative;
          background: transparent;
          border: 1px solid rgba(255,255,255,0.1);
          transition: all 0.3s ease;
          padding: 10px;
          display: flex;
          align-items: center;
          cursor: pointer;
          color: rgba(255,255,255,0.7); /* Color de texto suave */
      }

      .category-header::before {
          content: "";
          position: absolute;
          width: 10px;
          height: 2px;
          left: 80%;
          top: -2px;
          border: 2px solid var(--clr);
          background: var(--clr);
          transition: 0.2s;
          opacity: 0;
      }

      .category-header:hover::before {
          opacity: 1;
          width: 20px;
      }

      /* Definir colores para cada región - solo para el efecto de línea */
      .category-header.argentina {
          --clr: #74ACDF;
      }

      .category-header.mexico {
          --clr: #006847;
      }

      .category-header.peru {
          --clr: #FF0000;
      }

      .category-header.chile {
          --clr: #D52B1E;
      }

      .category-header.españa {
          --clr: #AA151B;
      }

      .category-header.mundo {
          --clr: #4A90E2;
      }

      .category-header:hover {
          background: transparent;
          transform: translateX(5px);
      }

      .category-header span {
          transition: color 0.3s ease;
      }

      .category-header:hover span {
          color: var(--clr);
      }

      /* Estilo para la bandera */
      .category-header .flag-icon {
          margin-right: 10px;
          opacity: 0.7;
          transition: opacity 0.3s ease;
      }

      .category-header:hover .flag-icon {
          opacity: 1;
      }
    
      .category-header svg.arrow {
        transition: transform 0.3s ease;
      }
    
      .category-header.expanded svg.arrow {
        transform: rotate(180deg);
      }
    
      .category-header svg {
        width: 24px;
        height: 24px;
      }
    
      .status-bar {
        background: rgba(0,0,0,0.8);
        padding: 10px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
        font-size: 0.9em;
      }
    
      .status-indicator {
        display: flex;
        align-items: center;
        gap: 8px;
      }
    
      .status-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #00ff00;
        animation: blink 1s infinite;
      }
    
      .status-dot.inactive {
        background: #ff0000;
      }
    
      @keyframes blink {
        50% { opacity: 0.5; }
      }
    
      .popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: linear-gradient(135deg, rgba(0,0,0,0.95) 0%, rgba(20,20,20,0.95) 100%);
        border: 1px solid rgba(255,0,0,0.3);
        box-shadow: 0 0 20px rgba(255,0,0,0.2);
        padding: 20px 30px;
        color: white;
        z-index: 1001;
        display: none;
        animation: popupFade 0.3s ease;
      }
    
      @keyframes popupFade {
        from { opacity: 0; transform: translate(-50%, -60%); }
        to { opacity: 1; transform: translate(-50%, -50%); }
      }
    
      .loading-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.8);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 1000;
      }
    
      .loader {
        width: 50px;
        height: 50px;
        border: 3px solid #ff0000;
        border-radius: 50%;
        border-top-color: transparent;
        animation: spin 1s linear infinite;
      }
    
      .loading-text {
        color: white;
        margin-top: 10px;
        font-size: 14px;
      }
    
      @keyframes spin {
        100% { transform: rotate(360deg); }
      }
    
      .region-container {
      border: 2px solid transparent; /* Borde transparente por defecto */
      border-radius: 8px;
      transition: border-color 0.3s ease, background-color 0.3s ease;
      }
      
      .region-container.active {
      background-color: rgba(0, 0, 0, 0.5); /* Color de fondo al seleccionar */
      }

      .region-container.argentina {
        border-color: #74ACDF; /* Color de borde para Argentina */
      }

      .region-container.peru {
        border-color: #FF0000; /* Color de borde para Perú */
      }

      .category-header.mexico {
          background: linear-gradient(45deg, #006847, #004d3a); /* Verde */
      }


      .channels-container {
        padding: 10px 0;
      }

      #ipAddress {
          color:#00ff00;
          text-shadow:
              0 0 5px #00FF00,   /* Resplandor suave */
              0 0 10px #00FF00,  /* Resplandor más fuerte */
              0 0 15px #00FF00,  /* Resplandor aún más fuerte */
              0 0 20px #00FF00;    
      }
    </style>
    </head>
    <body>
      <div class="status-bar">
        <div class="status-indicator">
          <div class="status-dot" id="statusDot"></div>
          <span id="statusText">TAMO ACTIVO</span>
        </div>
        <div id="ipAddress">IP: Cargando...</div>
      </div>
    
      <div class="popup" id="popup">
        <h3>¡No!</h3>
      </div>
    
      <header>
        <div class="container">
          <h1 class="aurora-title">📺 NegroTV</h1>
        </div>
      </header>
    
      <div class="main-content">
        <div class="container">
          <div class="stream-container">
            <div class="video-container">
              <iframe 
                id="streamFrame"
                src="https://la12hd.com/vivo/canal.php?stream=foxsports" 
                allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
                allowfullscreen>
              </iframe>
            </div>
            
            <div class="channel-info">
              <span class="live-indicator">EN VIVO</span>
              <span class="quality-badge">FULL HD</span>
              <h2 id="channelTitle">Fox Sports</h2>
              <p>NegroTV es Exclusivo para miembros autorizados,Comparte la experiencia, no el acceso."</p>
            </div>
          </div>
        </div>
    
        <div class="sidebar" id="channelList">
          <!-- Channel list will be populated by JavaScript -->
        </div>
        
    </div>
        
      </div>
      
      <script>
        
        async function getIPAddress() {
            try {
                const response = await fetch('https://api.ipify.org?format=json');
                const data = await response.json();
                const deviceInfo = getDeviceInfo();
                document.getElementById('ipAddress').textContent = `IP: ${data.ip} - Dispositivo: ${deviceInfo}`;
            } catch (error) {
                document.getElementById('ipAddress').textContent = 'IP: No disponible - Dispositivo: Desconocido';
            }
        }
      </script>
      <script>
          function changeVideo(url) {
              const videoFrame = document.getElementById('videoFrame');
              if (url.includes('youtube.com')) {
                  // Para YouTube
                  videoFrame.src = url.replace('watch?v=', 'embed/'); // Cambia el enlace de YouTube a formato embed
              } else if (url.includes('twitch.tv')) {
                  // Para Twitch
                  videoFrame.src = url;
              } else {
                  console.error('URL no soportada');
              }
          }
      </script>
      <script>
        const channels = {
          "DEPORTES": {
            "channels": [
                {"name": "Sky Bundesliga 1", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga1", "status": "Activo"},
                {"name": "Sky Bundesliga 2", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga2", "status": "Activo"},
                {"name": "Sky Bundesliga 3", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga3", "status": "Activo"},
                {"name": "Sky Bundesliga 4", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga4", "status": "Activo"},
                {"name": "Sky Bundesliga 5", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga5", "status": "Activo"},
                {"name": "DAZN 1 DE", "link": "https://la12hd.com/vivo/canal.php?stream=dazn1_de", "status": "Activo"},
                {"name": "DAZN 2 DE", "link": "https://la12hd.com/vivo/canal.php?stream=dazn2_de", "status": "Activo"},
                {"name": "ESPN 1 NL", "link": "https://la12hd.com/vivo/canal.php?stream=espn1_nl", "status": "Activo"},
                {"name": "ESPN 2 NL", "link": "https://la12hd.com/vivo/canal.php?stream=espn2_nl", "status": "Activo"},
                {"name": "ESPN 3 NL", "link": "https://la12hd.com/vivo/canal.php?stream=espn3_nl", "status": "Activo"},
                {"name": "ESPN 4 NL", "link": "https://streamtp2.com/global2.php?stream=espn4", "status": "Activo"},
                {"name": "ESPN 5 NL", "link": "https://nebunexa.co/red/?get=https://la12hd.com/vivo/canal.php?stream=espn5", "status": "Activo"},
                {"name": "ESPN 6 NL", "link": "https://la12hd.com/vivo/canal.php?stream=espn6", "status": "Activo"},
                {"name": "ESPN 6 ALTERNATIVA", "link": "https://streamtp2.com/global2.php?stream=espn6", "status": "Activo"},
                {"name": "ESPN 7 NL", "link": "https://la12hd.com/vivo/canal.php?stream=espn3_nl", "status": "Activo"},
                {"name": "Dazn Eleven Pro 1 BE", "link": "https://la12hd.com/vivo/canal.php?stream=elevenpro1_be", "status": "Activo"},
                {"name": "Dazn Eleven Pro 2 BE", "link": "https://la12hd.com/vivo/canal.php?stream=elevenpro2_be", "status": "Activo"},
                
            ]
        },
          "ARGENTINA": {
            "channels": [
              {"name": "Fox Sports", "link": "https://la12hd.com/vivo/canal.php?stream=foxsports", "status": "Activo"},
              {"name": "Fox Sports 2", "link": "https://la12hd.com/vivo/canal.php?stream=foxsports2", "status": "Activo"},
              {"name": "Fox Sports 3", "link": "https://la12hd.com/vivo/canal.php?stream=foxsports3", "status": "Activo"},
              {"name": "TNT Sports", "link": "https://la12hd.com/vivo/canal.php?stream=tntsports", "status": "Activo"},
              {"name": "ESPN Premium", "link": "https://la12hd.com/vivo/canal.php?stream=espnpremium", "status": "Activo"},
              {"name": "TyC Sports", "link": "https://la12hd.com/vivo/canal.php?stream=tycsports", "status": "Activo"},
              {"name": "TyC Sports Internacional (USA)", "link": "https://la12hd.com/vivo/canal.php?stream=tycinternacional", "status": "Activo"},
              {"name": "Telefe", "link": "https://la12hd.com/vivo/canal.php?stream=telefe", "status": "Activo"},
              {"name": "TV Pública", "link": "https://la12hd.com/vivo/canal.php?stream=tvpublica", "status": "Activo"},
              {"name": "DSports 2", "link": "https://la12hd.com/vivo/canal.php?stream=dsports2", "status": "Activo"},
              {"name": "Telefe Cordoba", "link": "https://nebunexa.co/telefe.html", "status": "Activo"},
              {"name": "Cronica TV", "link": "https://tvlibreonline.net/html/fl/?get=Q3JvbmljYVRW", "status": "Activo"},
              {"name": "DSports", "link": "https://streamtp2.com/global2.php?stream=dsports", "status": "Activo"},
              {"name": "Unife TV", "link": "https://constantestimulo.mycloudstream.io/player/pgv5kerk", "status": "Activo"},
              
            ]
          },
          "PERÚ": {
            "channels": [
              {"name": "GOLPERU", "link": "https://la12hd.com/vivo/canal.php?stream=golperu", "status": "Activo"},
              {"name": "Liga1 MAX", "link": "https://la12hd.com/vivo/canal.php?stream=liga1max", "status": "Activo"},
              {"name": "Movistar Deportes", "link": "https://la12hd.com/vivo/canal.php?stream=movistar", "status": "Activo"}
            ]
          },
          "MÉXICO": {
            "channels": [
                {"name": "Fox Sports", "link": "https://la12hd.com/vivo/canal.php?stream=foxsportsmx", "status": "Activo"},
                {"name": "Fox Sports 2", "link": "https://la12hd.com/vivo/canal.php?stream=foxsports2mx", "status": "Activo"},
                {"name": "Fox Sports 3", "link": "https://la12hd.com/vivo/canal.php?stream=foxsports3mx", "status": "Activo"},
                {"name": "Fox Sports Premium", "link": "https://la12hd.com/vivo/canal.php?stream=foxsportspremium", "status": "Activo"},
                {"name": "TUDN", "link": "https://la12hd.com/vivo/canal.php?stream=tudn_mx", "status": "Activo"},
                {"name": "ESPN", "link": "https://la12hd.com/vivo/canal.php?stream=espnmx", "status": "Activo"},
                {"name": "ESPN 2", "link": "https://la12hd.com/vivo/canal.php?stream=espn2mx", "status": "Activo"},
                {"name": "ESPN 3", "link": "https://la12hd.com/vivo/canal.php?stream=espn3mx", "status": "Activo"},
                {"name": "Caliente TV", "link": "https://la12hd.com/vivo/canal.php?stream=calientetv", "status": "Activo"},
                {"name": "Azteca 7", "link": "https://la12hd.com/vivo/canal.php?stream=azteca7", "status": "Activo"},
                {"name": "Canal 5", "link": "https://la12hd.com/vivo/canal.php?stream=canal5", "status": "Activo"},
                {"name": "TVC Deportes", "link": "https://la12hd.com/vivo/canal.php?stream=tvc_deportes", "status": "Activo"},
                {"name": "Azteca Deportes", "link": "https://la12hd.com/vivo/canal.php?stream=azteca_deportes", "status": "Activo"},
                {"name": "Hisports", "link": "https://la12hd.com/vivo/canal.php?stream=hisports", "status": "Activo"},
                {"name": "Sky Sports LaLiga", "link": "https://la12hd.com/vivo/canal.php?stream=sky_sports_laliga", "status": "Activo"},
                {"name": "Sky Sports Bundesliga", "link": "https://la12hd.com/vivo/canal.php?stream=sky_bundesliga_mx", "status": "Activo"}
            ]
        },
        "CHILE": {
            "channels": [
                {"name": "TNT Sports Chile", "link": "https://la12hd.com/vivo/canal.php?stream=tntsportschile", "status": "Activo"}
            ]
        },
        "ESPAÑA": {
            "channels": [
                {"name": "DAZN 1", "link": "https://la12hd.com/vivo/canal.php?stream=dazn1", "status": "Activo"},
                {"name": "DAZN 2", "link": "https://la12hd.com/vivo/canal.php?stream=dazn2", "status": "Activo"},
                {"name": "DAZN 3 (eventos)", "link": "https://la12hd.com/vivo/canal.php?stream=dazn3", "status": "Activo"},
                {"name": "DAZN 4 (eventos)", "link": "https://la12hd.com/vivo/canal.php?stream=dazn4", "status": "Activo"},
                {"name": "DAZN LaLiga", "link": "https://la12hd.com/vivo/canal.php?stream=dazn_laliga", "status": "Activo"},
                {"name": "La 1 TVE", "link": "https://la12hd.com/vivo/canal.php?stream=la1tve", "status": "Activo"},
                {"name": "Liga de Campeones 1", "link": "https://la12hd.com/vivo/canal.php?stream=ligadecampeones1", "status": "Activo"},
                {"name": "Liga de Campeones 2", "link": "https://la12hd.com/vivo/canal.php?stream=ligadecampeones2", "status": "Activo"},
                {"name": "Liga de Campeones 3", "link": "https://la12hd.com/vivo/canal.php?stream=ligadecampeones3", "status": "Activo"},
                {"name": "M+ LaLiga TV", "link": "https://la12hd.com/vivo/canal.php?stream=m_laligatv", "status": "Activo"},
                {"name": "LaLigaTV BAR", "link": "https://la12hd.com/vivo/canal.php?stream=laligatvbar", "status": "Activo"}
              ]
        },
        "Dibujos": {
            "channels": [
                {"name": "Adult Swim", "link": "https://nebunexa.co/canal/?id=ADULT_SWIM", "status": "Activo"},
                {"name": "Cartoon Network", "link": "https://tvlibreonline.net/html/fl/?get=Q2FydG9vbk5ldHdvcms=", "status": "Activo"},
                {"name": "DisneyJR", "link": "https://nebunexa.co/red/?get=https://embed.sdfgnksbounce.com/embed2/disneyjr.html", "status": "Activo"},
                
                {"name": "Nickelodion", "link": "https://nebunexa.co/red/?get=https://embed.sdfgnksbounce.com/embed2/nick.html", "status": "Activo"},
            ]
        },
        };
    
        function loadChannelList() {
          const channelList = document.getElementById('channelList');
          channelList.innerHTML = '';
          
          Object.keys(channels).forEach(region => {
              const regionContainer = document.createElement('div');
              regionContainer.className = 'region-container';
              
              const regionHeader = document.createElement('div');
              regionHeader.className = `category-header ${region.toLowerCase()}`;

              const flagMap = {
                  "MUNDO": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/un.svg",     // Bandera de Naciones Unidas
                  "ARGENTINA": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/ar.svg", 
                  "MÉXICO": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/mx.svg", // Corregido de pe.svg a mx.svg
                  "PERÚ": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/pe.svg", 
                  "CHILE": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/cl.svg", 
                  "ESPAÑA": "https://raw.githubusercontent.com/lipis/flag-icons/main/flags/4x3/es.svg",
              };

              regionHeader.innerHTML = `
                  <img 
                      src="${flagMap[region] || flagMap["MUNDO"]}" 
                      alt="${region} Flag" 
                      class="flag-icon" 
                      style="width: 24px; height: auto; margin-right: 10px; border-radius: 3px; object-fit: cover;"
                  >
                  <span>${region}</span>
                  <svg class="arrow" style="margin-left: auto" width="20" height="20" viewBox="0 0 24 24">
                      <path fill="currentColor" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/>
                  </svg>
              `;
            
            const channelsContainer = document.createElement('div');
            channelsContainer.className = 'channels-container';
            channelsContainer.style.display = 'none';
            
            regionHeader.onclick = () => {
              const isExpanded = channelsContainer.style.display !== 'none';
              channelsContainer.style.display = isExpanded ? 'none' : 'block';
              regionHeader.classList.toggle('expanded', !isExpanded);
            };
            
            channels[region].channels.forEach(channel => {
                const channelItem = document.createElement('div');
                channelItem.className = 'channel-item';
                channelItem.dataset.channelLink = channel.link;
                
                const channelImage = channel.image ? `<img src="${channel.image}" alt="${channel.name}" style="width: 50px; height: auto; border-radius: 5px; margin-right: 10px;">` : '';

              
                channelItem.innerHTML = `
                    <div class="channel-icon">
                        ${channelImage}
                        <svg viewBox="0 0 24 24" width="24" height="24">
                            <path fill="currentColor" d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14z"/>
                            <path fill="currentColor" d="M10 8.64L15.27 12 10 15.36V8.64z"/>
                        </svg>
                    </div>
                    <div>
                        <strong>${channel.name}</strong>
                        <div style="font-size: 0.8em; color: #00ff00;">${channel.status}</div>
                    </div>
                `;
              
                channelItem.onclick = () => {
                    // Remove active class from all channels
                    document.querySelectorAll('.channel-item').forEach(item => {
                        item.classList.remove('active');
                    });
                    // Add active class to clicked channel
                    channelItem.classList.add('active');
                    changeChannel(channel);
                };
              
              // Set active if this is the current channel
              const currentSrc = document.getElementById('streamFrame').src;
              if (currentSrc === channel.link) {
                  channelItem.classList.add('active');
              }
              
              channelsContainer.appendChild(channelItem);
          });
            
            regionContainer.appendChild(regionHeader);
            regionContainer.appendChild(channelsContainer);
            channelList.appendChild(regionContainer);
          });
        }
    
        function changeChannel(channel) {
          const streamFrame = document.getElementById('streamFrame');
          const channelTitle = document.getElementById('channelTitle');
          
          streamFrame.src = channel.link;
          channelTitle.textContent = channel.name;
          
          // Add transition effect
          streamFrame.style.opacity = '0';
          setTimeout(() => {
            streamFrame.style.opacity = '1';
          }, 300);
        }
    
        function keepAlive() {
          const iframe = document.querySelector('iframe');
          if (iframe) {
            iframe.src = iframe.src;
          }
        }
    
        setInterval(keepAlive, 7200000);
    
        document.querySelector('iframe').onerror = function() {
          alert('Error al cargar la transmisión. Por favor, recarga la página.');
        };
    
        document.addEventListener('DOMContentLoaded', () => {
          const streamFrame = document.getElementById('streamFrame');
          
          // Remove pointer-events none to allow interaction with iframe content
          streamFrame.style.pointerEvents = 'auto';
          
          // Add loading state
          streamFrame.addEventListener('loading', () => {
            showLoadingIndicator();
          });
    
          streamFrame.addEventListener('load', () => {
            hideLoadingIndicator();
          });
        });
    
        function showLoadingIndicator() {
          const loadingOverlay = document.createElement('div');
          loadingOverlay.className = 'loading-overlay';
          loadingOverlay.innerHTML = `
            <div class="loader"></div>
            <div class="loading-text">Cargando transmisión...</div>
          `;
          document.querySelector('.video-container').appendChild(loadingOverlay);
        }
    
        function hideLoadingIndicator() {
          const overlay = document.querySelector('.loading-overlay');
          if (overlay) {
            overlay.remove();
          }
        }
    
        function blockAds() {
          const streamFrame = document.getElementById('streamFrame');
          
          // Create MutationObserver to watch for ad iframes
          const observer = new MutationObserver((mutations) => {
            mutations.forEach((mutation) => {
              if (mutation.addedNodes) {
                mutation.addedNodes.forEach((node) => {
                  if (node.nodeName === 'IFRAME' && node.src.includes('ad')) {
                    node.remove();
                    showPopup('Anuncio bloqueado');
                  }
                });
              }
            });
          });
    
          // Start observing
          observer.observe(streamFrame.contentDocument || streamFrame.contentWindow.document, {
            childList: true,
            subtree: true
          });
        }
    
        window.onload = () => {
          loadChannelList();
          getIPAddress();
          updateStatus();
        };
    
        let isPageActive = true;
    
        document.addEventListener('visibilitychange', () => {
          isPageActive = !document.hidden;
          updateStatus();
        });
    
        function updateStatus() {
          const statusDot = document.getElementById('statusDot');
          const statusText = document.getElementById('statusText');
          
          if (isPageActive) {
            statusDot.classList.remove('inactive');
            statusText.textContent = 'ACTIVO';
          } else {
            statusDot.classList.add('inactive');
            statusText.textContent = 'Activo';
          }
        }
    
        async function getIPAddress() {
          try {
            const response = await fetch('https://api.ipify.org?format=json');
            const data = await response.json();
            document.getElementById('ipAddress').textContent = `IP: ${data.ip}`;
          } catch (error) {
            document.getElementById('ipAddress').textContent = 'IP: No disponible';
          }
        }
    
        window.addEventListener('beforeunload', (event) => {
          const popup = document.getElementById('popup');
          popup.style.display = 'block';
          setTimeout(() => popup.style.display = 'none', 2000);
          
          event.preventDefault();
          event.returnValue = '';
        });
    
        document.addEventListener('contextmenu', (e) => {
          e.preventDefault();
          const popup = document.getElementById('popup');
          popup.style.display = 'block';
          setTimeout(() => popup.style.display = 'none', 2000);
        });
    
        document.addEventListener('click', (e) => {
          if (e.ctrlKey || e.button === 1) {
            e.preventDefault();
            const popup = document.getElementById('popup');
            popup.style.display = 'block';
            setTimeout(() => popup.style.display = 'none', 2000);
          }
        });
    
        document.addEventListener('keydown', (e) => {
          if (
            (e.ctrlKey && (e.key === 'u' || e.key === 's' || e.key === 'p')) ||
            (e.altKey && e.key === 'Enter') ||
            e.key === 'F12'
          ) {
            preventNavigation(e);
          }
        });
    
        function preventNavigation(e) {
          e.preventDefault();
          showPopup('Acción no permitida');
          return false;
        }
    
        let connectionCheck = setInterval(() => {
          if (!navigator.onLine) {
            showPopup('Conexión perdida. Reconectando...');
            updateStatus();
          }
        }, 5000);
      </script>
    </body>
    </html>