/* =========================================================
   🎛 CS STICKY PLAYER — VISION 2027 "NEON DECK"
   Bulletproof, glassmorphic, audio-reactive.
   ========================================================= */

:root {
  --cs-bg-1: #120a1f;
  --cs-bg-2: #1b1333;
  --cs-bg-footer: #0f0a1a;
  --cs-gold: #f5b301;
  --cs-gold-soft: #fec503;
  --cs-gold-royal: #d4af37;
  --cs-orange: #ff8c42;
  --cs-purple: #9d4dff;
  --cs-teal: #00e6d7;
  --cs-white: #ffffff;
  --cs-muted: #eeeeee;
  --cs-gray: #bbbbbb;
  --cs-glow-gold: rgba(245, 179, 1, 0.35);
  --cs-glow-purple: rgba(157, 77, 255, 0.45);
  --cs-glow-teal: rgba(0, 230, 215, 0.35);
}

/* ── CONTAINER ─────────────────────────────────────── */
#cs-sticky-player {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(1120px, calc(100% - 32px));
  z-index: 99999;
  background:
    radial-gradient(1200px 200px at 15% 0%, rgba(245,179,1,0.10), transparent 60%),
    radial-gradient(900px 180px at 85% 100%, rgba(157,77,255,0.12), transparent 60%),
    linear-gradient(135deg, rgba(18,10,31,0.94), rgba(27,19,51,0.94));
  border: 1px solid rgba(245,179,1,0.22);
  border-radius: 22px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.65),
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 0 80px rgba(245,179,1,0.10),
    0 0 120px rgba(157,77,255,0.08);
  overflow: hidden;
  font-family: 'Roboto', system-ui, sans-serif;
  color: var(--cs-white);
  transition: border-radius .45s cubic-bezier(.2,.9,.2,1), box-shadow .45s ease;
}

#cs-sticky-player.is-expanded {
  border-radius: 26px;
  box-shadow:
    0 30px 90px rgba(0,0,0,0.7),
    0 0 0 1px rgba(245,179,1,0.20) inset,
    0 0 120px rgba(245,179,1,0.16),
    0 0 180px rgba(157,77,255,0.14);
}

/* ── AURORA ORBS ──────────────────────────────────── */
.cs-player-aurora {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  z-index: 0;
}
.cs-orb {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  filter: blur(60px); opacity: .55; animation: cs-orb-float 14s ease-in-out infinite;
}
.cs-orb-gold   { background: radial-gradient(circle, var(--cs-gold), transparent 70%);   top: -80px; left: -40px; }
.cs-orb-purple { background: radial-gradient(circle, var(--cs-purple), transparent 70%); bottom: -100px; right: 20%; animation-delay: -4s; }
.cs-orb-teal   { background: radial-gradient(circle, var(--cs-teal), transparent 70%);   top: 20%; right: -60px; animation-delay: -8s; opacity: .35; }

@keyframes cs-orb-float {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(30px, -20px) scale(1.15); }
}

