/* ─────────────────────────────────────────────────────
   JB Music Player — Frontend Styles v2
   ───────────────────────────────────────────────────── */

.jb-mp-wrapper *,
.jb-mp-wrapper *::before,
.jb-mp-wrapper *::after {
  box-sizing: border-box;
}

/* ── Wrapper ───────────────────────────────────────── */
.jb-mp-wrapper {
  background-color: #0a0a0a;
  padding: 40px 24px;
  width: 100%;
}

/* ── Título de sección ─────────────────────────────── */
.jb-mp-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #C9A84C;
  padding-bottom: 12px;
  border-bottom: 1px solid #222;
  margin-bottom: 20px;
}

/* ── Layouts ───────────────────────────────────────── */
.jb-mp-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jb-mp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

/* ── Track row ─────────────────────────────────────── */
.jb-mp-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background-color: #111111;
  border: 1px solid #1e1e1e;
  border-left: 3px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  cursor: default;
  user-select: none;
}

.jb-mp-track:hover {
  background-color: #1a1a1a;
  border-color: #C9A84C;
  border-left-color: #C9A84C;
}

.jb-mp-track.playing {
  border-left-color: #C9A84C;
  background-color: #161616;
}

/* ── Número ────────────────────────────────────────── */
.jb-mp-num {
  font-size: 11px;
  font-weight: 700;
  color: #C9A84C;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.jb-mp-track.playing .jb-mp-num {
  color: #E8C96A;
}

/* ── Portada ───────────────────────────────────────── */
.jb-mp-cover {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background-color: #1c1c1c;
  border: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.jb-mp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

.jb-mp-cover-icon {
  font-size: 18px;
  color: #444;
}

.jb-mp-track.playing .jb-mp-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(201, 168, 76, 0.15);
  border-radius: inherit;
  animation: jb-pulse 1.2s ease-in-out infinite;
}

@keyframes jb-pulse {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.8; }
}

