/* ══════════════════════════════════════════════════════════════════
 *  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;
  /* ★ FILTRE CRITIQUE — identique à .imv-bg-canvas dans fullscreen.css et
   *    à .spicy-dynamic-bg dans analyse.js. Sans lui, les couleurs WebGL
   *    (saturation volontairement laissée à 1.0 côté shader, voir ND/ND_PIP
   *    dans fullscreen.js/mini-player.js/mini-player.html) restent ~2,5×
   *    moins éclatantes que l'original — c'est tout l'écart de qualité
   *    perçu entre le mini-player et le site. */
  filter: saturate(2.5) brightness(.65);
  transition: opacity 0.5s ease, filter 0.4s 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; }
/* Plus de règle :hover CSS pure ici — l'expansion Tauri est désormais
 *  pilotée en JS (_bindCoverHover() dans mini-player.html), avec tolérance
 *  mouseleave/relatedTarget, comme le PiP web. Le :hover pur (bornée à la
 *  pochette ou non) n'avait aucune marge : le trou entre la pochette et
 *  l'overlay qui glisse ne laissait pas le temps d'atteindre les boutons. */
.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%);
  /* Les contrôles flottent sur la pochette (une photo), pas sur le fond
   *    thématisé de l'app — ils doivent donc TOUJOURS être blancs, quel que
   *    soit le thème (color hérité de .mp-root, sombre en thème "clair",
   *    rendait certaines icônes quasi invisibles sur la pochette). */
  color: #fff;
}

/* 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);
  /* Un <button> a une couleur par défaut du navigateur (buttontext, noir)
   *    qui NE S'HÉRITE PAS de l'ancêtre malgré .mp-cover-controls{color:#fff} —
   *    il faut la reposer explicitement sur le bouton lui-même. */
  color: #fff;
}
.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); color: #000; }
/* P3-8 : les icônes converties en SVG inline (fill="currentColor") suivent
 *  déjà `color` — plus besoin du hack `filter: invert(1)` sur <img>. Gardé
 *  ci-dessous uniquement pour un éventuel <img> résiduel (défensif). */
.mp-icon-btn.active img { filter: invert(1); }
.mp-icon-btn img,
.mp-icon-btn svg {
  width: 13px; height: 13px; object-fit: contain;
}
.mp-icon-btn img { filter: brightness(10) saturate(0); } /* défensif, <img> résiduel uniquement */

/* 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;
  color: #fff; /* même raison que .mp-icon-btn ci-dessus */
}
.mp-ctrl-btn:hover { opacity: 1; transform: scale(1.12); }
.mp-ctrl-icon {
  width: 18px; height: 18px; object-fit: contain;
}
.mp-ctrl-icon:not(svg) { filter: brightness(10) saturate(0); } /* défensif, mpRepeatIcon reste <img> (voir mini-player.html) */
.mp-play-btn {
  /* Rond blanc retiré — trop imposant pour un mini-player. Même traitement
   *    que .mp-ctrl-btn (icône blanche nue), juste un peu plus grande pour
   *    rester le bouton principal du transport. */
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: transparent; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
  opacity: 0.95;
  color: #fff; /* même raison que .mp-icon-btn ci-dessus */
}
.mp-play-btn:hover { transform: scale(1.1); opacity: 1; }
.mp-play-icon { width: 22px; height: 22px; object-fit: contain; }
.mp-play-icon:not(svg) { filter: brightness(10) saturate(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
 *  Classes réelles générées par spicy-lyrics-engine.js : préfixe "sl2-"
 *  (sl2-line, sl2-musical-line, sl2-Active, sl2-scroll-container…).
 *  Les anciens noms sans préfixe ne correspondaient plus à rien dans le
 *  DOM depuis le renommage côté moteur — ces overrides ne s'appliquaient
 *  donc jamais.
 ═ *═════════════════════════════════════════════════════════════════ */
#lyricsDisplay,
#lyricsDisplayMirror {
mask-image: none !important;
-webkit-mask-image: none !important;
--DefaultLyricsSize: 1.65rem !important;
}
#lyricsDisplay .sl2-scroll-container,
#lyricsDisplayMirror .sl2-scroll-container {
padding: 0 10px 60px !important;
margin: 0 !important;
}
/* Lignes normales : espace inter-ligne réduit */
#lyricsDisplay .sl2-line:not(.sl2-musical-line),
#lyricsDisplayMirror .sl2-line:not(.sl2-musical-line) {
margin-bottom: 0.12em !important;
}
/* Dots musicaux — toujours compacts (pas uniquement quand Active) */
#lyricsDisplay .sl2-line.sl2-musical-line,
#lyricsDisplayMirror .sl2-line.sl2-musical-line {
margin: 0.02em 0 !important;
}
#lyricsDisplay .sl2-line.sl2-musical-line.sl2-Active,
#lyricsDisplayMirror .sl2-line.sl2-musical-line.sl2-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;
}
/* .mp-cover-overlay (frère du header dans le DOM) le RECOUVRE visuellement
 *  une fois déployé — même hors de .mp-header, certains moteurs évaluent le
 *  hit-test de la zone de drag au niveau natif/paint plutôt que selon
 *  l'empilement DOM/CSS, ce qui peut intercepter le premier clic sur un
 *  bouton de l'overlay (ex. fermer) comme un début de glissé de fenêtre au
 *  lieu de le transmettre. Marqué explicitement no-drag pour lever toute
 *  ambiguïté. */
html[data-runtime="tauri"] .mp-cover-overlay {
  -webkit-app-region: no-drag;
}

