/* =========================
   Spotify-ish Radio Player
   - Theme via CSS variables
   ========================= */

:root{
  --bg0: #0b0b0f;
  --bg1: #11111a;
  --card: rgba(18, 18, 24, 0.78);
  --card2: rgba(18, 18, 24, 0.60);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --muted2: rgba(255,255,255,0.45);

  /* Dynamic theme vars (JS updates) */
  --accent: #1DB954;            /* Spotify green fallback */
  --accentRgb: 29,185,84;
  --accentSoft: rgba(29,185,84,0.35);
  --accentGlow: rgba(29,185,84,0.22);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 450px at 20% 10%, var(--accentGlow), transparent 60%),
    radial-gradient(900px 450px at 80% 30%, rgba(255,255,255,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.app{
  width: min(980px, 100%);
}

.player{
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.55),
    0 2px 0 rgba(255,255,255,0.04) inset;
  backdrop-filter: blur(10px);
  padding: 18px 18px 16px;
}

.bgGlow{
  position:absolute;
  inset:-40%;
  background:
    radial-gradient(closest-side at 30% 30%, rgba(var(--accentRgb),0.33), transparent 70%),
    radial-gradient(closest-side at 70% 20%, rgba(var(--accentRgb),0.22), transparent 68%),
    radial-gradient(closest-side at 60% 85%, rgba(255,255,255,0.10), transparent 65%);
  filter: blur(24px);
  opacity: 0.85;
  pointer-events:none;
  transform: translateZ(0);
}

.topbar{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  padding: 4px 4px 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.stationLogo{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}

.brandText{ min-width:0; }
.stationName{
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 13px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stationDesc{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rightBadges{ display:flex; align-items:center; gap:10px; }

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  color: var(--text);
  user-select:none;
}

.badge.subtle{
  color: var(--muted);
  border-color: rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.14);
}

.badge.live{
  border-color: rgba(var(--accentRgb),0.45);
  background: rgba(var(--accentRgb),0.10);
  color: rgba(255,255,255,0.95);
}
.badge .dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(var(--accentRgb),0.12);
}

.main{
  position: relative;
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: center;
}

.artFrame{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    0 2px 0 rgba(255,255,255,0.04) inset;
}

.cover{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  transform: scale(1.03);
  filter: saturate(1.1) contrast(1.03);
}

.artOverlay{
  position:absolute;
  inset:0;
  background:
    radial-gradient(closest-side at 20% 15%, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(180deg, transparent, rgba(0,0,0,0.20));
  pointer-events:none;
}

.meta{
  min-width:0;
  padding: 6px 6px 6px 4px;
}

.nowLabel{
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trackTitle{
  margin-top: 10px;
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 10px 22px rgba(0,0,0,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trackArtist{
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls{
  margin-top: 18px;
  display:flex;
  align-items:center;
  gap: 16px;
}

.playBtn{
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #0b0b0f;
  display:grid;
  place-items:center;
  cursor:pointer;
  box-shadow: 0 18px 40px rgba(var(--accentRgb),0.25);
  transition: transform .10s ease, filter .15s ease;
}
.playBtn:hover{ filter: brightness(1.05); }
.playBtn:active{ transform: scale(0.98); }

.playIcon{
  font-size: 22px;
  font-weight: 900;
  transform: translateX(1px);
}

.sliders{
  flex: 1;
  min-width: 0;
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.sliderRow{
  display:grid;
  grid-template-columns: 72px 1fr;
  align-items:center;
  gap: 12px;
}
.sliderLabel{
  font-size: 12px;
  color: var(--muted2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slider{
  width: 100%;
  accent-color: var(--accent);
}

.statusRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.status{
  font-size: 12px;
  color: var(--muted);
}

.chip{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.16);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}
.chip:hover{
  border-color: rgba(var(--accentRgb),0.35);
  background: rgba(var(--accentRgb),0.10);
}

.hint{
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted2);
}
.error{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 70, 70, 0.12);
  border: 1px solid rgba(255, 70, 70, 0.25);
  color: rgba(255,255,255,0.92);
  font-size: 12px;
}

#visualizer{
  position:absolute;
  inset:auto 0 0 0;
  height: 90px;
  width: 100%;
  opacity: 0.85;
  pointer-events:none;
}

/* Fullscreen / XXL */
.player.fullscreen{
  position: fixed;
  inset: 16px;
  width: auto;
  height: auto;
  max-width: none;
  margin: 0;
  z-index: 9999;
}

@media (max-width: 840px){
  .main{ grid-template-columns: 1fr; }
  .controls{ margin-top: 14px; }
  .artFrame{ width: min(420px, 100%); margin: 0 auto; }
  .meta{ text-align: center; }
  .controls{ justify-content:center; }
  .sliderRow{ grid-template-columns: 72px 1fr; }
}


/* =========================
   PRO UPGRADES: Parallax, Pulse, History
   ========================= */

.player.playing .bgGlow{
  animation: glowPulse 2.8s ease-in-out infinite;
}

@keyframes glowPulse{
  0%{ opacity: 0.55; transform: translate(-50%,-45%) scale(1); filter: blur(46px); }
  50%{ opacity: 0.88; transform: translate(-50%,-45%) scale(1.08); filter: blur(52px); }
  100%{ opacity: 0.55; transform: translate(-50%,-45%) scale(1); filter: blur(46px); }
}

/* Cover parallax */
.artFrame.parallax{
  perspective: 900px;
  transform-style: preserve-3d;
  /* Helps pointer/touch parallax on mobile */
  touch-action: none;
}

.artFrame.parallax .cover{
  transform: translateZ(0);
  will-change: transform;
  transition: transform 120ms ease-out;
}

.artFrame.parallax .artOverlay{
  transform: translateZ(18px);
  will-change: transform;
  transition: transform 120ms ease-out;
}

/* History UI */
.history{
  margin-top: 16px;
  padding: 12px 12px 10px;
  border-radius: 18px;
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
}

.historyHeader{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.historyTitle{
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
}

.ghostBtn{
  appearance:none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.ghostBtn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-1px);
}
.ghostBtn:active{
  transform: translateY(0px) scale(0.98);
}

.historyList{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow:auto;
}

.historyItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.historyItem:hover{
  transform: translateY(-1px);
  border-color: rgba(var(--accentRgb), 0.25);
  background: rgba(var(--accentRgb),0.10);
}

.historyDot{
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: rgba(var(--accentRgb), .95);
  box-shadow: 0 0 0 6px rgba(var(--accentRgb), .14);
  flex: 0 0 auto;
}

.historyText{
  flex:1 1 auto;
  min-width: 0;
}
.historyTrack{
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.historyArtist{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.historyActions{
  flex: 0 0 auto;
  display:flex;
  gap: 8px;
}

.copyBtn{
  appearance:none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  cursor:pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.copyBtn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}
.copyBtn:active{ transform: translateY(0) scale(0.98); }