/* ── SCANLINES + GRID ─────────────────────────────── */
.cs-player-scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}
.cs-player-grid {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(245,179,1,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,179,1,0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

/* ── MAIN BAR ──────────────────────────────────────── */
.cs-player-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  min-height: 72px;
}

/* ── LEFT ─────────────────────────────────────────── */
.cs-player-left {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.cs-cover-wrap {
  position: relative; width: 48px; height: 48px; flex-shrink: 0;
}
.cs-cover {
  width: 100%; height: 100%; border-radius: 12px; object-fit: cover;
  box-shadow: 0 0 20px rgba(245,179,1,0.25);
  background: linear-gradient(135deg, #1b1333, #120a1f);
}
.cs-cover-ring {
  position: absolute; inset: -3px; border-radius: 14px; pointer-events: none;
  background: conic-gradient(from 0deg, var(--cs-gold), var(--cs-orange), var(--cs-purple), var(--cs-teal), var(--cs-gold));
  opacity: .55; filter: blur(6px);
  animation: cs-ring-spin 6s linear infinite;
}
@keyframes cs-ring-spin { to { transform: rotate(360deg); } }

.cs-track-info { display: flex; flex-direction: column; min-width: 0; }
.cs-track-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--cs-white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .2px;
}
.cs-track-artist {
  font-size: 11px; color: var(--cs-gray); letter-spacing: .3px;
  text-transform: uppercase; font-weight: 500;
}

/* ── EQ BARS ──────────────────────────────────────── */
.cs-eq { display: flex; align-items: flex-end; gap: 3px; height: 24px; margin-left: 4px; }
.cs-eq span {
  width: 3px; border-radius: 2px;
  background: linear-gradient(to top, var(--cs-gold), var(--cs-orange));
  box-shadow: 0 0 6px var(--cs-glow-gold);
  animation: cs-eq-idle 1.2s ease-in-out infinite;
  height: 20%;
}
.cs-eq span:nth-child(2) { animation-delay: -0.3s; }
.cs-eq span:nth-child(3) { animation-delay: -0.6s; }
.cs-eq span:nth-child(4) { animation-delay: -0.9s; }
.cs-eq span:nth-child(5) { animation-delay: -1.2s; }

#cs-sticky-player.is-playing .cs-eq span { animation: cs-eq-play 0.6s ease-in-out infinite; }
#cs-sticky-player.is-playing .cs-eq span:nth-child(1) { height: 60%; animation-delay: -0.1s; }
#cs-sticky-player.is-playing .cs-eq span:nth-child(2) { height: 85%; animation-delay: -0.25s; }
#cs-sticky-player.is-playing .cs-eq span:nth-child(3) { height: 50%; animation-delay: -0.4s; }
#cs-sticky-player.is-playing .cs-eq span:nth-child(4) { height: 95%; animation-delay: -0.15s; }
#cs-sticky-player.is-playing .cs-eq span:nth-child(5) { height: 70%; animation-delay: -0.35s; }

@keyframes cs-eq-idle {
  0%, 100% { height: 20%; opacity: .5; }
  50%      { height: 30%; opacity: .8; }
}
@keyframes cs-eq-play {
  0%, 100% { transform: scaleY(.5); }
  50%      { transform: scaleY(1); }
}

/* ── CENTER TRANSPORT ─────────────────────────────── */
.cs-player-center {
  display: flex; align-items: center; gap: 8px;
}
.cs-btn {
  border: none; background: transparent; color: var(--cs-white);
  cursor: pointer; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center;
  transition: transform .2s ease, color .2s ease, background .2s ease, box-shadow .3s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.cs-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(0,230,215,.45);
}
.cs-btn:hover { transform: translateY(-1px); color: var(--cs-gold-soft); }

.cs-btn-ghost {
  width: 38px; height: 38px; font-size: 15px;
  color: var(--cs-muted);
}
.cs-btn-ghost:hover { background: rgba(245,179,1,0.10); color: var(--cs-gold); }

.cs-btn-play {
  position: relative;
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--cs-gold), var(--cs-orange));
  color: #120a1f; font-size: 22px; font-weight: 900;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.25) inset,
    0 10px 30px rgba(245,179,1,0.45),
    0 0 60px rgba(255,140,66,0.35);
}
.cs-btn-play:hover { transform: scale(1.06); color: #120a1f; }
.cs-btn-play .cs-play-icon { position: relative; z-index: 2; transform: translateX(1px); }

.cs-play-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, var(--cs-gold), var(--cs-orange), var(--cs-purple), var(--cs-teal), var(--cs-gold)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .9; animation: cs-ring-spin 4s linear infinite;
  pointer-events: none;
}
.cs-play-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245,179,1,0.5);
  animation: cs-pulse 2.4s cubic-bezier(.6,0,.4,1) infinite;
  pointer-events: none;
}
@keyframes cs-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245,179,1,.55); }
  70%  { box-shadow: 0 0 0 22px rgba(245,179,1,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,179,1,0); }
}

