/* ============================================================================
   RLRadio — Sticky sub-navbar radio player
   Design: full-width dark bar, content constrained to --rl-container (1200px)
   ============================================================================ */

:root {
  --rl-rp-bg:      #13102a;
  --rl-rp-bg2:     #1d1940;
  --rl-rp-accent:  #4c4084;
  --rl-rp-hi:      #7b5ea7;
  --rl-rp-text:    #ede8ff;
  --rl-rp-sub:     rgba(237,232,255,.55);
  --rl-rp-border:  rgba(255,255,255,.09);
  --rl-rp-live:    #ff4757;
  --rl-rp-h:       58px;
  --rl-rp-panel-h: 120px;
}

/* ── Icon visibility: driven by parent state classes, not [hidden] attr ─────
   main.css has "svg { display: block }" which overrides the [hidden]
   attribute. We use CSS class states instead to avoid the conflict.        */

/* Default: show play, hide pause and spinner */
.rl-radio-bar .js-icon-pause { display: none; }
.rl-radio-bar .js-icon-load  { display: none; }

/* Playing: show pause */
.rl-radio-bar--playing .js-icon-play  { display: none; }
.rl-radio-bar--playing .js-icon-pause { display: block; }
.rl-radio-bar--playing .js-icon-load  { display: none; }

/* Loading: show spinner only */
.rl-radio-bar--loading .js-icon-play  { display: none; }
.rl-radio-bar--loading .js-icon-pause { display: none; }
.rl-radio-bar--loading .js-icon-load  { display: block; }

/* Mute toggle */
.rl-radio-bar .js-icon-mute            { display: none; }
.rl-radio-bar--muted .js-icon-vol      { display: none; }
.rl-radio-bar--muted .js-icon-mute     { display: block; }

/* ── Outer bar ───────────────────────────────────────────────────────────── */
.rl-radio-bar {
  position: sticky;
  top: 46px;              /* JS overrides with exact navbar height */
  left: 0;
  right: 0;
  z-index: 899;
  width: 100%;
  background: var(--rl-rp-bg);
  color: var(--rl-rp-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1;
  border-bottom: 2px solid var(--rl-rp-accent);
  box-shadow: 0 2px 14px rgba(0,0,0,.45);
}

.rl-radio-bar[hidden] { display: none; }

/* ── Strip — constrained to page width ──────────────────────────────────── */
.rl-radio-bar__strip {
  display: flex;
  align-items: center;
  height: var(--rl-rp-h);
  max-width: var(--rl-container, 1200px);
  margin: 0 auto;
  padding: 0 24px;
  gap: 16px;
}

/* ── Brand block ─────────────────────────────────────────────────────────── */
.rl-radio-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-right: 16px;
  border-right: 1px solid var(--rl-rp-border);
}

.rl-radio-bar__id {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rl-radio-bar__live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rl-rp-live);
}

.rl-radio-bar__live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rl-rp-live);
  flex-shrink: 0;
  animation: rl-pulse 1.6s ease infinite;
}

@keyframes rl-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: .3; transform: scale(.65);  }
}

.rl-radio-bar__name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--rl-rp-text);
  white-space: nowrap;
  letter-spacing: .005em;
}

/* ── Equalizer ───────────────────────────────────────────────────────────── */
.rl-radio-bar__eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  flex-shrink: 0;
}

.rl-radio-bar__eq b {
  display: block;
  width: 3px;
  height: 3px;
  background: var(--rl-rp-hi);
  border-radius: 1px 1px 0 0;
  transform-origin: bottom;
  opacity: .3;
}

.rl-radio-bar--playing .rl-radio-bar__eq b {
  opacity: 1;
  animation: rl-eq .9s ease-in-out infinite alternate;
}

.rl-radio-bar--playing .rl-radio-bar__eq b:nth-child(1) { height: 5px;  animation-duration: .70s; animation-delay: .00s; }
.rl-radio-bar--playing .rl-radio-bar__eq b:nth-child(2) { height: 14px; animation-duration: .90s; animation-delay: .12s; }
.rl-radio-bar--playing .rl-radio-bar__eq b:nth-child(3) { height: 9px;  animation-duration: .80s; animation-delay: .25s; }
.rl-radio-bar--playing .rl-radio-bar__eq b:nth-child(4) { height: 16px; animation-duration: 1.0s; animation-delay: .08s; }
.rl-radio-bar--playing .rl-radio-bar__eq b:nth-child(5) { height: 7px;  animation-duration: .75s; animation-delay: .18s; }

@keyframes rl-eq {
  from { transform: scaleY(.25); }
  to   { transform: scaleY(1); }
}

/* ── Now-playing title ───────────────────────────────────────────────────── */
.rl-radio-bar__track-wrap {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.rl-radio-bar__track {
  display: block;
  white-space: nowrap;
  color: var(--rl-rp-sub);
  font-size: 12px;
}

.rl-radio-bar__track.is-scrolling {
  animation: rl-scroll 18s linear infinite;
}

@keyframes rl-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Controls row ────────────────────────────────────────────────────────── */
.rl-radio-bar__ctrls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.rl-radio-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--rl-rp-text);
  cursor: pointer;
  padding: 7px;
  border-radius: 50%;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  line-height: 0;
}

