/* ═══════════════════════════════════════════════════
   NUN — player.css
═══════════════════════════════════════════════════ */

#player-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--player-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(var(--glass-rgb),.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  z-index: 400;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
#player-bar.visible { transform: translateY(0); }

/* ─── Thumb ──────────────────────────────────────── */
.player-thumb {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  /* Gradiente del mockup: da identidad de "artwork" al tile */
  background: linear-gradient(135deg, var(--bg-elevated), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-3);
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}
.player-thumb.playing {
  color: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.35); }
  50%       { box-shadow: 0 0 0 5px rgba(var(--accent-rgb),.0); }
}

/* ─── Info ───────────────────────────────────────── */
.player-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 156px;
  flex-shrink: 0;
}
.player-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.player-column {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Controls ───────────────────────────────────── */
.player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-play {
  width: 38px; height: 38px;
  border-radius: 50%;
  /* Mockup: círculo claro — el control principal contrasta sobre el dark */
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  border: none;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn-play:hover { background: #fff; }
.btn-play:active { transform: scale(.94); }

#btn-prev, #btn-next, #btn-back10, #btn-fwd10 {
  width: 30px; height: 30px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
#btn-prev:hover, #btn-next:hover, #btn-back10:hover, #btn-fwd10:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-light);
}
/* Los saltos de 10s no llevan borde: jerarquía menor que prev/next */
#btn-back10, #btn-fwd10 { border-color: transparent; }

#btn-loop {
  opacity: .35;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  width: 28px; height: 28px;
  color: var(--text-muted);
}
#btn-loop:hover { opacity: .7; }
#btn-loop.active { opacity: 1; color: var(--accent-soft); }

/* ─── Progress area ──────────────────────────────── */
.player-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.time-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-family: 'Geist', monospace, system-ui;
}

/* ─── Waveform interactivo (T5): ES la barra de progreso ─ */
#player-waveform {
  flex: 1;
  min-width: 0;
  height: 36px;
  border-radius: var(--radius-sm);
  display: block;
  cursor: pointer;
  touch-action: none; /* el arrastre de seek no debe hacer scroll */
}
#player-waveform:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ─── Range inputs (volumen) ─────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: width .1s, height .1s;
}
input[type="range"]:hover::-webkit-slider-thumb {
  width: 14px; height: 14px;
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ─── Volume ─────────────────────────────────────── */
.player-volume {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  color: var(--text-muted);
}
#volume-bar { width: 68px; }

/* ─── Close button ───────────────────────────────── */
#btn-close-player {
  color: var(--text-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}
#btn-close-player:hover { color: var(--danger); }

/* ─── Queue button & badge ───────────────────────── */
#btn-queue {
  color: var(--text-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}
#btn-queue:hover { color: var(--text-primary); }
.queue-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 14px;
  text-align: center;
  line-height: 1.4;
}

/* ─── Queue panel (slide from right) ─────────────── */
.queue-panel {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  width: var(--queue-w);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transform: translateX(100%);
  transition: transform .22s ease, bottom .28s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
body.player-visible .queue-panel {
  bottom: var(--player-h);
}
body.queue-visible .queue-panel {
  transform: translateX(0);
  pointer-events: auto;
}
.queue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.queue-panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}
.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.queue-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 16px;
}
.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: grab;
  user-select: none;
  transition: background var(--transition-fast);
}
.queue-item:hover { background: var(--bg-hover); }
.queue-item.dragging { opacity: .4; }
.queue-item.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.queue-item-handle {
  color: var(--text-muted);
  font-size: 16px;
  cursor: grab;
}
.queue-item-play,
.queue-item-remove {
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.queue-item-play:hover { color: var(--accent); background: var(--bg-hover); }
.queue-item-remove:hover { color: var(--danger); background: var(--bg-hover); }
.queue-item-title {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-panel-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ─── Card indicator: in queue ──────────────────── */
.track-card.in-queue::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,.4);
}

@media (max-width: 700px) {
  .queue-panel { width: 100%; }
}

/* ─── Mobile: mini-player píldora (T4) ───────────── */
@media (max-width: 700px) {
  #player-bar {
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 60px;
    gap: 10px;
    padding: 0 8px;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    overflow: hidden;
    transform: translateY(130%);
  }
  #player-bar.visible { transform: translateY(0); }

  /* Hairline de progreso en el borde superior del pill
     (la CSS var --progress-pct la actualiza player.js) */
  #player-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: var(--progress-pct, 0%);
    height: 2px;
    background: var(--accent);
    transition: width .2s linear;
  }

  /* El pill se queda con lo esencial: thumb + info + play + cerrar.
     Seek y volumen, desde la pantalla de bloqueo o el track card. */
  .player-progress, .player-volume, #btn-prev, #btn-next, #btn-loop, #btn-queue,
  #btn-back10, #btn-fwd10 { display: none; }

  .player-info { flex: 1; width: auto; }
  .player-thumb { width: 44px; height: 44px; border-radius: 11px; }
  .btn-play { width: 44px; height: 44px; flex-shrink: 0; }
  #btn-close-player { min-width: 40px; min-height: 40px; }
}

/* ─── Móvil apaisado: player compacto ────────────── */
/* Con el teléfono en horizontal el título se comía la barra: solo queda el
   iconito (thumb), y el hueco ganado va a los saltos de ±10s. Aplica a
   cualquier viewport bajo en horizontal (también iPhone SE con ancho ≤700,
   donde pisa las reglas del pill — por eso va DESPUÉS en el archivo). */
@media (orientation: landscape) and (max-height: 520px) {
  #player-bar {
    left: 0; right: 0; bottom: 0;
    height: 60px;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
    gap: 10px;
    padding: 0 14px;
    transform: translateY(100%);
  }
  #player-bar.visible { transform: translateY(0); }
  #player-bar::before { display: none; }

  .player-info { display: none; }
  #btn-loop, .player-volume { display: none; }

  .player-progress { display: flex; }
  #btn-prev, #btn-next, #btn-back10, #btn-fwd10 { display: flex; width: 34px; height: 34px; }
  .player-thumb { width: 36px; height: 36px; }
  .btn-play { width: 40px; height: 40px; }
  #player-waveform { height: 28px; }
}
