/* =========================================================
   DjMix — Catálogo de mezclas (mobile-first)
   Se carga después de style.css. Solo afecta en modo catálogo.
   ========================================================= */

:root {
  --cat-bg: #0b0d12;
  --cat-surface: #141824;
  --cat-surface-2: #1b2130;
  --cat-border: rgba(255, 255, 255, 0.08);
  --cat-border-strong: rgba(255, 255, 255, 0.16);
  --cat-text: #e8ecf4;
  --cat-muted: #9aa4b8;
  --cat-accent: #7c5cff;
  --cat-accent-2: #22d3ee;
  --appbar-h: 58px;
}

/* ===================== MODO CATÁLOGO ===================== */
body.catalog-mode {
  display: block;
  padding: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #171a2b 0%, var(--cat-bg) 60%);
  color: var(--cat-text);
}

body.catalog-mode #container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--appbar-h) + 16px) 16px 48px;
  border-radius: 0;
  overflow: visible;
  text-align: left;
  background: transparent;
}

body.catalog-mode #container::before {
  display: none;
}

/* ===================== APP BAR ===================== */
.app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: calc(var(--appbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--cat-border);
}

.app-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-bar-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
}

.app-bar-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--cat-text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--cat-border);
  border-radius: 12px;
  background: var(--cat-surface);
  color: var(--cat-text);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--cat-surface-2); }
.icon-btn:active { transform: scale(0.94); }

/* Ganar prioridad sobre #logout-btn { display:none } de style.css */
#app-bar #logout-btn { display: inline-flex; }

/* ===================== SUPERFICIE + BUSCADOR ===================== */
.catalog-surface {
  position: relative;
  border-radius: 18px;
  padding: 16px;
  background-color: var(--cat-surface);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--cat-border);
  overflow: hidden;
}

.catalog-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 13, 18, 0.72) 0%, rgba(11, 13, 18, 0.92) 100%);
  z-index: 0;
}

.catalog-surface > * { position: relative; z-index: 1; }

.search-wrap { margin-bottom: 16px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--cat-surface-2);
  border: 1px solid var(--cat-border-strong);
  border-radius: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--cat-accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25);
}

.search-icon { width: 18px; height: 18px; color: var(--cat-muted); flex: 0 0 auto; }

#buscador {
  flex: 1 1 auto;
  width: auto;
  margin: 0;
  padding: 14px 4px;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  color: var(--cat-text);
  font-size: 0.98rem;
  text-align: left;
}
#buscador::placeholder { color: #5b6476; }
#buscador::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cat-text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: rgba(255, 255, 255, 0.2); }
.search-clear[hidden] { display: none; }

.search-meta {
  margin: 10px 2px 0;
  color: var(--cat-muted);
  font-size: 0.82rem;
}
.search-meta[hidden] { display: none; }

.sin-resultados {
  text-align: center;
  color: var(--cat-muted);
  padding: 28px 10px;
  font-size: 0.95rem;
}
.sin-resultados[hidden] { display: none; }

/* ===================== GÉNEROS (ACORDEÓN) ===================== */
.genre-accordion {
  margin: 0 0 12px;
  padding: 0 14px;
  border: 1px solid var(--cat-border);
  border-radius: 14px;
  background: rgba(27, 33, 48, 0.85);
  overflow: hidden;
}

/* Neutraliza la regla legacy de style.css: el tinte del header va en el summary */
.genre-accordion[open] { background: rgba(27, 33, 48, 0.85); }

.genre-accordion summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -14px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cat-text);
  cursor: pointer;
  list-style: none;
  outline: none;
  border-radius: 14px;
  transition: background 0.2s ease, border-radius 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.genre-accordion summary::-webkit-details-marker { display: none; }

/* El fondo cubre todo el header (no un rectángulo interno) */
.genre-accordion[open] summary {
  background: rgba(124, 92, 255, 0.16);
  border-radius: 14px 14px 0 0;
}

.genre-accordion summary::after {
  content: "▾";
  color: var(--cat-muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}
.genre-accordion[open] summary::after { transform: rotate(180deg); }

.genre-name { flex: 1 1 auto; min-width: 0; }

.genre-count {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.18);
  color: #c4b5fd;
}

.songs-list { padding-bottom: 6px; }

/* ===================== CANCIÓN ===================== */
.song {
  padding: 12px;
  margin: 10px 0;
  background: var(--cat-surface);
  border: 1px solid var(--cat-border);
  border-radius: 12px;
}

.song-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.song-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.song-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cat-text);
  word-break: break-word;
}

.song-sub {
  font-size: 0.78rem;
  color: var(--cat-muted);
}

.song-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.song-playing-dot {
  position: relative;
  display: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.85);
  animation: song-dot-pulse 1.2s ease-in-out infinite;
}

/* Anillo que se expande para reforzar la señal */
.song-playing-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(250, 204, 21, 0.55);
  animation: song-dot-ring 1.2s ease-out infinite;
}

.song.is-playing .song-playing-dot { display: inline-block; }
/* Azul suave: resalta sin gritar, y contrasta con la bolita amarilla */
.song.is-playing .song-title { color: #7dd3fc; }

@keyframes song-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.75); opacity: 0.55; }
}

@keyframes song-dot-ring {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.btn-like {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  width: auto;
  padding: 6px 10px;
  margin: 0;
  border: 1px solid var(--cat-border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #c792ff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-like svg { width: 15px; height: 15px; }
.btn-like:hover { background: rgba(199, 146, 255, 0.15); }
.btn-like:active { transform: scale(0.94); }
.btn-like.liked { animation: likeAnimation 0.3s ease; }
.like-count { font-weight: 700; }

.song audio {
  display: block;
  width: 100%;
}

/* Indicador de pista reproduciéndose dentro del grupo */
.genre-playing-indicator {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  flex: 0 0 auto;
}

.genre-accordion.is-playing .genre-playing-indicator { display: inline-flex; }

.genre-playing-indicator i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--cat-accent-2);
  transform-origin: bottom;
  animation: genre-eq 0.9s ease-in-out infinite;
}

.genre-playing-indicator i:nth-child(1) { height: 6px; animation-delay: 0s; }
.genre-playing-indicator i:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.genre-playing-indicator i:nth-child(3) { height: 8px; animation-delay: 0.3s; }

@keyframes genre-eq {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .genre-playing-indicator i { animation: none; }
  .song-playing-dot,
  .song-playing-dot::after { animation: none; }
}

/* ===================== DESKTOP ===================== */
@media (min-width: 768px) {
  body.catalog-mode #container {
    padding-left: 0;
    padding-right: 0;
  }
  .catalog-surface { padding: 20px; }
}