/* Play state swap */
#cs-sticky-player.is-playing .cs-play-icon::before { content: '❚❚'; font-size: 16px; }
#cs-sticky-player.is-playing .cs-play-icon { font-size: 0; }
#cs-sticky-player.is-playing .cs-play-icon::before { font-size: 16px; }
#cs-sticky-player.is-playing .cs-play-pulse { animation-duration: 1.6s; }

/* ── RIGHT ────────────────────────────────────────── */
.cs-player-right {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.cs-time-readout {
  font-family: 'Inter', monospace;
  font-size: 12px; color: var(--cs-gray);
  letter-spacing: .5px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,179,1,0.12);
  white-space: nowrap;
}
.cs-time-sep { opacity: .5; margin: 0 3px; }

.cs-btn-expand {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(157,77,255,0.12);
  border: 1px solid rgba(157,77,255,0.35);
  color: var(--cs-purple);
  transition: all .3s ease;
}
.cs-btn-expand:hover {
  background: rgba(157,77,255,0.25);
  box-shadow: 0 0 24px rgba(157,77,255,0.55);
  color: #fff;
}
.cs-expand-arrow {
  display: inline-block; transition: transform .4s cubic-bezier(.2,.9,.2,1);
}
#cs-sticky-player.is-expanded .cs-expand-arrow { transform: rotate(180deg); }

/* ── EXPANDED PANEL ───────────────────────────────── */
.cs-player-expanded {
  position: relative;
  z-index: 2;
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .55s cubic-bezier(.2,.9,.2,1), opacity .4s ease;
  padding: 0 20px;
}
#cs-sticky-player.is-expanded .cs-player-expanded {
  max-height: 420px; opacity: 1;
  padding: 0 20px 18px;
  border-top: 1px solid rgba(245,179,1,0.10);
  margin-top: 4px;
}

/* ── WAVEFORM ─────────────────────────────────────── */
.cs-waveform-wrap {
  position: relative;
  padding: 16px 0 8px;
  border-radius: 16px;
}
#cs-waveform {
  position: relative; z-index: 2;
  min-height: 64px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(18,10,31,0.6), rgba(27,19,51,0.6));
  padding: 6px 8px;
  box-shadow:
    0 0 0 1px rgba(245,179,1,0.15) inset,
    0 10px 30px rgba(0,0,0,0.5);
  transition: box-shadow .3s ease;
}
#cs-waveform:hover {
  box-shadow:
    0 0 0 1px rgba(0,230,215,0.35) inset,
    0 10px 40px rgba(157,77,255,0.35);
}
.cs-waveform-glow {
  position: absolute; inset: 0; pointer-events: none; border-radius: 16px;
  background: radial-gradient(ellipse at 50% 120%, rgba(245,179,1,0.22), transparent 70%);
  filter: blur(8px);
  animation: cs-wave-glow 4s ease-in-out infinite;
}
@keyframes cs-wave-glow {
  0%, 100% { opacity: .5; }
  50%      { opacity: 1; }
}
.cs-waveform-shine {
  position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
  transform: skewX(-20deg);
  animation: cs-shine 6s ease-in-out infinite;
  pointer-events: none; z-index: 3; border-radius: 12px;
}
@keyframes cs-shine {
  0%, 60%  { left: -40%; }
  100%     { left: 140%; }
}

/* Loading state */
.cs-waveform.is-loading { display: flex; align-items: center; justify-content: center; }
.cs-waveform-loading {
  color: var(--cs-gold); font-size: 12px; letter-spacing: 1.5px;
  text-transform: uppercase; font-weight: 600;
  animation: cs-blink 1.2s ease-in-out infinite;
}
@keyframes cs-blink { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.cs-waveform-error { color: #ff6b6b; font-size: 12px; text-align: center; padding: 10px; }

/* ── SEEK SLIDER ─────────────────────────────────── */
.cs-seek-row { padding: 4px 0 8px; }
.cs-seek {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--cs-gold), var(--cs-orange) 40%, rgba(255,255,255,0.08) 40%);
  border-radius: 99px; outline: none; cursor: pointer;
}
.cs-seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--cs-gold-soft);
  box-shadow: 0 0 12px var(--cs-glow-gold), 0 0 0 2px #120a1f;
  cursor: grab;
}
.cs-seek::-moz-range-thumb {
  width: 14px; height: 14px; border: none; border-radius: 50%;
  background: var(--cs-gold-soft);
  box-shadow: 0 0 12px var(--cs-glow-gold);
}

