/* ============================================================
   CCAP Glass — Spotify-style player bar
   ============================================================ */

/* Material Symbols */
.material-symbols-rounded.cgap-mi {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
  display: block;
}

/* CSS variables */
:root {
  --cgap-blue:    #0000de;
  --cgap-green:   #1db954;
  --cgap-green-h: #1ed760;
  --cgap-bg:      #181818;
  --cgap-stroke:  rgba(255,255,255,0.08);
  --cgap-text:    #fff;
  --cgap-muted:   #a7a7a7;
  --cgap-z:       2147483000;
  --cgap-bar-h:   84px;
  /* Retrait sidebar — défini par le thème via --sb */
  --cgap-bar-left: var(--sb, 0px);
}

/* ============================================================
   Shortcode bouton ÉCOUTER
   ============================================================ */
.cgap-audio { display: grid; place-items: center; margin: 24px 0 28px; color: #111; }
.cgap-btn {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px;
  border-radius: 999px; border: 0; background: var(--cgap-blue); color: #fff;
  cursor: pointer; transition: transform 0.15s, filter 0.15s;
  outline: none; -webkit-tap-highlight-color: transparent;
}
.cgap-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cgap-btn .cgap-mi, .cgap-btn .cgap-label, .cgap-btn .cgap-total-min { color: #fff; }
.cgap-btn .cgap-label { font-weight: 800; letter-spacing: 0.2px; }
.cgap-btn .cgap-total-min { font-size: 12px; opacity: 0.95; }
.cgap-btn-inner { display: inline-flex; align-items: center; gap: 12px; }
.cgap-variant-overlay .cgap-btn { padding: 10px 14px; }
.cgap-variant-overlay .cgap-total-min { display: none; }
.cgap-btn.cgap-btn-primary .cgap-mi-play,
.cgap-btn.cgap-btn-primary .cgap-mi-pause { color: #fff !important; }

/* ============================================================
   Barre fixe — wrapper
   ============================================================ */
#cgap-global-bar.cgap-bar {
  position: fixed;
  left: var(--cgap-bar-left);
  right: 0;
  bottom: 0;
  z-index: var(--cgap-z);
  pointer-events: none;
  background: transparent !important;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s;
}
#cgap-global-bar.cgap-bar.cgap-hidden  { transform: translateY(110%); opacity: 0; }
#cgap-global-bar.cgap-bar.cgap-force-visible { transform: translateY(0) !important; opacity: 1 !important; }

/* ============================================================
   Surface sombre avec blur
   ============================================================ */
.cgap-bar-surface {
  pointer-events: auto;
  width: 100%;
  height: var(--cgap-bar-h);
  background: var(--cgap-bg);
  border-top: 1px solid var(--cgap-stroke);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 10px 16px;
}

/* ============================================================
   Grille 3 colonnes (comme Spotify)
   ============================================================ */
.cgap-spotify-main {
  display: grid;
  grid-template-columns: minmax(180px, 30%) 1fr minmax(180px, 30%);
  align-items: center;
  width: 100%;
  height: 100%;
  gap: 8px;
}

/* ============================================================
   Colonne gauche : cover + info piste
   ============================================================ */
.cgap-bar-left { min-width: 0; display: flex; align-items: center; }
.cgap-now-btn {
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; padding: 4px; margin: 0;
  color: inherit; text-align: left; cursor: pointer;
  border-radius: 4px; min-width: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.cgap-now-btn:hover { background: rgba(255,255,255,0.07); }
.cgap-thumb-wrap {
  flex-shrink: 0; width: 56px; height: 56px;
  border-radius: 4px; overflow: hidden; background: #333;
}
.cgap-thumb-wrap .cgap-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cgap-track-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cgap-bar-left .cgap-track-title {
  font-size: 13px; font-weight: 600; line-height: 1.2; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cgap-bar-left .cgap-track-artist {
  font-size: 11px; color: var(--cgap-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================
   Colonne centre : contrôles + timeline
   ============================================================ */
.cgap-bar-center {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; min-width: 0; padding: 0 8px;
}

/* --- 5 boutons : shuffle · prev · play · next · repeat --- */
.cgap-controls-trio {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Bouton générique */
.cgap-ctrl {
  background: transparent; border: 0; color: var(--cgap-muted);
  cursor: pointer; padding: 6px; border-radius: 50%;
  transition: color 0.12s, background 0.12s, transform 0.1s;
  outline: none; -webkit-tap-highlight-color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cgap-ctrl .cgap-mi { color: inherit; font-size: 20px; }
.cgap-ctrl:hover:not(:disabled) { color: #fff; }

/* Boutons extra (shuffle / repeat) */
.cgap-ctrl--extra .cgap-mi { font-size: 18px; }
.cgap-ctrl--extra.cgap-active {
  color: var(--cgap-green) !important;
  position: relative;
}
/* Pastille verte sous le bouton actif */
.cgap-ctrl--extra.cgap-active::after {
  content: "";
  position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cgap-green);
}

/* Boutons nav (prev / next) */
.cgap-ctrl--nav .cgap-mi { font-size: 22px; color: var(--cgap-muted); }
.cgap-ctrl--nav:not(:disabled):hover { color: #fff; }
.cgap-ctrl--nav:disabled { opacity: 0.35; cursor: default; }

/* Bouton play central */
.cgap-ctrl-play {
  background: #fff !important;
  color: #000 !important;
  width: 36px; height: 36px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: transform 0.1s, box-shadow 0.12s;
  padding: 0;
}
.cgap-ctrl-play .cgap-mi { font-size: 22px; color: #000 !important; }
.cgap-ctrl-play .cgap-mi-pause { display: none; }
.cgap-ctrl-play:hover { transform: scale(1.06); box-shadow: 0 4px 14px rgba(0,0,0,.5); }

/* État lecture */
#cgap-global-bar.is-playing .cgap-ctrl-play .cgap-mi-play,
#cgap-fullscreen.is-playing .cgap-ctrl-play .cgap-mi-play { display: none; }
#cgap-global-bar.is-playing .cgap-ctrl-play .cgap-mi-pause,
#cgap-fullscreen.is-playing .cgap-ctrl-play .cgap-mi-pause { display: block; }

/* --- Timeline inline : [0:00] ——barre—— [--:--] --- */
.cgap-timeline-row {
  display: flex; align-items: center; gap: 8px; width: 100%; max-width: 720px;
}
.cgap-time {
  font-size: 10px; color: var(--cgap-muted); white-space: nowrap;
  width: 36px; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.cgap-current { text-align: right; }
.cgap-total   { text-align: left; }

.cgap-timeline {
  flex: 1;
  /* Hauteur = zone de clic uniquement — pas de background ici */
  height: 16px;
  background: transparent;
  cursor: pointer; touch-action: none; user-select: none;
  position: relative;
  display: flex; align-items: center;
}
/* Piste visuelle via pseudo-élément — indépendante de la zone de clic */
.cgap-timeline::before {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 1.5px; border-radius: 1px;
  background: rgba(255,255,255,0.18);
  transition: height 0.1s ease, background 0.15s;
  pointer-events: none;
}
.cgap-timeline:hover::before,
.cgap-timeline.cgap-pressing::before { height: 2.5px; background: rgba(255,255,255,0.25); }
.cgap-progress {
  position: absolute; left: 0; width: 0;
  top: 50%; transform: translateY(-50%);
  height: 1.5px;
  border-radius: 1px; background: var(--cgap-blue);
  transition: height 0.1s ease;
  pointer-events: none;
}
.cgap-timeline:hover .cgap-progress,
.cgap-timeline.cgap-pressing .cgap-progress { height: 2.5px; }
/* Thumb knob */
.cgap-thumb-knob {
  position: absolute; right: -4px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5);
  opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
.cgap-timeline:hover .cgap-thumb-knob,
.cgap-timeline.cgap-pressing .cgap-thumb-knob { opacity: 1; }
.cgap-timeline.cgap-pressing .cgap-thumb-knob { transform: translateY(-50%) scale(1.15); }

/* ============================================================
   Colonne droite : volume + vitesse + intégrer
   ============================================================ */
.cgap-right {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  position: relative;
}
.cgap-right-inline { display: flex; align-items: center; gap: 6px; }

/* Volume */
.cgap-vol-group { display: flex; align-items: center; gap: 6px; }
.cgap-vol-btn .cgap-mi { font-size: 18px; }
.cgap-vol-track {
  width: 80px; height: 16px;
  background: transparent;
  cursor: pointer; touch-action: none; user-select: none;
  position: relative; display: flex; align-items: center;
}
.cgap-vol-track::before {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 1.5px; border-radius: 1px;
  background: rgba(255,255,255,0.18);
  transition: height 0.1s ease;
  pointer-events: none;
}
.cgap-vol-track:hover::before,
.cgap-vol-track.cgap-pressing::before { height: 2.5px; }
.cgap-vol-fill {
  position: absolute; left: 0;
  top: 50%; transform: translateY(-50%);
  height: 1.5px; border-radius: 1px;
  background: var(--cgap-blue);
  transition: height 0.1s ease;
  pointer-events: none;
}
.cgap-vol-track:hover .cgap-vol-fill,
.cgap-vol-track.cgap-pressing .cgap-vol-fill { height: 2.5px; }
.cgap-vol-knob {
  position: absolute; right: -4px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5);
  opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
.cgap-vol-track:hover .cgap-vol-knob,
.cgap-vol-track.cgap-pressing .cgap-vol-knob { opacity: 1; }

/* Vitesse */
.cgap-ctrl--secondary .cgap-mi { font-size: 18px; }
.cgap-speed-menu-wrap { position: relative; }
.cgap-speed-menu[hidden] { display: none !important; }
.cgap-speed-menu:not([hidden]) { display: flex; }
.cgap-speed-menu {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: #282828; color: #fff; border: 1px solid #3e3e3e;
  border-radius: 8px; padding: 6px; flex-direction: column; gap: 2px;
  z-index: 10; min-width: 90px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.cgap-speed-item {
  display: flex; width: 100%; background: transparent; border: 0;
  color: #fff; padding: 7px 10px; border-radius: 4px; cursor: pointer;
  align-items: center;
}
.cgap-speed-item.is-active { color: var(--cgap-blue); background: #fff; border-radius: 4px; }
.cgap-speed-item:hover { background: rgba(255,255,255,0.1); }

/* Menu "plus" (mobile) */
.cgap-more[hidden] { display: none !important; }
@media (min-width: 561px) { .cgap-more { display: none; } }
@media (max-width: 560px) { .cgap-right-inline { display: none; } .cgap-more { display: block; } }
.cgap-more-menu[hidden] { display: none !important; }
.cgap-more-menu {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: #282828; border: 1px solid #3e3e3e; border-radius: 8px;
  padding: 8px; z-index: 10; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 4px;
}

/* ============================================================
   Mobile compact (≤ 768px) : left + play seulement
   ============================================================ */
.cgap-bar-compact-r { display: none; align-items: center; justify-content: flex-end; }

@media (max-width: 768px) {
  #cgap-global-bar.cgap-bar { left: 0; }
  .cgap-bar-surface { padding: 0 12px; }
  .cgap-spotify-main { grid-template-columns: 1fr auto; }
  .cgap-bar-center { display: none; }
  .cgap-right { display: none; }
  .cgap-bar-compact-r { display: flex; }
  .cgap-ctrl.cgap-mobile-ctrl-play { width: 40px; height: 40px; }
}

/* ============================================================
   Overlay plein écran mobile
   ============================================================ */
#cgap-fullscreen.cgap-fullscreen[hidden] { display: none !important; }
.cgap-fullscreen { position: fixed; inset: 0; z-index: calc(var(--cgap-z) + 1); }
.cgap-fs-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.cgap-fs-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 96vh;
  overflow: auto; background: #121212; color: #fff;
  border-radius: 16px 16px 0 0; padding: 8px 20px 32px;
  box-sizing: border-box; box-shadow: 0 -4px 40px rgba(0,0,0,.6);
}
.cgap-fs-head { display: flex; justify-content: flex-end; padding: 4px 0; }
.cgap-fs-close {
  background: none; border: 0; color: var(--cgap-muted); font-size: 28px;
  line-height: 1; cursor: pointer; padding: 4px 8px;
  border-radius: 50%; transition: color 0.12s, background 0.12s;
}
.cgap-fs-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.cgap-fs-art { text-align: center; margin: 8px 0 16px; }
.cgap-fs-img-wrap { max-width: 260px; margin: 0 auto; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.cgap-fs-img-wrap .cgap-cover,
.cgap-fs-img-wrap .cgap-cover-fs { width: 100%; height: auto; display: block; }
.cgap-fs-meta { margin-top: 16px; }
.cgap-title-fs {
  font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cgap-artist-fs { font-size: 14px; color: var(--cgap-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cgap-fs-controls { margin-top: 12px; }
.cgap-fs-controls .cgap-controls-trio { margin-bottom: 12px; justify-content: center; gap: 16px; }
.cgap-fs-controls .cgap-ctrl-play { width: 52px; height: 52px; }
.cgap-fs-controls .cgap-ctrl-play .cgap-mi { font-size: 28px; }
.cgap-fs-controls .cgap-timeline-row { padding: 0; }
.cgap-fs-controls .cgap-timeline { max-width: none; }
.cgap-fs-bottom { margin-top: 16px; }
.cgap-fs-bottom .cgap-right { position: static; width: 100%; justify-content: center; }
body.cgap-noscroll { overflow: hidden; }

/* ============================================================
   Overlay embed
   ============================================================ */
#cgap-embed-overlay[hidden] { display: none !important; }
.cgap-embed-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); z-index: var(--cgap-z);
}
.cgap-embed-content {
  position: relative; width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow: auto;
  background: #fff; border-radius: 16px; padding: 24px; color: #111;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
}
.cgap-embed-close { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; cursor: pointer; font-size: 20px; color: #666; }
.cgap-embed-h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.cgap-embed-h3 { font-size: 14px; margin: 16px 0 8px; color: #444; }
.cgap-embed-preview { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; background: #fafafa; }
.cgap-embed-code { width: 100%; min-height: 110px; font-family: ui-monospace,monospace; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; resize: vertical; }
.cgap-embed-label { font-size: 13px; color: #555; }
.cgap-embed-copy {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 16px; background: #111; color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: background 0.15s;
}
.cgap-embed-copy:hover { background: #333; }
.cgap-embed-color { border: 1px solid #e5e7eb; border-radius: 6px; height: 32px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  #cgap-global-bar.cgap-bar,
  .cgap-audio .cgap-btn,
  .cgap-timeline,
  .cgap-vol-track { transition: none !important; }
}

/* Compatibilité ancienne classe */
.cgap-spotify-surface { /* alias */ }
