/* ==========================================================================
   TDT ESPAÑA - HOJA DE ESTILOS CSS
   Tema: Premium Dark / Glassmorphism / Diseño Fijo 2 Columnas / Grabador MP4
   ========================================================================== */

:root {
  --bg-main: #0b0c10;
  --bg-surface: #131620;
  --bg-surface-elevated: #1c2130;
  --bg-surface-hover: #262d40;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-live: #ef4444;
  --accent-rec: #e11d48;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.3);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar estilizada */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   HEADER / NAVBAR SUPERIOR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(11, 12, 16, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4));
}
.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
}

.view-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}
.tab-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}
.rec-nav-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-rec);
  border-radius: 50%;
  animation: pulse-dot 1.2s infinite;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-accent);
}

/* ==========================================================================
   MAIN CONTENT & VISTAS
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 16px 20px;
  max-width: 1780px;
  margin: 0 auto;
  width: 100%;
}
.view-section {
  display: none;
}
.view-section.active {
  display: block;
}

/* ==========================================================================
   LAYOUT EN 2 COLUMNAS (IZQUIERDA FIJA / DERECHA LISTA)
   ========================================================================== */
.two-columns-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* COLUMNA IZQUIERDA (REPRODUCTOR FIJO / STICKY) */
.player-left-col {
  flex: 0 0 540px;
  max-width: 580px;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

/* COLUMNA DERECHA (BUSCADOR, FILTROS Y CANALES) */
.channels-right-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   REPRODUCTOR DE VÍDEO
   ========================================================================== */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-subtle);
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* OVERLAYS DEL REPRODUCTOR */
.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 10;
  text-align: center;
  padding: 20px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-box {
  background: var(--bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 20px;
  border-radius: var(--radius-md);
  max-width: 340px;
}
.error-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

/* OSD SUPERIOR */
.player-osd-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  z-index: 5;
  transition: opacity 0.3s ease;
}
.osd-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.osd-logo {
  height: 32px;
  max-width: 60px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.osd-channel-info h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.osd-program-title {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.osd-badges-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.osd-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.live-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-live);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.rec-live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(225, 29, 72, 0.25);
  color: #fda4af;
  border: 1px solid rgba(225, 29, 72, 0.6);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.rec-dot-pulse {
  width: 7px;
  height: 7px;
  background: var(--accent-rec);
  border-radius: 50%;
  animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* OSD INFERIOR Y CONTROLES */
.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 16px 12px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0) 100%);
  z-index: 5;
  transition: opacity 0.3s ease;
}

.program-progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.4s ease;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.06);
}
#playBtn {
  width: 36px;
  height: 36px;
  background: var(--accent-primary);
  font-size: 15px;
}
#playBtn:hover {
  background: var(--accent-primary-hover);
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 6px;
}
.volume-container input[type="range"] {
  width: 60px;
  height: 4px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.quality-select {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}
.quality-select option {
  background: var(--bg-surface);
  color: #fff;
}

.channel-badge {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.video-container.controls-hidden .player-osd-top,
.video-container.controls-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   BARRA DE GRABACIÓN MANUAL (.MP4)
   ========================================================================== */
.recording-control-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.rec-idle-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-rec-start {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.3);
  transition: all 0.2s ease;
}
.btn-rec-start:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
}
.rec-circle {
  width: 9px;
  height: 9px;
  background: #fff;
  border-radius: 50%;
}

.rec-action-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-dur-label {
  font-size: 12px;
  color: var(--text-muted);
}
.rec-dur-select {
  padding: 6px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.rec-dur-select option {
  background: var(--bg-surface-elevated);
}

/* ESTADO ACTIVO: GRABANDO */
.rec-active-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.rec-active-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.rec-pulse-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-rec);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.rec-active-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rec-show-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.rec-meta-info {
  font-size: 11px;
  color: #fda4af;
  font-family: monospace;
}
.btn-rec-stop {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #334155;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-rec-stop:hover {
  background: #475569;
  border-color: #fff;
}

/* ==========================================================================
   PANEL NOW PLAYING (DEBAJO DEL VÍDEO)
   ========================================================================== */
.now-playing-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.np-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.np-logo {
  height: 38px;
  max-width: 70px;
  object-fit: contain;
}
.np-left h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}
.np-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.np-cat {
  font-size: 11px;
  color: var(--text-muted);
}
.np-dist {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-radius: var(--radius-sm);
}
.np-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-fav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-fav:hover {
  background: rgba(245, 158, 11, 0.2);
}
.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-accent);
}

