/* ══════════════════════════════════════════════════════════════════
   Beartify – mini-player.css  (PiP 320 × 320 + Tauri natif)
   Aucune dépendance à background.js / background.css.
══════════════════════════════════════════════════════════════════ */

html, body {
  width: 100% !important; height: 100% !important;
  margin: 0 !important; padding: 0 !important;
  overflow: hidden !important;
}
*, *::before, *::after { box-sizing: border-box; }

/* ── Racine ───────────────────────────────────────────────────────── */
.mp-root {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  position: relative;
  /* Couleurs par défaut — visibles immédiatement, avant toute sync JS */
  background: #000;
  color: #fff;
}

/* ── Header compact (cover 40px + padding 6px = 52px) ───────────── */
.mp-header {
  flex: 0 0 52px;
  display: flex; flex-direction: row; align-items: center;
  gap: 10px; padding: 6px 10px;
  overflow: hidden; position: relative; z-index: 2;
}
.mp-cover-thumb {
  flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 6px; overflow: hidden; cursor: pointer;
}
.mp-cover-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.3s ease;
}
.mp-cover-thumb:hover img { transform: scale(1.06); }
.mp-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  position: relative; z-index: 2;
}
.mp-title-wrap, .mp-artist-wrap {
  overflow: hidden; white-space: nowrap; min-width: 0;
}
.mp-title-wrap .marquee-inner {
  display: inline-block; white-space: nowrap;
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: -0.01em; font-family: 'DM Sans', sans-serif;
}
.mp-artist-wrap .marquee-inner {
  display: inline-block; white-space: nowrap;
  font-size: 0.68rem; font-weight: 400;
  font-family: 'DM Sans', sans-serif;
}

/* ════════════════════════════════════════════════════════════════
   ZONE PAROLES / QUEUE — empilées l'une sur l'autre,
   avec un canvas dynbg DERRIÈRE (z-index 0)
   ════════════════════════════════════════════════════════════════ */

/* Conteneur qui empile canvas + paroles + queue */
.mp-content {
  flex: 1 1 0; min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Canvas fond dynamique WebGL (ImmersiveBgRenderer de background.js) */
.mp-dynbg-canvas {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  display: block;
}

.mp-lyrics-slot {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mp-queue-slot {
  position: absolute; inset: 0; z-index: 2;
  display: none; flex-direction: column;
  overflow-y: scroll; overflow-x: hidden;
  padding: 4px 0;
}
.mp-queue-slot.active { display: flex; }
.mp-queue-slot::-webkit-scrollbar { width: 5px; }
.mp-queue-slot::-webkit-scrollbar-track { background: transparent; }
.mp-queue-slot::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.30);
  border-radius: 3px;
}
.mp-queue-slot::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.55); }

