/* =========================================================
   WP Audio Player Pro — CSS v2.0
   Design "barre inline" — fidèle à l'image de référence
   ========================================================= */

:root {
  --wapp-primary : #6c63ff;
  --wapp-accent  : #ff6584;
  --wapp-radius  : 8px;
  --wapp-bg      : #12131f;
  --wapp-fg      : #ffffff;
  --wapp-trans   : all .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────── */
.wapp-player-wrap *,
.wapp-playlist-wrap * {
  box-sizing: border-box;
  margin: 0; padding: 0; border: none; background: none;
}

/* ══════════════════════════════════════════════════════════
   BARRE PRINCIPALE  — layout horizontal une seule ligne
══════════════════════════════════════════════════════════ */
.wapp-player-wrap.wapp-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--wapp-bg);
  border-radius: var(--wapp-radius);
  padding: 0 10px;
  height: 48px;                  /* hauteur fixe comme l'image */
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--wapp-fg);
  overflow: hidden;
  position: relative;
  margin: 12px 0;
  /* Ombre subtile */
  box-shadow: 0 2px 16px rgba(0,0,0,.5);
}

/* ── Boutons génériques ─────────────────────────────────── */
.wapp-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  opacity: .85;
  transition: var(--wapp-trans);
  background: none !important;
  border: none !important;
  outline: none;
}
.wapp-bar-btn svg { width: 17px; height: 17px; display: block; pointer-events: none; }
.wapp-bar-btn:hover  { opacity: 1; background: rgba(255,255,255,.08) !important; border-radius: 6px; }
.wapp-bar-btn:focus-visible { outline: 2px solid var(--wapp-primary); outline-offset: 2px; }

/* ── Bouton PLAY — cercle plein violet ──────────────────── */
.wapp-bar-play {
  width: 34px !important;
  height: 34px !important;
  background: var(--wapp-primary) !important;
  border-radius: 50% !important;
  opacity: 1 !important;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(108,99,255,.55);
  transition: transform .15s, box-shadow .15s;
}
.wapp-bar-play svg { width: 16px; height: 16px; }
.wapp-bar-play:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 14px rgba(108,99,255,.7);
  background: var(--wapp-primary) !important;
}

/* Bouton mute — icône bleue/grise comme l'image */
.wapp-bar-mute { opacity: .75; }
.wapp-bar-mute svg { width: 18px; height: 18px; }
.wapp-bar-mute.muted .wapp-icon-vol-on  { display: none !important; }
.wapp-bar-mute.muted .wapp-icon-vol-off { display: block !important; }
.wapp-bar-mute.muted { opacity: .45; }

/* ── Boutons actions droite ─────────────────────────────── */
.wapp-bar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.wapp-bar-loop.active { color: var(--wapp-primary); opacity: 1; }
.wapp-bar-loop svg,
.wapp-bar-share svg,
.wapp-bar-download svg { width: 17px; height: 17px; }

/* Bouton vitesse — texte "1×" style badge */
.wapp-bar-speed {
  font-size: 11px;
  font-weight: 700;
  width: auto !important;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 5px !important;
  letter-spacing: .02em;
  background: rgba(255,255,255,.09) !important;
  opacity: .85;
}
.wapp-bar-speed:hover { background: rgba(255,255,255,.16) !important; opacity: 1; }

/* Menu vitesse */
.wapp-bar-speed-wrap { position: relative; }
.wapp-bar-speed-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: #1e1f35;
  border-radius: 8px;
  padding: 4px;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 68px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.07);
}
.wapp-bar-speed-menu.open { display: flex; }
.wapp-bar-speed-menu button {
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  color: #fff;
  transition: background .12s;
}
.wapp-bar-speed-menu button:hover  { background: rgba(255,255,255,.1); }
.wapp-bar-speed-menu button.active { color: var(--wapp-primary); font-weight: 700; }

/* ── Timer ──────────────────────────────────────────────── */
.wapp-bar-timer {
  flex-shrink: 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: .5;
  min-width: 32px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   WAVEFORM — zone centrale, prend tout l'espace restant
   Design : barres blanches très denses, fines, serrées
   Barres jouées = violet (--wapp-primary)
   Barre active = accent animé
══════════════════════════════════════════════════════════ */
.wapp-bar-wave-wrap {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;           /* hauteur waveform = ~70% de la barre */
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 3px;
}

/* Conteneur flex des barres */
.wapp-bar-wave {
  display: flex;
  align-items: center;       /* centrage vertical des barres */
  gap: 1.5px;                /* espacement minimal comme l'image */
  height: 100%;
  width: 100%;
  padding: 2px 0;
}

/* Chaque barre individuelle */
.wapp-bar-wbar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 1px;
  background: rgba(255, 255, 255, .28);   /* blanc translucide par défaut */
  transition: background .1s;
  /* la hauteur % est définie inline par PHP */
}

