/* ===== RADIO MOTERA TV - Estilos de la plataforma TV ===== */

/* ---- Variables adicionales TV ---- */
:root {
  --tv-bg: #000000;
  --tv-overlay-bg: rgba(0,0,0,0.85);
  --tv-bar-bg: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 80%, transparent 100%);
  --tv-accent: #E31E24;
  --tv-gold: #F5A623;
}

/* ============================================================
   PÁGINA PÚBLICA: TV EN VIVO
   ============================================================ */

.tv-page {
  background: var(--tv-bg);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  font-family: var(--font-body, 'Roboto', sans-serif);
}

/* Reproductor de vídeo a pantalla completa */
#tv-player-wrap {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tv-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ---- Estado de carga ---- */
#tv-loading {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 100;
  transition: opacity 0.5s ease;
}
#tv-loading .tv-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--tv-accent);
  border-radius: 50%;
  animation: tvSpin 0.8s linear infinite;
}
#tv-loading .tv-load-logo {
  width: 80px;
  opacity: 0.9;
}
#tv-loading p {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
@keyframes tvSpin { to { transform: rotate(360deg); } }

/* ---- Pantalla offline ---- */
#tv-offline {
  position: fixed;
  inset: 0;
  background: var(--tv-bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 90;
  text-align: center;
  padding: 24px;
}
#tv-offline .tv-offline-icon {
  font-size: 72px;
  color: rgba(255,255,255,0.15);
}
#tv-offline h2 {
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.8);
}
#tv-offline p {
  color: rgba(255,255,255,0.4);
  font-size: 14px;
}
#tv-offline .tv-retry-btn {
  margin-top: 12px;
  padding: 10px 28px;
  background: var(--tv-accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}
#tv-offline .tv-retry-btn:hover { background: #b01519; }

/* ---- Botón Play (autoplay bloqueado) ---- */
#tv-play-btn {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  background: rgba(0,0,0,0.5);
  cursor: pointer;
}
#tv-play-btn .play-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(227,30,36,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
  transition: transform 0.2s, background 0.2s;
}
#tv-play-btn:hover .play-circle { transform: scale(1.1); background: var(--tv-accent); }

/* ---- Logo flotante (watermark) ---- */
#tv-logo-overlay {
  position: fixed;
  top: 20px;
  left: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
#tv-logo-overlay img {
  height: 48px;
  width: auto;
  opacity: 0.85;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
}
#tv-logo-overlay .tv-channel-name {
  font-family: var(--font-display, 'Bebas Neue', cursive);
  font-size: 26px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
  opacity: 0.9;
}

/* ---- Indicador EN VIVO ---- */
#tv-live-badge {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
}
.tv-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tv-accent);
  animation: tvBlink 1.2s ease infinite;
}
@keyframes tvBlink { 0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(227,30,36,0.6)} 50%{opacity:0.5;box-shadow:0 0 0 5px transparent} }

.tv-live-text {
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
}
.tv-viewer-count {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ---- Barra de información inferior ---- */
#tv-info-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--tv-bar-bg);
  padding: 40px 28px 20px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.tv-now-playing {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tv-now-label {
  background: var(--tv-accent);
  color: #fff;
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tv-program-title {
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-program-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}
.tv-next-up {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.tv-progress-bar {
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 1px;
  margin-top: 12px;
  overflow: hidden;
}
.tv-progress-fill {
  height: 100%;
  background: var(--tv-accent);
  border-radius: 1px;
  transition: width 1s linear;
}

/* Ocultar info bar con hover/tap */
.tv-info-hidden #tv-info-bar { opacity: 0; }

/* ============================================================
   ADMIN TV PANEL - Estilos específicos
   ============================================================ */

/* Cabecera de sección TV */
.tv-admin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 20px;
}
.tv-admin-header .tv-live-badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(227,30,36,0.15);
  border: 1px solid rgba(227,30,36,0.3);
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--red);
}
.tv-admin-header .tv-offline-badge {
  background: rgba(136,136,136,0.15);
  border-color: rgba(136,136,136,0.3);
  color: var(--gray);
}

/* Grid de videos en admin */
.tv-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.tv-video-card {
  background: var(--dark2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  transition: var(--transition);
  position: relative;
}
.tv-video-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tv-video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--dark3);
  overflow: hidden;
}
.tv-video-thumb img { width:100%; height:100%; object-fit:cover; }
.tv-video-thumb .tv-thumb-placeholder {
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,0.15);
  font-size:32px;
}
.tv-video-thumb .tv-duration-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 0.5px;
}
.tv-video-card .tv-card-body { padding: 12px; }
.tv-video-card .tv-card-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tv-video-card .tv-card-meta {
  font-size: 11px;
  color: var(--gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.tv-card-actions { display: flex; gap: 6px; }
.tv-card-actions a, .tv-card-actions button {
  flex: 1;
  text-align: center;
  padding: 6px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}
.tv-btn-edit { background: var(--dark3); color: var(--gray-light); }
.tv-btn-edit:hover { background: var(--dark4); color: var(--white); }
.tv-btn-delete { background: rgba(227,30,36,0.1); color: var(--red); }
.tv-btn-delete:hover { background: var(--red); color: #fff; }

/* Barra de progreso de subida */
.tv-upload-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255,255,255,0.02);
}
.tv-upload-zone:hover, .tv-upload-zone.dragover {
  border-color: var(--red);
  background: rgba(227,30,36,0.04);
}
.tv-upload-zone i { font-size: 48px; color: rgba(255,255,255,0.2); margin-bottom: 12px; }
.tv-upload-zone p { color: var(--gray); font-size: 14px; }
.tv-upload-zone strong { color: var(--white); }

.tv-upload-progress {
  display: none;
  margin-top: 16px;
}
.tv-progress-track {
  background: var(--dark3);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.tv-progress-track .fill {
  height: 100%;
  background: var(--red);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0;
}
.tv-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray);
  margin-top: 6px;
}