.np-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.np-show {
  display: flex;
  gap: 10px;
  background: var(--bg-surface-elevated);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.np-show-tag {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  height: fit-content;
  border-radius: 4px;
}
.current-show .np-show-tag {
  background: var(--accent-live);
  color: #fff;
}
.next-show .np-show-tag {
  background: #334155;
  color: var(--text-muted);
}
.np-show-content {
  flex: 1;
  min-width: 0;
}
.np-show-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-show-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.np-show-desc {
  font-size: 12px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.np-show-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-inline-rec, .btn-inline-schedule {
  padding: 4px 10px;
  background: rgba(225, 29, 72, 0.15);
  color: #fda4af;
  border: 1px solid rgba(225, 29, 72, 0.3);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-inline-rec:hover {
  background: rgba(225, 29, 72, 0.3);
}
.btn-inline-schedule {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}
.btn-inline-schedule:hover {
  background: rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   PANEL SUPERIOR DE FILTROS Y BÚSQUEDA (COLUMNA DERECHA)
   ========================================================================== */
.channels-filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* BUSCADOR PRINCIPAL */
.search-box-main {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-box-main .search-icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-box-main input {
  width: 100%;
  padding: 10px 38px 10px 42px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}
.search-box-main input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-box-main .clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
}

/* FILTROS POR TIPO Y DISTRIBUIDORA */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
}
.filter-pills-row::-webkit-scrollbar {
  height: 4px;
}

.cat-pill, .dist-pill {
  padding: 5px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-pill:hover, .dist-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}
.cat-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
}
.dist-pill.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-secondary);
  color: #fff;
  font-weight: 600;
}
.fav-pill {
  border-color: rgba(245, 158, 11, 0.3);
}
.fav-pill.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: #fbbf24;
}

/* BARRA DE ORDENACIÓN Y CONTADOR */
.sort-counter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}
.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.styled-select-sm {
  padding: 5px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.styled-select-sm option {
  background: var(--bg-surface-elevated);
  color: #fff;
}
.channels-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   REJILLA DE TARJETAS DE CANALES
   ========================================================================== */
.channels-grid-container {
  width: 100%;
}
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.channel-card:hover {
  transform: translateY(-2px);
  background: var(--bg-surface-elevated);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
}
.channel-card.active {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, var(--bg-surface-elevated) 100%);
  box-shadow: var(--shadow-glow);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.card-logo {
  height: 28px;
  max-width: 50px;
  object-fit: contain;
}
.card-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.card-badges-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.card-group {
  font-size: 10.5px;
  color: var(--text-dim);
}
.card-dist-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border-radius: 3px;
}

.card-actions-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.card-star {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}
.card-star:hover, .card-star.active {
  color: var(--accent-gold);
}

/* INFORMACIÓN EPG EN LA TARJETA */
.card-epg {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}
.card-show-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.card-show-time {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.card-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  background: var(--accent-primary);
}

/* ==========================================================================
   VISTA 2: GUÍA DE PROGRAMACIÓN (EPG)
   ========================================================================== */
.epg-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.epg-title-group h2 {
  font-size: 20px;
  font-weight: 700;
}
.epg-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}
.epg-controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}
.date-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}
.date-btn.active {
  background: var(--accent-primary);
  color: #fff;
}
.styled-select {
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.styled-select option {
  background: var(--bg-surface);
}

.epg-timeline-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.epg-channels-list {
  display: flex;
  flex-direction: column;
}
.epg-row {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 70px;
}
.epg-row:last-child {
  border-bottom: none;
}
.epg-ch-col {
  width: 180px;
  flex-shrink: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(19, 22, 32, 0.95);
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  left: 0;
  z-index: 2;
  cursor: pointer;
}
.epg-ch-col:hover {
  background: var(--bg-surface-elevated);
}
.epg-ch-logo {
  height: 24px;
  max-width: 44px;
  object-fit: contain;
}
.epg-ch-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.epg-shows-strip {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  align-items: center;
}
.epg-show-item {
  flex-shrink: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 140px;
  max-width: 220px;
}
.epg-show-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}
.epg-show-item.live {
  border-color: var(--accent-live);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, var(--bg-surface-elevated) 100%);
}
.epg-item-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.epg-item-time {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   VISTA 3: MIS GRABACIONES (.MP4)
   ========================================================================== */
.recordings-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.recordings-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}
.recordings-header-bar h2 {
  font-size: 20px;
  font-weight: 700;
}
.recordings-header-bar p {
  font-size: 13px;
  color: var(--text-muted);
}