/* ── META ─────────────────────────────────────────── */
.cs-player-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--cs-gray);
  padding: 6px 0 10px;
}
.cs-meta-tag {
  padding: 4px 10px; border-radius: 99px;
  background: rgba(157,77,255,0.10);
  border: 1px solid rgba(157,77,255,0.25);
  color: var(--cs-muted);
  letter-spacing: .3px;
}
.cs-meta-live {
  color: var(--cs-teal); font-weight: 700;
  text-shadow: 0 0 10px rgba(0,230,215,0.6);
  animation: cs-live 1.6s ease-in-out infinite;
  margin-left: auto;
}
@keyframes cs-live { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ── EXTRAS ROW ──────────────────────────────────── */
.cs-player-extras {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.cs-vol-slider-wrap {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px;
}
.cs-vol-icon { font-size: 14px; opacity: .8; }
.cs-volume-slider {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--cs-teal), rgba(255,255,255,0.08));
  border-radius: 99px; outline: none;
}
.cs-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--cs-teal);
  box-shadow: 0 0 10px var(--cs-glow-teal);
}
.cs-volume-slider::-moz-range-thumb {
  width: 12px; height: 12px; border: none; border-radius: 50%;
  background: var(--cs-teal); box-shadow: 0 0 10px var(--cs-glow-teal);
}

.cs-btn-mini {
  padding: 6px 12px; border-radius: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--cs-muted);
  width: auto; height: auto;
}
.cs-btn-mini:hover {
  background: rgba(245,179,1,0.12);
  color: var(--cs-gold);
  border-color: rgba(245,179,1,0.35);
  box-shadow: 0 0 16px rgba(245,179,1,0.25);
}

/* ── COLLAPSED STATE OVERRIDE (Engine 4.1 compatible) ── */
.cs-player-collapsed .cs-player-expanded { max-height: 0 !important; opacity: 0 !important; padding: 0 20px !important; }
#cs-sticky-player.cs-player-collapsed { border-radius: 22px; }

/* ── IS-PLAYING AMBIENT ──────────────────────────── */
#cs-sticky-player.is-playing {
  box-shadow:
    0 20px 60px rgba(0,0,0,0.65),
    0 0 0 1px rgba(245,179,1,0.30) inset,
    0 0 100px rgba(245,179,1,0.22),
    0 0 160px rgba(255,140,66,0.14);
}

/* ── MOBILE ───────────────────────────────────────── */
@media (max-width: 720px) {
  #cs-sticky-player { bottom: 8px; width: calc(100% - 16px); border-radius: 18px; }
  .cs-player-main { grid-template-columns: 1fr auto; padding: 10px 14px; gap: 10px; }
  .cs-player-right .cs-time-readout { display: none; }
  .cs-player-center { grid-column: 1 / -1; justify-content: center; order: 3; margin-top: 4px; }
  .cs-btn-ghost { width: 34px; height: 34px; }
  .cs-btn-play { width: 48px; height: 48px; }
  .cs-cover-wrap { width: 40px; height: 40px; }
  .cs-track-title { font-size: 13px; }
  .cs-player-extras { flex-wrap: wrap; }
}

/* ── REDUCED MOTION ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cs-orb, .cs-cover-ring, .cs-play-ring, .cs-play-pulse, .cs-eq span,
  .cs-waveform-shine, .cs-waveform-glow, .cs-meta-live, .cs-expand-arrow {
    animation: none !important;
    transition: none !important;
  }
}