/* ── 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; }

/* Contraste des lignes inactives — le moteur les affiche assez ternes par
 *  défaut (--gradient-alpha-end: 0.5, voir spicy-lyrics.css). Un simple
 *  bump de cette variable profite à la fois au dégradé blanc (thèmes
 *  sombres) et à l'override noir du thème clair (mini-player.js/.html),
 *  puisque les deux s'appuient dessus. */
#lyricsDisplay .sl2-line,
#lyricsDisplay .sl2-line .sl2-word,
#lyricsDisplay .sl2-line .sl2-letter {
--gradient-alpha-end: 0.75 !important;
}

/* ══════════════════════════════════════════════════════════════════
 *  Fond ambiant par défaut — port de #spicyGlobalBg (style.css, lignes
 *  ~98-215) et de ses 3 calques .spicy-bg-layer .Back/.Center/.Front.
 *  Règles identiques (dégradés radiaux, keyframes, timings) — seul l'ID
 *  racine change (#mpGlobalBg au lieu de #spicyGlobalBg) pour rester
 *  scopé à cette fenêtre. Couleurs pilotées par les mêmes variables CSS
 *  (--VibrantColor, --DarkVibrantColor, etc.), posées par _applyGlobalBg()
 *  dans mini-player.html à partir de la pochette (voir _extractPalette,
 *  porté depuis ui/background-visuals.js).
 ═ *═════════════════════════════════════════════════════════════════ */
#mpGlobalBg {
position: absolute;
inset: 0;
z-index: -2; /* derrière la vidéo (-1) et tout le reste */
pointer-events: none;
overflow: hidden;
background: #060609;
}

@keyframes mpBgAnimBack {
  0%   { transform: scale(1.6) rotate(0deg)   translate3d(0%,  0%,  0); }
  25%  { transform: scale(1.65) rotate(90deg)  translate3d(4%, -3%,  0); }
  50%  { transform: scale(1.6) rotate(180deg) translate3d(-2%, 5%,  0); }
  75%  { transform: scale(1.62) rotate(270deg) translate3d(-4%, -2%, 0); }
  100% { transform: scale(1.6) rotate(360deg) translate3d(0%,  0%,  0); }
}
@keyframes mpBgAnimCenter {
  0%   { transform: scale(1.5) rotate(0deg)    translate3d(0%,  0%,  0); }
  33%  { transform: scale(1.55) rotate(-120deg) translate3d(-5%, 4%,  0); }
  66%  { transform: scale(1.5) rotate(-240deg) translate3d(5%, -3%,  0); }
  100% { transform: scale(1.5) rotate(-360deg) translate3d(0%,  0%,  0); }
}
@keyframes mpBgAnimFront {
  0%   { transform: scale(1.4) rotate(0deg)   translate3d(0%,  0%,  0); }
  20%  { transform: scale(1.45) rotate(72deg)  translate3d(3%,  4%,  0); }
  40%  { transform: scale(1.4) rotate(144deg) translate3d(-4%, 2%,  0); }
  60%  { transform: scale(1.42) rotate(216deg) translate3d(2%, -5%,  0); }
  80%  { transform: scale(1.4) rotate(288deg) translate3d(-3%, 3%,  0); }
  100% { transform: scale(1.4) rotate(360deg) translate3d(0%,  0%,  0); }
}

#mpGlobalBg .spicy-bg-layer {
position: absolute;
inset: -20%;
width: 140%;
height: 140%;
transform-origin: center center;
will-change: transform;
filter: blur(50px) saturate(2.5) brightness(0.65);
}

#mpGlobalBg .spicy-bg-layer.Back {
background: radial-gradient(
  ellipse 80% 70% at 40% 50%,
  rgba(var(--MpVibrantColor,    80,30,160, 0.9)) 0%,
                            rgba(var(--MpDarkVibrantColor, 30,10,80,  0.7)) 45%,
                            rgba(var(--MpMinContrastColor, 8,5,18,    0.95)) 100%
);
animation: mpBgAnimBack 35s linear infinite;
transition: background 0.5s ease;
opacity: 1;
}
#mpGlobalBg .spicy-bg-layer.Center {
background: radial-gradient(
  ellipse 65% 75% at 60% 45%,
  rgba(var(--MpHighContrastColor, 90,40,180, 0.75)) 0%,
                            rgba(var(--MpVibrantColor,      80,30,160, 0.45)) 40%,
                            transparent 75%
),
radial-gradient(
  ellipse 55% 60% at 25% 70%,
  rgba(var(--MpDarkVibrantColor, 30,10,80, 0.60)) 0%,
                transparent 65%
);
animation: mpBgAnimCenter 22s linear infinite;
transition: background 0.5s ease;
opacity: 0.85;
}
#mpGlobalBg .spicy-bg-layer.Front {
background: radial-gradient(
  ellipse 50% 55% at 70% 30%,
  rgba(var(--MpOverlayColor,     110,55,200, 0.55)) 0%,
                            rgba(var(--MpHighContrastColor, 90,40,180, 0.25)) 50%,
                            transparent 75%
),
radial-gradient(
  ellipse 45% 50% at 30% 75%,
  rgba(var(--MpVibrantColor, 80,30,160, 0.40)) 0%,
                transparent 60%
);
animation: mpBgAnimFront 16s linear infinite;
transition: background 0.5s ease;
opacity: 0.70;
}

@media (prefers-reduced-motion: reduce) {
  #mpGlobalBg .spicy-bg-layer { animation-play-state: paused !important; }
}