.rl-radio-bar__btn:hover,
.rl-radio-bar__btn:focus-visible {
  background: rgba(255,255,255,.1);
  outline: none;
}

.rl-radio-bar__btn:focus-visible {
  outline: 2px solid var(--rl-rp-hi);
  outline-offset: 1px;
}

/* Play button: accent-filled circle */
.rl-radio-bar__play-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--rl-rp-accent);
  border-radius: 50%;
  transition: background .15s, transform .1s;
}
.rl-radio-bar__play-btn:hover { background: var(--rl-rp-hi); transform: scale(1.08); }
.rl-radio-bar--loading .rl-radio-bar__play-btn { background: rgba(76,64,132,.4); }

/* Volume */
.rl-radio-bar__vol-group { display: flex; align-items: center; gap: 2px; }

.rl-radio-bar__vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--rl-rp-hi) var(--rl-vol-pct, 70%),
    rgba(255,255,255,.2) var(--rl-vol-pct, 70%)
  );
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.rl-radio-bar__vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%; background: #fff;
  cursor: pointer; transition: transform .1s;
}
.rl-radio-bar__vol-range::-webkit-slider-thumb:hover { transform: scale(1.3); }
.rl-radio-bar__vol-range::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%; background: #fff;
  border: none; cursor: pointer;
}

/* Icons */
.rl-ico {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.rl-ico--spin { animation: rl-spin .85s linear infinite; }
@keyframes rl-spin { to { transform: rotate(360deg); } }

/* Outer wave fades on mute */
.rl-vol-wave2 { transition: opacity .2s; }
.rl-radio-bar--muted .rl-vol-wave2 { opacity: 0; }

/* Expand chevron flips */
.rl-radio-bar--expanded .rl-radio-bar__expand-btn .rl-ico { transform: rotate(180deg); }

/* Close: slightly dimmer */
.rl-radio-bar__close-btn { opacity: .55; }
.rl-radio-bar__close-btn:hover { opacity: 1; }

/* ── Expanded panel ──────────────────────────────────────────────────────── */
.rl-radio-bar__panel {
  background: var(--rl-rp-bg2);
  border-top: 1px solid var(--rl-rp-border);
  animation: rl-panel-in .2s ease;
}

.rl-radio-bar__panel[hidden] { display: none; }

.rl-radio-bar__panel-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--rl-rp-panel-h);
  max-width: var(--rl-container, 1200px);
  margin: 0 auto;
  padding: 0 24px;
}

@keyframes rl-panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rl-radio-bar__panel-art {
  flex-shrink: 0;
  width: 76px; height: 76px;
  background: var(--rl-rp-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.rl-radio-bar__panel-art svg { width: 60px; height: 60px; }

.rl-radio-bar__panel-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}

.rl-radio-bar__panel-station {
  font-size: 15px; font-weight: 800;
  color: var(--rl-rp-text); margin: 0; letter-spacing: -.01em;
}
.rl-radio-bar__panel-tagline {
  font-size: 11px; color: var(--rl-rp-sub); margin: 0;
}
.rl-radio-bar__panel-title {
  font-size: 13px; color: var(--rl-rp-text); margin: 4px 0 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rl-radio-bar__panel-meta {
  display: flex; align-items: center; gap: 10px; margin: 2px 0 0; font-size: 11px;
}
.rl-radio-bar__panel-live { color: var(--rl-rp-live); font-weight: 700; letter-spacing: .06em; }
.rl-radio-bar__panel-listeners { color: var(--rl-rp-sub); }

.rl-radio-bar__panel-actions { flex-shrink: 0; }

.rl-radio-bar__panel-popup {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--rl-rp-sub); text-decoration: none;
  padding: 6px 14px; border: 1px solid var(--rl-rp-border); border-radius: 20px;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.rl-radio-bar__panel-popup svg { width: 12px; height: 12px; }
.rl-radio-bar__panel-popup:hover { color: var(--rl-rp-text); border-color: var(--rl-rp-hi); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .rl-radio-bar__strip     { padding: 0 12px; gap: 10px; }
  .rl-radio-bar__brand     { padding-right: 10px; }
  .rl-radio-bar__name      { display: none; }
  .rl-radio-bar__vol-range { width: 50px; }
  .rl-radio-bar__expand-btn { display: none; }
  .rl-radio-bar__panel-inner { padding: 0 12px; gap: 12px; }
  .rl-radio-bar__panel-art  { width: 52px; height: 52px; }
  .rl-radio-bar__panel-actions { display: none; }
}

@media (max-width: 420px) {
  .rl-radio-bar__vol-group  { display: none; }
  .rl-radio-bar__track-wrap { display: none; }
}