/* ── Info ──────────────────────────────────────────── */
.jb-mp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.jb-mp-title {
  font-size: 14px;
  color: #E8E8E0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.jb-mp-track:hover .jb-mp-title,
.jb-mp-track.playing .jb-mp-title {
  color: #ffffff;
}

.jb-mp-label {
  font-size: 10px;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Meta ──────────────────────────────────────────── */
.jb-mp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.jb-mp-duration,
.jb-mp-year {
  font-size: 12px;
  color: #888880;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   BOTÓN PLAY / PAUSE — iconos SVG blancos visibles
   ═══════════════════════════════════════════════════ */

.jb-mp-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  /* Fondo dorado + borde oscuro para contraste */
  background-color: #C9A84C;
  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s;
  outline: none;
  /* Sombra para que se vea como botón */
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  padding: 0;
}

.jb-mp-play-btn:hover {
  background-color: #E8C96A;
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(201,168,76,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}

.jb-mp-play-btn:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* SVG iconos dentro del botón — SIEMPRE blancos */
.jb-mp-play-btn svg {
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

.jb-mp-play-btn svg polygon,
.jb-mp-play-btn svg rect {
  fill: #ffffff !important;
  stroke: #ffffff !important;
}

/* Icono pause: oculto por defecto, visible cuando playing */
.jb-icon-pause          { display: none; }
.jb-icon-play           { display: block; }

.jb-mp-play-btn.is-playing .jb-icon-play  { display: none; }
.jb-mp-play-btn.is-playing .jb-icon-pause { display: block; }

/* ── Estado vacío ──────────────────────────────────── */
.jb-mp-empty {
  color: #555;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 32px;
  text-align: center;
  border: 1px dashed #222;
  background: #111;
}

/* ═══════════════════════════════════════════════════
   BARRA DE AUDIO INFERIOR
   ═══════════════════════════════════════════════════ */
.jb-mp-audio-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #0d0d0d;
  border-top: 2px solid #C9A84C;
  padding: 10px 20px;
  align-items: center;
  gap: 14px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
}

.jb-mp-audio-bar.active { display: flex; }

.jb-mp-bar-cover {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid #333;
}

.jb-mp-bar-info {
  flex: 1;
  min-width: 0;
}

.jb-mp-bar-title {
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jb-mp-bar-time {
  font-size: 11px;
  color: #888;
  letter-spacing: 1px;
  margin-top: 2px;
}

.jb-mp-bar-progress {
  flex: 2;
  height: 4px;
  background: #2a2a2a;
  cursor: pointer;
  border-radius: 2px;
  position: relative;
}

.jb-mp-bar-progress:hover { height: 6px; margin: -1px 0; }

.jb-mp-bar-progress-fill {
  height: 100%;
  background: #C9A84C;
  border-radius: 2px;
  width: 0%;
  transition: width 0.25s linear;
  pointer-events: none;
}

/* Botón play/pause de la barra */
.jb-mp-bar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.jb-mp-bar-prev,
.jb-mp-bar-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
  padding: 0;
  outline: none;
}

.jb-mp-bar-prev:hover,
.jb-mp-bar-next:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.jb-mp-bar-prev svg,
.jb-mp-bar-next svg { display: block; pointer-events: none; }
.jb-mp-bar-prev svg polygon,
.jb-mp-bar-next svg polygon { fill: #ffffff !important; stroke: #ffffff !important; }

.jb-mp-bar-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: #C9A84C;
  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: background 0.2s, transform 0.15s;
  padding: 0;
  outline: none;
}

.jb-mp-bar-play:hover {
  background: #E8C96A;
  transform: scale(1.08);
}

/* Forzar iconos blancos dentro del botón de barra */
.jb-mp-bar-play svg { display: block; pointer-events: none; }
.jb-mp-bar-play svg polygon { fill: #ffffff !important; stroke: #ffffff !important; }
.jb-mp-bar-play svg rect    { fill: #ffffff !important; stroke: none !important; }

/* Estado por defecto: play visible, pause oculto */
.jb-mp-bar-play .jb-icon-play  { display: block; }
.jb-mp-bar-play .jb-icon-pause { display: none;  }

/* Estado playing: play oculto, pause visible */
.jb-mp-bar-play.is-playing .jb-icon-play  { display: none;  }
.jb-mp-bar-play.is-playing .jb-icon-pause { display: block; }

.jb-mp-bar-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

.jb-mp-bar-close:hover { color: #C9A84C; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .jb-mp-grid { grid-template-columns: 1fr; }
  .jb-mp-track { padding: 10px 12px; gap: 10px; }
  .jb-mp-cover { width: 40px; height: 40px; }
  .jb-mp-title { font-size: 13px; }
  .jb-mp-year, .jb-mp-duration { font-size: 11px; }
  .jb-mp-play-btn { width: 30px; height: 30px; }
  .jb-mp-audio-bar { padding: 8px 12px; gap: 8px; }
  .jb-mp-bar-progress { display: none; }
}

@media (max-width: 480px) {
  .jb-mp-wrapper { padding: 24px 12px; }
  .jb-mp-num { display: none; }
  .jb-mp-meta { gap: 6px; }
}

/* ═══════════════════════════════════════════════════
   ACORDEÓN — Cabecera con portada y nombre del álbum
   ═══════════════════════════════════════════════════ */

.jb-mp-accordion {
  width: 100%;
  overflow: hidden;
}

/* ── Cabecera (botón clickeable) ───────────────────── */
.jb-mp-accordion-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 18px;
  background-color: #111111;
  border: 1px solid #1e1e1e;
  border-left: 4px solid #C9A84C;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease;
  /* Reset button styles */
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.jb-mp-accordion-header:hover {
  background-color: #181818;
}

/* ── Portada del álbum ─────────────────────────────── */
.jb-mp-accordion-cover {
  width: 80px;
  height: 80px;
  min-width: 80px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  background-color: #1c1c1c;
  border: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.jb-mp-accordion-header:hover .jb-mp-accordion-cover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.jb-mp-accordion-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}

.jb-mp-accordion-cover-icon {
  font-size: 28px;
  color: #444;
}

/* ── Info del álbum ────────────────────────────────── */
.jb-mp-accordion-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.jb-mp-accordion-name {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  transition: color 0.2s;
}

.jb-mp-accordion-header:hover .jb-mp-accordion-name {
  color: #C9A84C;
}

.jb-mp-accordion-meta {
  font-size: 12px;
  color: #888880;
  letter-spacing: 0.5px;
}

/* ── Flecha chevron ────────────────────────────────── */
.jb-mp-accordion-chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
}

.jb-mp-accordion-chevron svg { display: block; }
.jb-mp-accordion-chevron path { stroke: #C9A84C; }

/* Flecha apunta arriba cuando está abierto */
.jb-mp-accordion-header.is-open .jb-mp-accordion-chevron {
  transform: rotate(180deg);
}

/* ── Cuerpo colapsable ─────────────────────────────── */
.jb-mp-accordion-body {
  overflow: hidden;
  /* La animación se maneja en JS con slideDown/slideUp nativo */
}

/* Separador sutil entre cabecera y lista de canciones */
.jb-mp-accordion-header.is-open {
  border-bottom: 1px solid #2a2a2a;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 480px) {
  .jb-mp-accordion-header {
    padding: 10px 12px;
    gap: 12px;
  }

  .jb-mp-accordion-cover {
    width: 60px;
    height: 60px;
    min-width: 60px;
  }

  .jb-mp-accordion-name {
    font-size: 15px;
  }
}