/* Items queue */
.mp-q-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; cursor: pointer; flex-shrink: 0;
  border-radius: 6px; margin: 0 4px;
  transition: background 0.15s;
}
.mp-q-item:hover { background: rgba(255,255,255,0.08); }
.mp-q-thumb {
  width: 30px; height: 30px; border-radius: 4px;
  object-fit: cover; flex-shrink: 0; background: rgba(255,255,255,0.08);
}
.mp-q-info { min-width: 0; flex: 1; }
.mp-q-title {
  font-size: 0.73rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-q-artist {
  font-size: 0.62rem; opacity: 0.55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-q-dur { font-size: 0.60rem; opacity: 0.45; flex-shrink: 0; }

/* ── Overlay cover plein écran au survol ────────────────────────── */
.mp-cover-overlay {
  position: fixed; top: 100%; left: 0;
  width: 100%; height: 100%;
  overflow: hidden; pointer-events: none; z-index: 20;
  transition: top 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.mp-root.cover-expanded .mp-cover-overlay { top: 0; pointer-events: auto; }
/* Tauri : activer l'overlay aussi via :hover CSS pur (plus fiable que JS dans WebView2) */
html[data-runtime="tauri"] .mp-root:hover .mp-cover-overlay { top: 0; pointer-events: auto; }
.mp-overlay-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.mp-cover-controls {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  padding: 10px 14px 14px;
  background: linear-gradient(to bottom,
    rgba(0,0,0,0) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0.78) 100%);
}

/* Boutons haut (queue + dynbg) */
.mp-overlay-top {
  display: flex; justify-content: flex-end;
  gap: 7px; margin-bottom: auto;
}
.mp-icon-btn {
  background: rgba(255,255,255,0.14);
  border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s, transform 0.15s;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mp-icon-btn:hover { background: rgba(255,255,255,0.28); transform: scale(1.08); }
.mp-icon-btn.active { background: rgba(255,255,255,0.90); }
.mp-icon-btn.active img { filter: invert(1); }
.mp-icon-btn img {
  width: 13px; height: 13px; object-fit: contain;
  filter: brightness(10) saturate(0);
}

/* Transport */
.mp-transport {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 10px;
}
.mp-ctrl-btn {
  background: none; border: none; cursor: pointer; padding: 6px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  opacity: 0.82; transition: opacity 0.15s, transform 0.15s;
}
.mp-ctrl-btn:hover { opacity: 1; transform: scale(1.12); }
.mp-ctrl-icon {
  width: 18px; height: 18px; object-fit: contain;
  filter: brightness(10) saturate(0);
}
.mp-play-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #fff; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 3px 14px rgba(0,0,0,0.45);
}
.mp-play-btn:hover { transform: scale(1.08); }
/* Icône noire sur fond blanc */
.mp-play-icon { width: 20px; height: 20px; object-fit: contain; filter: invert(1) brightness(0); }

/* Barre de progression */
.mp-progress-row {
  display: flex; align-items: center; gap: 7px;
}
.mp-time {
  font-size: 0.60rem; color: rgba(255,255,255,0.70);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  font-family: 'DM Sans', sans-serif; min-width: 26px;
}
.mp-time.end { text-align: right; }
.mp-prog-track {
  flex: 1; height: 3px; background: rgba(255,255,255,0.28);
  border-radius: 2px; cursor: pointer; position: relative;
  transition: height 0.12s ease;
}
.mp-prog-track:hover { height: 5px; }
.mp-prog-fill {
  height: 100%; width: 0%;
  background: #fff; border-radius: inherit; pointer-events: none;
  transition: width 0.25s linear;
}
.mp-prog-track:active .mp-prog-fill { transition: none; }

/* ══════════════════════════════════════════════════════════════════
   OVERRIDES style.css pour le PiP compact
   Les deux sélecteurs couvrent :
     • #lyricsDisplay        → onglet Paroles du document principal
     • #lyricsDisplayMirror  → clone miroir injecté dans la fenêtre PiP
══════════════════════════════════════════════════════════════════ */
#lyricsDisplay,
#lyricsDisplayMirror {
  mask-image: none !important;
  -webkit-mask-image: none !important;
  --DefaultLyricsSize: 1.65rem !important;
}
#lyricsDisplay .spicy-scroll-container,
#lyricsDisplayMirror .spicy-scroll-container {
  padding: 0 10px 60px !important;
  margin: 0 !important;
}
/* Lignes normales : espace inter-ligne réduit */
#lyricsDisplay .line:not(.musical-line),
#lyricsDisplayMirror .line:not(.musical-line) {
  margin-bottom: 0.12em !important;
}
/* Dots musicaux — toujours compacts (pas uniquement quand Active) */
#lyricsDisplay .line.musical-line,
#lyricsDisplayMirror .line.musical-line {
  margin: 0.02em 0 !important;
}
#lyricsDisplay .line.musical-line.Active,
#lyricsDisplayMirror .line.musical-line.Active {
  height: calc(var(--DefaultLyricsSize, 1.65rem) * 0.9) !important;
}

/* ══════════════════════════════════════════════════════════════════
   TAURI DESKTOP — fenêtre native sans décorations
   Activé via data-runtime="tauri" sur <html> (injecté par mini-player.html)
══════════════════════════════════════════════════════════════════ */

/* Fond solide (transparent:false requis pour WebView2 sur Windows sans config Rust) */
html[data-runtime="tauri"] body {
  background: #0d0d0d;
}
html[data-runtime="tauri"] .mp-root {
  background: #0d0d0d;
}
/* Séparateur subtil en haut pour délimiter la fenêtre sans décorations */
html[data-runtime="tauri"] .mp-header {
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* Header draggable — permet de déplacer la fenêtre en tirant sur le header */
html[data-runtime="tauri"] .mp-header {
  -webkit-app-region: drag;
  cursor: grab;
}
/* Les éléments interactifs dans le header NE doivent PAS être draggables */
html[data-runtime="tauri"] .mp-header button,
html[data-runtime="tauri"] .mp-header a,
html[data-runtime="tauri"] .mp-header .mp-cover-thumb {
  -webkit-app-region: no-drag;
  cursor: pointer;
}

/* ── Styles propres à mini-player.html (fenêtre Tauri standalone) ── */

/* Réinitialisation base pour la page standalone */
html[data-runtime="tauri"] {
  width: 100%;
  height: 100%;
}

/* Barre de paroles active dans la vue Tauri standalone */
.tauri-lyric-line {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.80rem;
  font-weight: 600;
  line-height: 1.4;
  color: #ffffff;
  text-align: center;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.tauri-lyric-line.active {
  opacity: 1;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255,255,255,0.5);
}
.tauri-lyric-line.inactive {
  opacity: 0.35;
  font-weight: 400;
}

/* Bouton fermeture discret (coin haut droit) pour la fenêtre Tauri */
.tauri-close-btn {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 100;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
  -webkit-app-region: no-drag;
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  line-height: 1;
}
html[data-runtime="tauri"] .mp-root:hover .tauri-close-btn { opacity: 1; }
.tauri-close-btn:hover { background: rgba(220,50,50,0.7) !important; }