/**
 * Estilos canónicos para Televisión TDT de España en directo
 * Herramienta: /tools/television-tdt-directo/
 * Fijate Tools
 */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-rgb: 37, 99, 235;
  --accent-color: #ef4444;
  --accent-live: #10b981;
  --accent-star: #f59e0b;

  --bg-page: #0b0f19;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #273549;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --border-color: #374151;
  --border-color-subtle: #242f42;
  --border-radius-sm: 8px;
  --border-radius: 12px;
  --border-radius-lg: 16px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);
  
  --player-aspect-ratio: 16 / 9;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-surface: #e2e8f0;
  --bg-surface-elevated: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --border-color: #e2e8f0;
  --border-color-subtle: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
}

/* Reset de contención canónico */
body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  margin: 0 0 0.5rem 0;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Layout principal */
.tool-layout {
  max-width: 1360px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Banner superior de publicidad canónico */
.tools-ad-banner-section {
  width: 100%;
  margin-bottom: 0.5rem;
}

.ad-banner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.ad-banner-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  min-height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Barra lateral sticky para AdSense */
.tool-ad-sidebar {
  width: 300px;
  flex-shrink: 0;
}

.ad-sticky-box {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.ad-unit-card {
  width: 300px;
  min-height: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

/* ==========================================================================
   2. REPRODUCTOR DE TELEVISIÓN
   ========================================================================== */
.tv-player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tv-player-card.theater-mode {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(100vh - 60px);
  z-index: 999;
  border-radius: 0;
  border: none;
  background: #000000;
  display: flex;
  flex-direction: column;
}

.tv-player-card.theater-mode .tv-screen-container {
  flex: 1;
  max-height: calc(100vh - 180px);
  background: #000000;
}

/* Contenedor de pantalla 16:9 */
.tv-screen-container {
  position: relative;
  width: 100%;
  aspect-ratio: var(--player-aspect-ratio);
  background: #050811;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Overlay de estado y carga */
.tv-screen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  text-align: center;
  z-index: 10;
  transition: opacity 0.25s ease;
}

.tv-screen-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.tv-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tv-overlay-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.tv-overlay-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.4;
}

.tv-overlay-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Badges flotantes sobre el vídeo */
.tv-floating-badges {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.tv-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tv-live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-live);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-live);
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.tv-badge-quality {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: 'JetBrains Mono', monospace;
}

/* Barra de control inferior del reproductor */
.tv-player-bar {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tv-channel-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 280px;
}

.tv-channel-avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
}

.tv-channel-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tv-channel-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tv-channel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-category-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-color-subtle);
}

.tv-program-now-ticker {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botones de acción del reproductor */
.tv-player-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-tv-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 40px;
  min-width: 40px;
  padding: 0 0.85rem;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-tv-control:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-color);
  color: #ffffff;
}

.btn-tv-control.active {
  background: var(--primary-color);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-tv-control.btn-star.favorited {
  color: var(--accent-star);
  border-color: var(--accent-star);
  background: rgba(245, 158, 11, 0.15);
}

.btn-tv-control.btn-star.favorited svg {
  fill: var(--accent-star);
}

/* ==========================================================================
   3. CAJA EPG EN DIRECTO Y PROGRESO TEMPORAL
   ========================================================================== */
.tv-epg-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tv-epg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tv-epg-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tv-epg-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.tv-epg-now-card, .tv-epg-next-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--border-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tv-epg-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tv-badge-status {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.tv-badge-status.now {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-live);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.tv-badge-status.next {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.tv-epg-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.tv-epg-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.tv-epg-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Barra de progreso de emisión */
.tv-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: auto;
}

.tv-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 9999px;
  overflow: hidden;
}

.tv-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-live));
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.tv-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   4. BARRA DE FILTROS, CATEGORÍAS Y BÚSQUEDA
   ========================================================================== */
.tv-controls-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tv-search-bar-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.tv-search-input-wrap {
  flex: 1 1 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.tv-search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
}

.tv-search-input {
  width: 100%;
  height: 44px;
  padding: 0 1rem 0 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.tv-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.tv-select-comunidad {
  height: 44px;
  padding: 0 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  flex: 0 1 240px;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.tv-select-comunidad:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Pestañas de categorías adaptativas */
.tv-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tv-category-tabs::-webkit-scrollbar {
  display: none;
}

.btn-category-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 40px;
  padding: 0 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-category-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color-subtle);
}

.btn-category-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-category-tab .tab-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 700;
}

/* ==========================================================================
   5. PARRILLA DE CANALES (SMART GRID)
   ========================================================================== */
.tv-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.tv-results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tv-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  width: 100%;
}

.tv-channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
  text-align: left;
}

.tv-channel-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.tv-channel-card.active {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.12);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.tv-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.tv-card-logo-wrap {
  width: 48px;
  height: 48px;
  background: var(--bg-surface);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tv-card-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tv-card-star-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.tv-card-star-btn:hover {
  color: var(--accent-star);
  transform: scale(1.15);
}

.tv-card-star-btn.favorited {
  color: var(--accent-star);
}

.tv-card-star-btn.favorited svg {
  fill: var(--accent-star);
}

.tv-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.tv-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.tv-card-badge-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tv-badge-mini {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-muted);
}

.tv-badge-mini.live-tag {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-live);
}

.tv-badge-mini.drm-tag {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.tv-card-epg-preview {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tv-card-epg-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-card-epg-progress {
  width: 100%;
  height: 3px;
  background: var(--bg-surface);
  border-radius: 9999px;
  overflow: hidden;
}

.tv-card-epg-bar {
  height: 100%;
  background: var(--primary-color);
  border-radius: 9999px;
}

/* Estado de lista vacía */
.tv-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ==========================================================================
   6. MODAL INSTITUCIONAL CANÓNICO (GUÍA 24H Y ATAJOS)
   ========================================================================== */
.tv-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.25s ease;
}

.tv-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.tv-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.tv-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.btn-modal-close:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.tv-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Lista de programación 24h */
.tv-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tv-schedule-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid transparent;
}

.tv-schedule-item.is-live {
  border-left-color: var(--accent-live);
  background: rgba(16, 185, 129, 0.1);
}

.tv-schedule-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.tv-schedule-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.tv-schedule-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.tv-schedule-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Tabla de atajos de teclado */
.tv-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.tv-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-surface);
  border-radius: var(--border-radius-sm);
}

.tv-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  box-shadow: 0 2px 0 var(--border-color);
}

/* Toast de notificación rápida */
.tv-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.95);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tv-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   7. RESPONSIVIDAD Y CONTROLES MÓVILES (REGLAS CANÓNICAS)
   ========================================================================== */
@media (max-width: 1024px) {
  .tool-with-sidebar {
    flex-direction: column;
  }
  .tool-ad-sidebar {
    display: none;
  }
  .tv-epg-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .tv-player-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .tv-channel-meta {
    width: 100%;
  }

  .tv-player-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tv-player-actions .btn-tv-control {
    flex: 1 1 0%;
    padding: 0;
  }

  .tv-search-bar-row {
    flex-direction: column;
  }

  .tv-search-input-wrap,
  .tv-select-comunidad {
    width: 100%;
    flex: 1 1 100%;
  }

  .tv-channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .tv-channel-card {
    padding: 0.75rem;
  }

  .tv-card-logo-wrap {
    width: 40px;
    height: 40px;
  }
}
