/* ==========================================================================
   BOTTOM AUDIO PLAYER - Slide-Up Music Player
   ========================================================================== */

.bottom-player-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  transform: translateY(115%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              visibility 0.35s ease;
  background: rgba(13, 18, 31, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.65);
}

.bottom-player-container.player-active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Minimize State */
.bottom-player-container.player-minimized {
  transform: translateY(calc(100% - 10px));
}

.player-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 1.75rem;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  align-items: center;
  gap: 1.5rem;
}

/* 1. Track Info (Left) */
.player-track-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.player-cover-art {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.playing-waveform-bars {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.waveform-bar {
  width: 3px;
  height: 4px;
  background: #ffffff;
  border-radius: 2px;
  transition: height 0.15s ease;
}

.player-active.is-playing .waveform-bar:nth-child(1) {
  animation: bounceBar 0.8s infinite ease-in-out alternate;
}
.player-active.is-playing .waveform-bar:nth-child(2) {
  animation: bounceBar 0.6s infinite 0.2s ease-in-out alternate;
}
.player-active.is-playing .waveform-bar:nth-child(3) {
  animation: bounceBar 0.9s infinite 0.4s ease-in-out alternate;
}

@keyframes bounceBar {
  0% { height: 3px; }
  100% { height: 12px; }
}

.player-text-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.15rem;
}

.player-song-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-song-artist {
  font-size: 0.8rem;
  color: var(--admin-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  width: fit-content;
  margin-top: 0.15rem;
}

.player-source-tag.tag-local {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.player-source-tag.tag-remote {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* 2. Controls & Scrubber (Center) */
.player-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.player-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.player-btn {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  border-radius: 50%;
  transition: all 0.15s ease;
  position: relative;
}

.player-btn svg {
  width: 19px;
  height: 19px;
}

.player-btn:hover {
  color: #ffffff;
  transform: scale(1.08);
}

.player-btn:active {
  transform: scale(0.95);
}

/* Seek +/- 5s buttons */
.player-btn-seek {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--admin-text-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.player-btn-seek svg {
  width: 17px;
  height: 17px;
}

.player-btn-seek span {
  font-size: 0.65rem;
  line-height: 1;
}

/* Main Play/Pause Button */
.player-btn-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--admin-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--admin-accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.35rem;
}

.player-btn-play:hover {
  background: var(--admin-accent-hover);
  color: #ffffff;
  transform: scale(1.06);
  box-shadow: 0 6px 18px var(--admin-accent-glow);
}

.player-btn-play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Loop button active indicator */
.player-btn-loop.loop-active,
.player-btn-shuffle.shuffle-active {
  color: var(--admin-accent);
}

.loop-mode-bubble {
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  background: var(--admin-accent);
  color: #ffffff;
  line-height: 1;
}

/* Scrubber / Progress Bar */
.player-scrubber-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 580px;
}

.time-label {
  font-family: monospace;
  font-size: 0.76rem;
  color: var(--admin-text-muted);
  min-width: 40px;
  text-align: center;
}

.scrubber-track-wrap {
  flex: 1;
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  transition: height 0.15s ease;
}

.scrubber-track-wrap:hover {
  height: 8px;
}

.scrubber-fill-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--admin-accent), #38bdf8);
  border-radius: 999px;
  pointer-events: none;
  transition: width 0.1s linear;
}

/* 3. Utility Controls (Right) */
.player-right-utilities {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
}

.loop-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  background: var(--admin-bg-soft);
  border: 1px solid var(--admin-border);
  padding: 0.3rem 0.65rem;
  border-radius: var(--admin-radius-pill);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.loop-status-pill:hover {
  border-color: var(--admin-accent);
  color: #ffffff;
}

.volume-control-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: var(--admin-accent);
}

.btn-close-player {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-player:hover {
  color: #ffffff;
  background: var(--admin-sidebar-hover);
}

/* Responsive Player */
@media (max-width: 900px) {
  .player-inner {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  }

  /* En móvil se conserva la fila de utilidades solo con cola y cerrar */
  .player-right-utilities {
    display: flex;
    justify-content: center;
    gap: 1rem;
  }

  .player-right-utilities .volume-control-wrap,
  .player-right-utilities .loop-status-pill {
    display: none;
  }

  .player-center-controls {
    width: 100%;
  }

  .player-scrubber-row {
    max-width: 100%;
  }

  /* Drawer como hoja inferior a ancho completo */
  .player-queue-drawer {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    max-width: none;
    top: calc(var(--admin-topbar-height, 70px) + env(safe-area-inset-top, 0px) + 0.5rem);
    bottom: auto;
    max-height: 55dvh;
  }
}

/* ==========================================================================
   QUEUE BUTTON & FLOATING QUEUE DRAWER (COLA DE REPRODUCCIÓN)
   ========================================================================== */

.player-btn-queue {
  position: relative;
}

.player-btn-queue.queue-active {
  color: var(--admin-accent);
  background: rgba(0, 245, 212, 0.12);
}

.queue-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--admin-accent);
  color: #050b14;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 0 8px var(--admin-accent-glow);
}

