/* ===== Reset y variables ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  :root {
    --bg: #0a0a0f;
    --panel-bg: rgba(12, 12, 18, 0.95);
    --accent: #00d4ff;
    --accent-hover: #00b8e0;
    --text: #e8e8ef;
    --text-muted: #9a9aad;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  
  /* ===== Layout principal ===== */
  #app {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
  }
  
  /* ===== Reproductor (ocupa el 100% disponible) ===== */
  #player-container {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
  }
  
  #video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
  }
  
  /* ===== Overlay de controles ===== */
  #controls-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.75) 100%);
    opacity: 1;
    transition: opacity 0.4s ease;
    pointer-events: none;
  }
  
  #controls-overlay.hidden {
    opacity: 0;
  }
  
  #controls-overlay .controls-bar,
  #controls-overlay #now-playing {
    pointer-events: auto;
  }
  
  .controls-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px 24px;
  }
  
  .ctrl-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
  }
  
  .ctrl-btn:hover {
    background: rgba(0, 212, 255, 0.35);
    transform: scale(1.08);
  }
  
  .ctrl-btn svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
  }
  
  /* Volumen */
  .volume-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
  }
  
  #volume-slider {
    width: 90px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
  }
  
  #volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
  }
  
  /* Nombre del canal actual */
  #now-playing {
    text-align: center;
    padding-bottom: 18px;
    font-size: 1.05rem;
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    letter-spacing: 0.3px;
  }
  
  /* Botón para abrir lista */
  #btn-toggle-list {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: var(--transition);
  }
  
  #btn-toggle-list:hover {
    background: rgba(0, 212, 255, 0.4);
  }
  
  #btn-toggle-list svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
  }
  
  /* ===== Panel de canales (derecha) ===== */
  #playlist-panel {
    width: 340px;
    max-width: 90vw;
    height: 100%;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    position: absolute;
    right: 0;
    top: 0;
  }
  
  #playlist-panel.open {
    transform: translateX(0);
  }
  
  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
  }
  
  .panel-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.4px;
  }
  
  #btn-close-panel {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    transition: color 0.2s;
  }
  
  #btn-close-panel:hover {
    color: white;
  }
  
  .search-box {
    padding: 12px 16px;
  }
  
  #search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
  }
  
  #search-input:focus {
    border-color: var(--accent);
  }
  
  #search-input::placeholder {
    color: var(--text-muted);
  }
  
  /* Lista de canales */
  #channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
  }
  
  #channel-list::-webkit-scrollbar {
    width: 6px;
  }
  
  #channel-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
  }
  
  .channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
  }
  
  .channel-item:hover {
    background: rgba(255, 255, 255, 0.07);
  }
  
  .channel-item.active {
    background: rgba(0, 212, 255, 0.18);
    border: 1px solid rgba(0, 212, 255, 0.35);
  }
  
  .channel-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
  }
  
  .channel-info {
    flex: 1;
    min-width: 0;
  }
  
  .channel-title {
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .channel-group {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
  }
  
  /* ===== Responsive ===== */
  @media (max-width: 768px) {
    #playlist-panel {
      width: 100%;
      max-width: 100%;
    }
  
    .controls-bar {
      gap: 8px;
      padding: 12px 12px 20px;
    }
  
    .ctrl-btn {
      width: 44px;
      height: 44px;
    }
  
    #volume-slider {
      width: 70px;
    }
  }
  
  @media (max-width: 480px) {
    .volume-group {
      display: none; /* en móviles muy pequeños se oculta el slider */
    }
  }
  
  /* Estado de carga */
  .loading-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
  }