.recordings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rec-sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-sec-title h3 {
  font-size: 16px;
  font-weight: 700;
}
.rec-lib-count {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* CARDS DE GRABACIÓN ACTIVA */
.active-recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.active-rec-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.active-rec-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.active-rec-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.active-rec-channel {
  font-size: 12px;
  color: var(--text-muted);
}
.active-rec-meta {
  font-size: 11.5px;
  font-family: monospace;
  color: #fda4af;
  margin-top: 4px;
}

/* LISTA DE PROGRAMADAS */
.scheduled-recs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scheduled-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}
.sched-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sched-icon {
  font-size: 20px;
}
.sched-title {
  font-size: 13.5px;
  font-weight: 700;
}
.sched-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}
.btn-sched-cancel {
  padding: 5px 12px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-sched-cancel:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* BIBLIOTECA DE ARCHIVOS .MP4 */
.library-recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.library-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}
.library-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
}
.lib-card-top {
  display: flex;
  gap: 10px;
  min-width: 0;
}
.lib-card-icon {
  font-size: 24px;
}
.lib-card-text {
  min-width: 0;
}
.lib-card-title {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.lib-card-date {
  font-size: 11px;
  color: var(--text-muted);
}
.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
.lib-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}
.btn-lib-play {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-lib-play:hover {
  background: var(--accent-primary-hover);
}
.btn-lib-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}
.btn-lib-dl:hover {
  background: var(--bg-surface-hover);
}
.btn-lib-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  color: #f87171;
  font-size: 13px;
  cursor: pointer;
}
.btn-lib-del:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   MODAL DE DETALLES Y GRABACIÓN DE PROGRAMA
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
}
.modal-poster-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}
.modal-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-poster-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(19, 22, 32, 0) 30%, var(--bg-surface) 100%);
}
.modal-body {
  padding: 22px 24px;
}
.modal-channel-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.modal-ch-logo {
  height: 24px;
  max-width: 44px;
  object-fit: contain;
}
.modal-ch-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.live-pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-live);
  margin-left: 6px;
}
.modal-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}
.modal-meta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.meta-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.genre-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}
.modal-progress {
  width: 100%;
  margin-bottom: 14px;
}
.modal-progress-fill {
  height: 4px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}
.modal-progress-text {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
.modal-section {
  margin-bottom: 14px;
}
.modal-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.modal-cast {
  font-size: 12.5px;
  color: var(--text-muted);
}
.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.btn-primary-large {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary-large:hover {
  background: var(--accent-primary-hover);
}
.btn-rec-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-rec-modal:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

/* MODAL M3U */
.modal-m3u {
  max-width: 480px;
  text-align: center;
}
.m3u-header-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.modal-m3u h2 {
  font-size: 18px;
  margin-bottom: 8px;
}
.modal-m3u p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.m3u-input-group {
  text-align: left;
  margin-bottom: 14px;
}
.m3u-input-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.copy-box {
  display: flex;
  gap: 8px;
}
.copy-box input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
}
.btn-copy {
  padding: 8px 16px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.m3u-tips {
  text-align: left;
  background: var(--bg-surface-elevated);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}

/* ==========================================================================
   TOAST FLOTANTE
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-accent);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ==========================================================================
   PANTALLA DE LOGON (CONTROL DE ACCESO)
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 16, 0.95);
  backdrop-filter: blur(18px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeInDown 0.3s ease;
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-brand {
  text-align: center;
}
.login-brand-icon {
  font-size: 42px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.4));
}
.login-brand h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.login-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.login-field input {
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}
.login-field input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.btn-login-submit {
  padding: 11px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}
.btn-login-submit:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}
.login-error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  text-align: center;
}
.login-info-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
}
.login-info-box code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}

/* PERFIL DE USUARIO EN NAVBAR */
.user-nav-box {
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  font-weight: 600;
}
.user-icon {
  font-size: 14px;
}
.role-pill {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.role-pill.admin {
  background: rgba(225, 29, 72, 0.2);
  color: #fda4af;
  border: 1px solid rgba(225, 29, 72, 0.4);
}
.role-pill.user {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* ==========================================================================
   VISTA 4: CONFIGURACIÓN DEL SISTEMA
   ========================================================================== */
.config-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.config-header-bar {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}
.config-header-bar h2 {
  font-size: 20px;
  font-weight: 700;
}
.config-header-bar p {
  font-size: 13px;
  color: var(--text-muted);
}
.config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 960px) {
  .config-grid {
    grid-template-columns: 1fr 1.3fr;
  }
}
.config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.config-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}
.config-card-icon {
  font-size: 26px;
}
.config-card-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.config-card-header p {
  font-size: 12px;
  color: var(--text-muted);
}
.config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.config-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}
.config-field input, .config-field select {
  padding: 9px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
}
.config-field input:focus, .config-field select:focus {
  border-color: var(--accent-primary);
}
.config-help {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}
.config-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* TABLA DE USUARIOS */
.config-table-container {
  overflow-x: auto;
}
.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.config-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}
.config-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.btn-action-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 4px 8px;
  font-size: 11.5px;
  cursor: pointer;
  margin-right: 4px;
}
.btn-action-icon:hover {
  background: var(--bg-surface-hover);
}
.btn-action-icon.del {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}
.btn-action-icon.del:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   VISTA 5: REGISTRO DE SUCESOS (LOGS)
   ========================================================================== */
