/* ================================================
   PLAYER.CSS — Mini-player flutuante + resizable
   MIN: barra compacta | MED/MAX: vista expandida
   ================================================ */

.mini-player {
  position: fixed;
  bottom: -400px;
  left: 0; right: 0;
  z-index: 9000;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
  /* Sem flex — altura controlada pelo JS via style.height */
}

.mini-player.visible {
  bottom: 0;
  pointer-events: all;
}

/* ─── BOTÕES DE ESTADO (setinhas) ─── */
.player-state-btns {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.25rem;
  z-index: 2;
  padding: 4px 6px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0 0 10px 10px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-top: none;
}

.player-state-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(148, 163, 184, 0.6);
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  line-height: 1;
}

.player-state-btn:hover {
  color: white;
  background: rgba(99, 102, 241, 0.35);
  transform: scale(1.2);
}

/* ─── BARRA COMPACTA (MIN) ─── */
.player-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

/* ─── VISTA EXPANDIDA (MED + MAX) ─── */
/* Posicionada do fundo para cima, com padding-top para o handle */
.player-exp-view {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 0; left: 0; right: 0; top: 0;
  padding: 18px 2rem 0.75rem; /* 14px handle + 4px folga */
  box-sizing: border-box;
  gap: 0;
}

/* ── Fila (MAX) — ocupa espaço disponível no topo ── */
.player-queue-section {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0.6rem;
}