/* Barres déjà jouées → violet */
.wapp-bar-wbar.played {
  background: var(--wapp-primary);
  opacity: .9;
}

/* Barre active (position courante) → accent + pulse */
.wapp-bar-wbar.active {
  background: var(--wapp-accent);
  animation: wbar-pulse .45s ease infinite alternate;
}
@keyframes wbar-pulse { to { transform: scaleY(1.25); } }

/* Overlay transparent pour capter les clics / seek */
.wapp-bar-wave-seek {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 2;
  cursor: pointer;
}

/* Curseur de position — ligne fine verticale violette */
.wapp-bar-cursor {
  position: absolute;
  top: 0; bottom: 0;
  left: 0%;
  width: 2px;
  background: var(--wapp-primary);
  border-radius: 1px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: left .1s linear;
  box-shadow: 0 0 4px var(--wapp-primary);
}
.wapp-bar-wave-wrap:hover .wapp-bar-cursor { opacity: .6; }
.wapp-player-wrap.wapp-playing .wapp-bar-cursor { opacity: 1; }

/* ── Overlay "Cliquez pour activer le son" ─────────────── */
.wapp-unmute-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 25, .72);
  backdrop-filter: blur(3px);
  border-radius: inherit;
  cursor: pointer;
  animation: wapp-fadeIn .2s ease;
}
.wapp-unmute-overlay.wapp-unmute-fading { animation: wapp-fadeOut .35s ease forwards; }
.wapp-unmute-inner  { display: flex; align-items: center; gap: 8px; pointer-events: none; }
.wapp-unmute-icon   { font-size: 20px; animation: wapp-icon-pulse 1.3s ease infinite; }
.wapp-unmute-label  { font-size: 13px; font-weight: 600; color: #fff; letter-spacing: .02em; white-space: nowrap; }
@keyframes wapp-icon-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
@keyframes wapp-fadeIn     { from{opacity:0} to{opacity:1} }
@keyframes wapp-fadeOut    { from{opacity:1} to{opacity:0} }

/* Pulse ring sur play quand muted-autoplay */
.wapp-muted-autoplay .wapp-bar-play {
  animation: wapp-ring 1.8s ease infinite;
}
@keyframes wapp-ring {
  0%,100% { box-shadow: 0 2px 10px rgba(108,99,255,.55); }
  50%      { box-shadow: 0 0 0 6px rgba(108,99,255,.18), 0 2px 10px rgba(108,99,255,.55); }
}

/* ── Toast ──────────────────────────────────────────────── */
.wapp-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: #1a1b2e; color: #fff;
  padding: 11px 20px; border-radius: 9px;
  font-size: 13px; font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 6px 28px rgba(0,0,0,.4);
  z-index: 999999; opacity: 0;
  transition: opacity .28s, transform .28s;
  pointer-events: none; white-space: nowrap;
  border-left: 3px solid #6c63ff;
}
.wapp-toast.wapp-toast-success { border-left-color: #4caf50; }
.wapp-toast.wapp-toast-error   { border-left-color: #ff6584; }
.wapp-toast.wapp-toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Sticky ─────────────────────────────────────────────── */
.wapp-sticky {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 9999; border-radius: 0; margin: 0;
  max-width: 100% !important;
}

/* ── Erreur ─────────────────────────────────────────────── */
.wapp-error { color: #ff6584; font-size: 13px; padding: 6px 0; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .wapp-player-wrap.wapp-bar { height: 44px; padding: 0 8px; gap: 4px; }
  .wapp-bar-play { width: 30px !important; height: 30px !important; }
  /* Cacher le timer sur très petits écrans */
  .wapp-bar-timer { display: none; }
  /* Garder au minimum speed + loop */
  .wapp-bar-share, .wapp-bar-download { display: none; }
  .wapp-bar-wave  { gap: 1px; }
}

@media (max-width: 360px) {
  .wapp-bar-speed { display: none; }
}

/* ══════════════════════════════════════════════════════════
   PLAYLIST (conservée)
══════════════════════════════════════════════════════════ */
.wapp-playlist-wrap {
  border-radius: var(--wapp-radius);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; margin: 16px 0;
}
.wapp-playlist-wrap.theme-dark    { background: #12131f; color: #e0e0e0; box-shadow: 0 8px 32px rgba(0,0,0,.45); }
.wapp-playlist-wrap.theme-light   { background: #fff; color: #222; box-shadow: 0 4px 24px rgba(0,0,0,.12); border: 1px solid #e0e0e0; }
.wapp-playlist-wrap.theme-minimal { background: #f5f5f7; color: #333; }
.wapp-playlist-wrap.theme-glass   { background: rgba(255,255,255,.12); backdrop-filter: blur(20px); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.wapp-pl-player { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.06); background: rgba(0,0,0,.15); }
.theme-light .wapp-pl-player,
.theme-minimal .wapp-pl-player { background: rgba(0,0,0,.03); border-bottom-color: rgba(0,0,0,.08); }
.wapp-pl-artwork { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.wapp-pl-artwork img { width: 100%; height: 100%; object-fit: cover; }
.wapp-pl-info   { flex: 1; min-width: 0; }
.wapp-pl-title  { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wapp-pl-artist { font-size: 12px; opacity: .6; margin-top: 2px; }
.wapp-pl-controls { display: flex; align-items: center; gap: 4px; }
.wapp-pl-btn-big { width: 44px; height: 44px; background: var(--wapp-primary) !important; color: #fff !important; border-radius: 50%; opacity: 1 !important; box-shadow: 0 4px 16px rgba(108,99,255,.4); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wapp-pl-btn-big:hover { transform: scale(1.08); }
.wapp-pl-btn-shuffle.active,
.wapp-pl-btn-loop.active { color: var(--wapp-primary) !important; opacity: 1 !important; }
.wapp-pl-progress-wrap { width: 100%; display: flex; align-items: center; gap: 8px; font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }
.wapp-pl-progress { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); cursor: pointer; position: relative; overflow: visible; }
.theme-light .wapp-pl-progress,
.theme-minimal .wapp-pl-progress { background: rgba(0,0,0,.1); }
.wapp-pl-progress-fill  { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--wapp-primary); border-radius: 2px; transition: width .1s linear; }
.wapp-pl-progress-thumb { position: absolute; top: 50%; left: 0%; width: 12px; height: 12px; border-radius: 50%; background: var(--wapp-primary); transform: translate(-50%,-50%) scale(0); transition: transform .15s; }
.wapp-pl-progress:hover .wapp-pl-progress-thumb { transform: translate(-50%,-50%) scale(1); }
.wapp-pl-list { max-height: 380px; overflow-y: auto; }
.wapp-pl-list::-webkit-scrollbar { width: 4px; }
.wapp-pl-list::-webkit-scrollbar-track { background: transparent; }
.wapp-pl-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.wapp-pl-list-header { display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-size: 11px; opacity: .5; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid rgba(255,255,255,.06); position: sticky; top: 0; background: inherit; z-index: 1; }
.wapp-pl-track { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background .15s; }
.wapp-pl-track:hover { background: rgba(255,255,255,.05); }
.theme-light .wapp-pl-track:hover,
.theme-minimal .wapp-pl-track:hover { background: rgba(0,0,0,.04); }
.wapp-pl-track.active { background: rgba(108,99,255,.12); }
.wapp-pl-track.active .wapp-pl-track-title { color: var(--wapp-primary); }
.wapp-pl-num { width: 24px; flex-shrink: 0; text-align: center; font-size: 12px; opacity: .5; position: relative; }
.wapp-pl-play-icon { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: var(--wapp-primary); font-size: 12px; }
.wapp-pl-track:hover .wapp-pl-num > *:first-child { display: none; }
.wapp-pl-track:hover .wapp-pl-play-icon { display: flex; }
.wapp-pl-track.active .wapp-pl-num > *:first-child { display: none; }
.wapp-pl-track.active .wapp-pl-play-icon { display: flex; }
.wapp-pl-thumb { width: 36px; height: 36px; flex-shrink: 0; border-radius: 6px; overflow: hidden; }
.wapp-pl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wapp-pl-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.08); border-radius: 6px; font-size: 16px; }
.wapp-pl-info-col { flex: 1; min-width: 0; }
.wapp-pl-track-title  { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wapp-pl-track-artist { display: block; font-size: 11px; opacity: .5; }
.wapp-pl-dur { font-size: 12px; opacity: .5; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.wapp-pl-actions { display: flex; gap: 4px; flex-shrink: 0; }
.wapp-pl-act-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; opacity: .4; transition: opacity .15s; font-size: 13px; text-decoration: none; color: inherit; }
.wapp-pl-act-btn:hover { opacity: 1; }
.wapp-pl-col-num  { width: 24px; flex-shrink: 0; }
.wapp-pl-col-img  { width: 36px; flex-shrink: 0; }
.wapp-pl-col-info { flex: 1; }
.wapp-pl-col-dur  { width: 48px; flex-shrink: 0; }
.wapp-pl-col-acts { width: 64px; flex-shrink: 0; }
@media (max-width: 600px) {
  .wapp-pl-col-dur, .wapp-pl-col-acts,
  .wapp-pl-dur, .wapp-pl-actions { display: none; }
}