.logs-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.logs-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.logs-header-bar h2 {
  font-size: 20px;
  font-weight: 700;
}
.logs-header-bar p {
  font-size: 13px;
  color: var(--text-muted);
}
.logs-actions-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logs-auto-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.logs-auto-refresh input {
  accent-color: var(--accent-primary);
  cursor: pointer;
}
.btn-danger-outline {
  padding: 6px 14px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.25);
}

.logs-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}
.logs-level-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}
.log-level-pill {
  padding: 5px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.log-level-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}
.log-level-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.log-level-pill.lvl-error.active {
  background: var(--accent-live);
  border-color: var(--accent-live);
  color: #fff;
}
.log-level-pill.lvl-warning.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
}
.log-level-pill.lvl-info.active {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: #000;
}

.logs-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.logs-search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 13px;
  color: var(--text-dim);
  pointer-events: none;
}
.logs-search-box input {
  padding: 6px 12px 6px 30px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  width: 200px;
}
.logs-search-box input:focus {
  border-color: var(--accent-primary);
  width: 250px;
}

.logs-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 270px);
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}
.log-entry-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  transition: all 0.15s ease;
}
.log-entry-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-accent);
}
.log-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.4px;
}
.log-badge.ERROR {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.log-badge.WARNING {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.log-badge.INFO {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.log-time {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.log-cat {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.log-body {
  flex: 1;
  min-width: 0;
}
.log-msg {
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}
.log-details {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  word-break: break-word;
}

.modal-user {
  max-width: 440px;
}

@media (max-width: 1080px) {
  .two-columns-layout {
    flex-direction: column;
  }
  .player-left-col {
    flex: none;
    width: 100%;
    max-width: 100%;
    position: relative;
    top: 0;
    max-height: none;
    overflow-y: visible;
  }
  .channels-right-col {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 8px 14px;
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-center {
    order: 3;
    width: 100%;
  }
  .view-tabs {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }
  .main-content {
    padding: 10px 12px;
  }
  .channels-grid {
    grid-template-columns: 1fr;
  }
  .modal-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* SELECTOR DE CARPETA DE GRABACIONES Y EXPLORADOR DE ARCHIVOS               */
/* ========================================================================== */
.input-with-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-actions input {
  flex: 1;
}

.rec-dir-status-box {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.rec-dir-status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.rec-dir-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
}

.rec-dir-status-badge.ok {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}

.rec-dir-status-badge.err {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.4);
}

.rec-dir-disk-info {
  font-size: 12px;
  color: var(--text-dim, #a0aec0);
}

/* Modal Explorador de Carpetas */
.modal-folder-browser {
  max-width: 640px;
  width: 95%;
}

.fb-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
}

.fb-header p {
  margin: 0 0 14px 0;
  font-size: 13px;
  color: var(--text-dim, #a0aec0);
}

.fb-path-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.fb-path-input {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
}

.fb-quick-drives {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fb-drive-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text, #fff);
  cursor: pointer;
  transition: all 0.2s;
}

.fb-drive-pill:hover, .fb-drive-pill.active {
  background: var(--accent, #e50914);
  border-color: var(--accent, #e50914);
}

.fb-folder-list-container {
  height: 270px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px;
}

.fb-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--text, #fff);
  transition: background 0.15s;
}

.fb-folder-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fb-folder-item.active {
  background: rgba(229, 9, 20, 0.25);
  border: 1px solid rgba(229, 9, 20, 0.5);
}

.fb-folder-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-folder-enter-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim, #ccc);
  cursor: pointer;
}

.fb-folder-enter-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.fb-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim, #a0aec0);
  font-size: 13px;
  font-style: italic;
}

.fb-selected-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 12px;
}