.player-queue {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.player-queue-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.player-queue-item:hover { background: rgba(99, 102, 241, 0.12); }

.player-queue-thumb {
  width: 30px; height: 30px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

.player-queue-name {
  font-size: 0.77rem; font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-queue-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #94a3b8;
  margin: 0.5rem 0.5rem 0.2rem;
  flex-shrink: 0;
}

.player-queue-artist { font-size: 0.68rem; color: #64748b; }

/* ── Conteúdo principal (capa + info + controles) ── */
.player-exp-main {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  padding-top: 0.7rem;
}

.player-exp-cover {
  width: 90px; height: 90px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.mini-player.playing .player-exp-cover {
  border-color: var(--player-color, #1db954);
  animation: playerThumbSpin 8s linear infinite;
}

.player-exp-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.player-exp-title {
  font-size: 1rem; font-weight: 700; color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-exp-artist { font-size: 0.82rem; color: #94a3b8; }

.player-exp-prog {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

/* Controles + plataformas em linha: controles à esquerda dos botões */
.player-exp-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.player-exp-right .player-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-exp-right .player-platforms {
  display: flex;
  gap: 0.5rem;
}

/* ─── THUMB (MIN) ─── */
.player-thumb {
  width: 46px; height: 46px;
  border-radius: 8px; object-fit: cover; flex-shrink: 0;
  border: 2px solid rgba(99, 102, 241, 0.3);
  transition: border-color 0.3s ease;
}

.mini-player.playing .player-thumb {
  border-color: var(--player-color, #1db954);
  animation: playerThumbSpin 8s linear infinite;
}

@keyframes playerThumbSpin {
  from { border-color: #6366f1; box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
  33%  { border-color: #1db954; box-shadow: 0 0 10px 2px rgba(29,185,84,0.3); }
  66%  { border-color: #ec4899; box-shadow: 0 0 10px 2px rgba(236,72,153,0.3); }
  to   { border-color: #6366f1; box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
}

.player-info { flex: 1; min-width: 0; }

.player-title {
  font-size: 0.9rem; font-weight: 700; color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2; margin-bottom: 0.25rem;
}

.player-artist {
  font-size: 0.78rem; color: #94a3b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── CONTROLES ─── */
.player-controls { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

.player-btn {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 1.1rem; padding: 0.5rem;
  border-radius: 50%; transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}

.player-btn:hover { color: #f1f5f9; background: rgba(99,102,241,0.15); transform: scale(1.1); }

.player-btn-play {
  background: linear-gradient(135deg, var(--player-color, #6366f1), #8b5cf6);
  color: white !important; width: 42px; height: 42px; font-size: 1rem;
  box-shadow: 0 4px 15px rgba(99,102,241,0.4);
}

.player-btn-play:hover {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(99,102,241,0.6);
}

/* ─── PROGRESSO ─── */
.player-progress-wrap {
  flex: 2; min-width: 80px; max-width: 300px;
  display: flex; flex-direction: column; gap: 0.3rem;
}

.player-progress {
  width: 100%; height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px; overflow: visible;
  cursor: pointer; position: relative;
}

.player-progress::after {
  content: attr(data-hover-time);
  position: absolute; top: -32px;
  left: var(--tooltip-x, 50%);
  transform: translateX(-50%);
  background: rgba(15,23,42,0.95); color: #f1f5f9;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.25rem 0.55rem; border-radius: 6px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s ease; white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(6px);
}

.player-progress:hover::after { opacity: 1; }
html.light-mode .player-progress::after { background: rgba(255,255,255,0.97); color: #1a1512; border-color: rgba(0,0,0,0.1); }

.player-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--player-color, #6366f1), #8b5cf6);
  border-radius: 4px; width: 0%;
  pointer-events: none; /* SEM transition — seek instantâneo */
}

.player-progress:hover { height: 7px; margin-top: -1.5px; transition: height 0.15s ease; }
.player-time { display: flex; justify-content: space-between; font-size: 0.7rem; color: #64748b; }

/* ─── PLATAFORMAS ─── */
.player-platforms { display: flex; gap: 0.5rem; flex-shrink: 0; }

.player-platform-btn {
  padding: 0.45rem 0.9rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700;
  text-decoration: none; transition: all 0.25s ease;
  display: flex; align-items: center; gap: 0.35rem;
  border: none; cursor: pointer; white-space: nowrap;
}

.player-platform-btn.spotify  { background: #1db954; color: white; }
.player-platform-btn.spotify:hover  { background: #1ed760; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(29,185,84,0.4); }
.player-platform-btn.youtube  { background: #ff0000; color: white; }
.player-platform-btn.youtube:hover  { background: #cc0000; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(255,0,0,0.4); }

/* ─── FECHAR ─── */
.player-close {
  background: none; border: none; color: #475569;
  cursor: pointer; font-size: 1rem; padding: 0.4rem;
  border-radius: 50%; transition: all 0.2s ease;
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.player-close:hover { color: #f1f5f9; background: rgba(239,68,68,0.15); transform: scale(1.1); }

/* ─── IFRAME ─── */
.player-iframe-container {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; opacity: 0; pointer-events: none;
}

/* ─── LIGHT MODE ─── */
html.light-mode .mini-player { background: rgba(255,255,255,0.97); border-top-color: rgba(99,102,241,0.15); box-shadow: 0 -4px 30px rgba(0,0,0,0.12); }
html.light-mode .player-title, html.light-mode .player-exp-title   { color: #1a1512; }
html.light-mode .player-artist, html.light-mode .player-exp-artist { color: #64748b; }
html.light-mode .player-btn   { color: #64748b; }
html.light-mode .player-btn:hover { color: #1a1512; background: rgba(99,102,241,0.08); }
html.light-mode .player-time  { color: #94a3b8; }
html.light-mode .player-progress { background: rgba(0,0,0,0.1); }
html.light-mode .player-close { color: #94a3b8; }
html.light-mode .player-close:hover { color: #1a1512; }
html.light-mode .player-queue-name { color: #1a1512; }
html.light-mode .player-queue-item:hover { background: rgba(99,102,241,0.08); }
html.light-mode .player-state-btns {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

html.light-mode .player-state-btn { color: rgba(100,116,139,0.5); }

html.light-mode .player-state-btn:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.2);
}
html.light-mode .player-platform-btn.spotify { background: #1db954 !important; color: #fff !important; }
html.light-mode .player-platform-btn.youtube { background: #ff0000 !important; color: #fff !important; }
html.light-mode .player-exp-main { border-top-color: rgba(99,102,241,0.08); }

/* ══════════════════════════════════════════════
   MOBILE — ≤ 768px
   MIN : barra compacta com ícones de plataforma
   MAX : modal full-screen estilo Spotify
   ══════════════════════════════════════════════ */

/* ── Ícones circulares de plataforma na barra MIN ── */
.player-bar-platforms-mobile { display: none; }

.player-bar-icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}
.player-bar-icon-btn.spotify { background: #1db954; }
.player-bar-icon-btn.youtube { background: #ff0000; }
.player-bar-icon-btn:hover { transform: scale(1.1); opacity: 0.85; }

/* ── Mobile prev/next split ── */
.player-mobile-pn {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0 0;
  border-top: 1px solid rgba(99,102,241,0.15);
  margin-top: 0.5rem;
}
.player-mobile-pn-item { display: flex; flex-direction: column; gap: 0.3rem; }

.pn-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: #64748b; padding: 0 0.25rem;
}
.pn-card {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(99,102,241,0.1);
  transition: background 0.2s ease; min-width: 0;
}
.pn-card:hover { background: rgba(99,102,241,0.12); }
.pn-card img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.pn-info { min-width: 0; }
.pn-title {
  font-size: 0.78rem; font-weight: 600; color: #cbd5e1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pn-artist {
  font-size: 0.68rem; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html.light-mode .pn-card { background: rgba(0,0,0,0.03); border-color: rgba(99,102,241,0.12); }
html.light-mode .pn-title { color: #1a1512; }

@media (max-width: 768px) {

  /* ── MIN ─────── */
  .player-bar { padding: 0 0.75rem; gap: 0.5rem; height: 90px; }
  .player-thumb { width: 54px; height: 54px; border-radius: 10px; }
  .player-title  { font-size: 0.92rem; }
  .player-artist { font-size: 0.78rem; }
  .player-progress-wrap { display: none; }
  .player-platforms { display: none; }
  .player-bar-platforms-mobile { display: flex; gap: 0.4rem; }
  .player-bar .player-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  .player-bar .player-btn-play { width: 52px; height: 52px; font-size: 1.15rem; }
  /* Esconder ✕ na barra MIN — não faz falta em mobile */
  .player-bar .player-close { display: none; }

  /* ── MODAL FULL-SCREEN (MAX) ── */
  .mini-player.mobile-modal {
    height: 100dvh !important;
    height: 100vh !important;
    border-top: none; border-radius: 0;
    /* bottom: -400px não chega para esconder 100dvh — ancoramos em 0 e usamos transform */
    bottom: 0 !important;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .mini-player.mobile-modal.visible {
    transform: translateY(0);
  }
  .mini-player.mobile-modal .player-state-btns {
    top: env(safe-area-inset-top, 12px);
    left: 50%; transform: translateX(-50%);
    background: none; border: none; backdrop-filter: none; gap: 0;
  }
  .mini-player.mobile-modal #playerBtnExpand  { display: none; }
  .mini-player.mobile-modal #playerBtnCollapse {
    font-size: 1.4rem; color: rgba(148,163,184,0.7);
    padding: 0.5rem 1.5rem; width: auto; height: auto;
  }
  .mini-player.mobile-modal .player-exp-view {
    display: flex !important;
    flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 52px 1.5rem calc(env(safe-area-inset-bottom, 0px) + 1rem);
    overflow-y: hidden; gap: 0;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .mini-player.mobile-modal .player-exp-view::-webkit-scrollbar { display: none; }
  .mini-player.mobile-modal .player-exp-cover {
    width: min(54vw, 220px); height: min(54vw, 220px);
    border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    margin-bottom: 1rem; animation: none !important;
  }
  .mini-player.mobile-modal .player-exp-main {
    flex-direction: column; align-items: center;
    border-top: none; padding-top: 0; gap: 0; width: 100%;
  }
  .mini-player.mobile-modal .player-exp-center {
    align-items: center; text-align: center; width: 100%; gap: 0.4rem;
  }
  .mini-player.mobile-modal .player-exp-title { font-size: 1.3rem; white-space: normal; }
  .mini-player.mobile-modal .player-exp-artist { font-size: 0.95rem; margin-bottom: 0.9rem; }
  .mini-player.mobile-modal .player-exp-prog { width: 100%; margin-bottom: 0.9rem; gap: 0.5rem; }
  .mini-player.mobile-modal .player-progress { height: 5px; }
  .mini-player.mobile-modal .player-progress:hover { height: 8px; margin-top: -1.5px; }
  .mini-player.mobile-modal .player-time { font-size: 0.78rem; }
  .mini-player.mobile-modal .player-exp-right {
    flex-direction: column; align-items: center; gap: 1.5rem; width: 100%;
  }
  .mini-player.mobile-modal .player-exp-right .player-controls { gap: 1rem; justify-content: center; }
  .mini-player.mobile-modal .player-exp-right .player-btn { width: 54px; height: 54px; font-size: 1.4rem; }
  .mini-player.mobile-modal .player-exp-right .player-btn-play {
    width: 68px; height: 68px; font-size: 1.5rem;
    box-shadow: 0 8px 28px rgba(99,102,241,0.5);
  }
  .mini-player.mobile-modal .player-exp-right .player-platforms { display: flex; justify-content: center; gap: 0.75rem; }
  .mini-player.mobile-modal .player-platform-btn { padding: 0.5rem 1.2rem; font-size: 0.85rem; border-radius: 25px; }
  .mini-player.mobile-modal .player-platform-btn span { display: inline; }
  .mini-player.mobile-modal .player-close {
    position: absolute; top: env(safe-area-inset-top, 12px); right: 1rem;
    width: 40px; height: 40px; font-size: 1.1rem;
  }
  .mini-player.mobile-modal .player-mobile-pn { display: grid; width: 100%; margin-top: auto; padding-top: 0.75rem; }
  .mini-player.mobile-modal .player-queue-section { display: none !important; }
}

@media (max-width: 480px) {
  /* Manter 84px — consistente com HEIGHT_MIN do JS */
  .player-bar { height: 90px; }
}