/* Sortable playlist items */
.tv-playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--dark3);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  cursor: default;
  transition: var(--transition);
  user-select: none;
}
.tv-playlist-item:hover { border-color: rgba(255,255,255,0.12); }
.tv-playlist-item.sortable-ghost { opacity: 0.4; background: rgba(227,30,36,0.1); border: 1px dashed var(--red); }
.tv-playlist-item.sortable-chosen { box-shadow: 0 8px 24px rgba(0,0,0,0.5); border-color: var(--red); }

.tv-item-handle {
  color: rgba(255,255,255,0.35);
  font-size: 16px;
  cursor: grab;
  flex-shrink: 0;
  padding: 4px 2px;
}
.tv-item-handle:hover { color: rgba(255,255,255,0.7); }
.tv-item-handle:active { cursor: grabbing; }
.tv-item-pos {
  width: 24px;
  font-size: 11px;
  color: var(--gray);
  text-align: center;
  flex-shrink: 0;
  font-weight: 700;
}
.tv-item-thumb {
  width: 64px;
  height: 36px;
  background: var(--dark4);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.tv-item-thumb img { width:100%; height:100%; object-fit:cover; }
.tv-item-thumb .no-thumb { width:100%; height:100%; display:flex; align-items:center; justify-content:center; color:rgba(255,255,255,0.15); font-size:14px; }
.tv-item-info { flex: 1; min-width: 0; }
.tv-item-title { font-size: 13px; font-weight: 500; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-item-duration { font-size: 11px; color: var(--gray); margin-top: 2px; }
.tv-item-remove {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.2);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: var(--transition);
  flex-shrink: 0;
}
.tv-item-remove:hover { color: var(--red); background: rgba(227,30,36,0.1); }

/* Auto DJ toggle */
.tv-autodj-panel {
  background: var(--dark2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.tv-autodj-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tv-autodj-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gray);
  transition: background 0.3s;
}
.tv-autodj-dot.active {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.2);
  animation: autoDJPulse 2s ease infinite;
}
@keyframes autoDJPulse { 0%,100%{box-shadow:0 0 0 4px rgba(34,197,94,0.2)} 50%{box-shadow:0 0 0 8px rgba(34,197,94,0.05)} }
.tv-autodj-label { font-family: var(--font-heading); font-size: 15px; font-weight: 600; color: var(--white); letter-spacing: 1px; text-transform: uppercase; }
.tv-autodj-sublabel { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* Calendar schedule */
.tv-calendar { border-radius: var(--radius); overflow: hidden; }
.tv-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark3);
  padding: 14px 18px;
}
.tv-cal-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.tv-cal-nav button {
  background: var(--dark4);
  border: none;
  color: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}
.tv-cal-nav button:hover { background: var(--red); }
.tv-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: rgba(255,255,255,0.05);
}
.tv-cal-day-header {
  background: var(--dark3);
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
}
.tv-cal-day {
  background: var(--dark2);
  min-height: 90px;
  padding: 6px;
  position: relative;
  transition: background 0.2s;
}
.tv-cal-day:hover { background: var(--dark3); }
.tv-cal-day.other-month { opacity: 0.35; }
.tv-cal-day.today { background: rgba(227,30,36,0.08); }
.tv-cal-day.today::after { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--red); }
.tv-cal-day-num { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.tv-cal-day.today .tv-cal-day-num { color: var(--red); }
.tv-cal-event {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 2px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 0.2s;
}
.tv-cal-event:hover { filter: brightness(1.2); }
.tv-cal-add {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 18px; height: 18px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: var(--transition);
}
.tv-cal-day:hover .tv-cal-add { display: flex; }
.tv-cal-add:hover { background: rgba(227,30,36,0.3); color: var(--red); }

/* Stats cards TV */
.tv-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.tv-stat-card {
  background: var(--dark2);
  border-radius: var(--radius);
  border-left: 3px solid var(--red);
  padding: 16px;
}
.tv-stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--white);
  line-height: 1;
  margin-bottom: 4px;
}
.tv-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray); font-weight: 600; }
.tv-stat-change { font-size: 12px; color: #22c55e; margin-top: 4px; }
.tv-stat-change.down { color: var(--red); }

/* Tabla admin TV */
.tv-table { width: 100%; border-collapse: collapse; }
.tv-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--gray);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tv-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.tv-table tr:hover td { background: rgba(255,255,255,0.02); }
.tv-table .tv-thumb-sm {
  width: 64px; height: 36px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--dark3);
}

/* Toast notifications */
.tv-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--dark2);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 3px solid var(--red);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.tv-toast.show { transform: translateX(0); }
.tv-toast.success { border-left-color: #22c55e; }
.tv-toast.error { border-left-color: var(--red); }

/* Status badges TV */
.tv-status-active { color: #22c55e; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.tv-status-inactive { color: var(--gray); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

/* Responsive TV page */
@media (max-width: 768px) {
  #tv-logo-overlay .tv-channel-name { display: none; }
  #tv-logo-overlay img { height: 38px; }
  .tv-program-title { font-size: 16px; }
  .tv-cal-grid { gap: 0; }
  .tv-cal-day { min-height: 64px; }
  .tv-video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
