/* static/css/topbar.css — encabezado: buscador, redes y acceso a la señal en vivo */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  padding: 0.6rem 1.5rem;
  background: var(--header-fondo);
  color: var(--header-texto);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

html[data-tema="oscuro"] .topbar {
  background: rgba(5, 10, 28, 0.8);
  backdrop-filter: blur(12px);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.btn-toggle-sidebar {
  border: none;
  background: none;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
}

/* Logo, solo en celular y tablet (en escritorio ya está en el menú) */
.topbar-marca {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-marca:hover { color: inherit; }

.topbar-marca img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

/* ---- Buscador ---- */
.buscador {
  position: relative;
  flex: 0 1 520px;
  min-width: 0;
}

.buscador-campo {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.buscador-campo label { display: flex; opacity: 0.75; }

.buscador-campo:focus-within {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.11);
}

.buscador-campo input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 0.92rem;
}

.buscador-campo input::placeholder { color: inherit; opacity: 0.6; }
.buscador-campo input::-webkit-search-cancel-button { display: none; }

.buscador-atajo {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.68rem;
  opacity: 0.6;
  white-space: nowrap;
}

.buscador-campo:focus-within .buscador-atajo { display: none; }

.buscador-flecha {
  display: flex;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.buscador.abierto .buscador-flecha { transform: rotate(180deg); }

.buscador-resultados {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--tarjeta-borde);
  border-radius: 12px;
  background: var(--tarjeta);
  color: var(--texto);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

html[data-tema="oscuro"] .buscador-resultados { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6); }

.buscador-grupo {
  margin: 6px 8px 4px;
  color: var(--texto-suave);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.buscador-resultados a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--texto);
  font-size: 0.9rem;
  text-decoration: none;
}

.buscador-resultados a:hover,
.buscador-resultados a.marcado { background: var(--acento-suave); color: var(--texto); }

.buscador-resultados a > .icono {
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 8px;
  background: var(--acento-suave);
  color: var(--acento);
}

html[data-tema="oscuro"] .buscador-resultados a > .icono { color: #9fd0ff; }

.buscador-resultados img {
  width: 44px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.buscador-resultados small { margin-left: auto; color: var(--texto-suave); font-size: 0.75rem; }
.buscador-vacio { margin: 10px; color: var(--texto-suave); font-size: 0.88rem; text-align: center; }

/* ---- Redes + En vivo ---- */
.topbar-acciones {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}

.topbar-redes {
  display: flex;
  gap: 2px;
  padding-right: 0.9rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-redes a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: inherit;
  font-size: 0.95rem;
  opacity: 0.7;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.topbar-redes a:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

.topbar-vivo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.14);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease;
}

.topbar-vivo:hover,
.topbar-vivo.activo { color: #fff; background: rgba(220, 38, 38, 0.28); }

.topbar-vivo-punto {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b3b;
}

.topbar-vivo-punto::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ff3b3b;
  animation: vivo-onda 1.6s ease-out infinite;
}

@keyframes vivo-onda {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 0; transform: scale(2.8); }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-vivo-punto::after { animation: none; }
}

.content {
  flex: 1 0 auto;
  padding: 1.4rem 1.5rem;
}

@media (max-width: 1199.98px) {
  .buscador-atajo { display: none; }
}

@media (max-width: 991.98px) {
  .topbar { padding: 0.55rem 1rem; gap: 0.75rem; }
}

/* Celular: el buscador se vuelve un ícono que se expande; las redes quedan en el pie */
@media (max-width: 767.98px) {
  .topbar-redes { display: none; }
  .buscador { flex: 0 0 42px; margin-left: auto; transition: flex-basis 0.25s ease; }
  .buscador .buscador-campo { padding: 0 11px; }
  .buscador .buscador-flecha { display: none; }
  .buscador.abierto { position: absolute; right: 1rem; left: 1rem; z-index: 2; }
  .topbar-acciones { margin-left: 0; }
  .topbar-vivo { padding: 0 11px; }
  .topbar-vivo-texto { display: none; }
}

@media (max-width: 420px) {
  .topbar { gap: 0.5rem; }
  .content { padding: 1rem; }
}