/* Floating Queue Drawer */
.player-queue-drawer {
  position: fixed;
  right: 1.5rem;
  bottom: 86px;
  width: 410px;
  max-width: calc(100vw - 2rem);
  max-height: 540px;
  background: rgba(15, 22, 38, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 245, 212, 0.28);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 245, 212, 0.12);
  z-index: 960;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: queueDrawerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes queueDrawerIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.queue-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(30, 58, 138, 0.35);
  background: rgba(13, 20, 36, 0.7);
}

.queue-drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.queue-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0, 245, 212, 0.12);
  color: var(--admin-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.queue-icon-badge svg {
  width: 18px;
  height: 18px;
}

.queue-drawer-title {
  font-family: var(--font-display, inherit);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.queue-count-subtitle {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
}

.queue-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-queue-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-queue-action svg {
  width: 14px;
  height: 14px;
}

.btn-queue-action:hover {
  color: #ff4d6d;
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.3);
}

.btn-close-queue {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-close-queue svg {
  width: 18px;
  height: 18px;
}

.btn-close-queue:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.queue-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.queue-drawer-content::-webkit-scrollbar {
  width: 6px;
}

.queue-drawer-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.queue-drawer-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 212, 0.35);
}

.queue-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.queue-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--admin-text-muted);
}

.queue-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--admin-accent);
  background: rgba(0, 245, 212, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--admin-accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--admin-accent);
  animation: liveDotPulse 1.4s infinite ease-in-out;
}

@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.queue-dnd-tip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--admin-text-dim);
}

/* Now Playing Item in Queue */
.queue-now-playing-item {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.08), rgba(30, 58, 138, 0.25));
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.queue-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.queue-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-artist {
  font-size: 0.74rem;
  color: var(--admin-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--admin-text-dim);
}

/* Upcoming List & Drag & Drop */
.queue-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 80px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  position: relative;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

.queue-item.is-history {
  opacity: 0.62;
}

.queue-item.is-history:hover {
  opacity: 1;
}

/* Drag Handle */
.queue-drag-handle {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  color: var(--admin-text-dim);
  padding: 0.2rem 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.queue-drag-handle:hover {
  color: var(--admin-accent);
}

.queue-drag-handle:active {
  cursor: grabbing;
}

.queue-drag-handle svg {
  width: 14px;
  height: 14px;
}

/* Dragging state */
.queue-item.is-dragging {
  opacity: 0.35;
  background: rgba(0, 245, 212, 0.08);
  border: 1px dashed var(--admin-accent);
  box-shadow: 0 8px 24px rgba(0, 245, 212, 0.25);
}

/* Insertion Line Indicators */
.queue-item.drop-target-above::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--admin-accent);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--admin-accent);
  pointer-events: none;
}

.queue-item.drop-target-below::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--admin-accent);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--admin-accent);
  pointer-events: none;
}

/* Actions inside queue item */
.queue-item-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.queue-item:hover .queue-item-actions {
  opacity: 1;
}

.btn-queue-row-play,
.btn-queue-row-remove {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-queue-row-play:hover {
  color: var(--admin-accent);
  background: rgba(0, 245, 212, 0.15);
  transform: scale(1.1);
}

.btn-queue-row-remove:hover {
  color: #ff4d6d;
  background: rgba(255, 77, 109, 0.15);
}

.btn-queue-row-play svg,
.btn-queue-row-remove svg {
  width: 14px;
  height: 14px;
}

.queue-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--admin-text-dim);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.queue-empty-state svg {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   PLAYLIST TABLE DRAG & DROP REORDERING STYLES
   ========================================================================== */

.pl-drag-handle {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  color: var(--admin-text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.pl-drag-handle:hover {
  color: var(--admin-accent);
  transform: scale(1.15);
}

.pl-drag-handle:active {
  cursor: grabbing;
}

tr.pl-row-dragging {
  opacity: 0.35;
  background: rgba(0, 245, 212, 0.08) !important;
  outline: 1px dashed var(--admin-accent);
}

tr.pl-drop-above td {
  border-top: 2px solid var(--admin-accent) !important;
  box-shadow: inset 0 2px 6px rgba(0, 245, 212, 0.3);
}

tr.pl-drop-below td {
  border-bottom: 2px solid var(--admin-accent) !important;
  box-shadow: inset 0 -2px 6px rgba(0, 245, 212, 0.3);
}

.action-icon-btn.btn-add-queue:hover {
  color: var(--admin-accent);
  background: rgba(0, 245, 212, 0.15);
  border-color: rgba(0, 245, 212, 0.3);
}

