/* CreaIPTV — Panel lateral de canales y Menú principal */

/* ── Panel lateral de canales (rediseño "flotante") ──────────
   - Posición absoluta SOBRE el video (no empuja layout).
   - Despegado de los bordes (margen 14px top/right/bottom) para que
     visualmente flote, no esté pegado.
   - Fondo translúcido con blur fuerte → el video se ve detrás difuminado.
   - Borde sutil + sombra para que se sienta "encima" sin ser invasivo.
   - Mismo lenguaje de colores que las pills overlay. */
#channel-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 340px;
  background: rgba(13, 28, 26, 0.55);
  border: 1px solid rgba(232, 245, 242, 0.10);
  border-radius: 18px;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateX(calc(100% + 14px));
  opacity: 0;
  transition: transform 0.32s cubic-bezier(.2, .85, .25, 1),
              opacity   0.22s ease-out;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
}

#channel-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.channel-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(232, 245, 242, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.channel-panel-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.channel-panel-title {
  font-size: 18px; /* TV 10-foot: header del panel legible a distancia */
  font-weight: 700;
  letter-spacing: 0.6px;
  background: linear-gradient(135deg, #6BAAA0, #91C9A8, #C8DE7A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 245, 242, 0.18) transparent;
}
.channel-list::-webkit-scrollbar { width: 6px; }
.channel-list::-webkit-scrollbar-track { background: transparent; }
.channel-list::-webkit-scrollbar-thumb {
  background: rgba(232, 245, 242, 0.18);
  border-radius: 3px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 14px;
  /* Padding amplio: D-pad clicking en TV requiere zona generosa
     (Hick's Law + Fitts's Law: blancos grandes son más rápidos). */
  padding: 14px 18px;
  margin: 2px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
  position: relative;
}

.channel-item:hover {
  background: rgba(107, 170, 160, 0.12);
}

.channel-item.active {
  background: rgba(107, 170, 160, 0.18);
  box-shadow: inset 3px 0 0 var(--crea-teal);
}

.channel-item.focused {
  background: rgba(212, 236, 90, 0.14);
  box-shadow: inset 3px 0 0 var(--accent-focus),
              0 0 0 1px rgba(212, 236, 90, 0.35);
}

.channel-item-number {
  font-size: 16px; /* TV 10-foot: número de canal legible a distancia */
  color: var(--accent-focus);
  font-weight: 700;
  letter-spacing: 0.6px;
  min-width: 32px;
  text-align: center;
  opacity: 0.75;
}
.channel-item.active .channel-item-number,
.channel-item.focused .channel-item-number {
  opacity: 1;
}

.channel-item-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  flex-shrink: 0;
}

.channel-item-name {
  /* TV 10-foot: 18 px mínimo en el control primario (panel de canales).
     Es el elemento que el cliente más interactúa, debe leerse a 3 m. */
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

/* Responsive: en celulares el panel ocupa más ancho proporcional */
@media (max-width: 640px) {
  #channel-panel {
    top: 70px;        /* dejar espacio para el botón menú */
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-width: 340px;
    border-radius: 14px;
  }
}

/* ── Menú principal ──────────────────────────────────── */
#main-menu {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#main-menu.open {
  display: flex;
}

.main-menu-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: 12px;
  padding: 8px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-primary);
  transition: background 0.15s;
  border: none;
  background: transparent;
  font-family: inherit;
  width: 100%;
  text-align: left;
}

.menu-item:hover {
  background: rgba(107, 170, 160, 0.12);
  color: var(--crea-teal);
}

.menu-item.focused {
  background: rgba(212, 236, 90, 0.12);
  color: var(--accent-focus);
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}

.menu-item-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}

/* ── Pantallas de Error ────────────────────────────── */
#screen-error {
  background: var(--bg-primary);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.error-icon {
  font-size: 64px;
  line-height: 1;
}

.error-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-error);
}

.error-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 400px;
}

.error-retry-btn {
  padding: 14px 32px;
  font-size: 18px;
  background: var(--crea-teal);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  margin-top: 8px;
  transition: background 0.15s;
}

.error-retry-btn:hover { background: var(--crea-mint); }
.error-retry-btn.focused {
  outline: 3px solid var(--accent-focus);
  outline-offset: 2px;
}
