/* Component primitives */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  box-shadow: var(--shadow-none);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  line-height: 0;
}

.icon-badge--ghost {
  background: color-mix(in srgb, var(--color-surface-2) 70%, transparent);
  border-color: var(--color-border);
  box-shadow: none;
}

.icon-badge--ghost i {
  font-size: 1.1rem;
}

.icon-badge svg,
.icon-badge i {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
}

.icon-badge i::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.rs-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  transition: border-color 0.18s ease, transform 0.18s ease;
  box-shadow: var(--shadow-none);
}

.rs-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rs-avatar--sm {
  width: 36px;
  height: 36px;
}

.rs-avatar--md {
  width: 44px;
  height: 44px;
}

.rs-country-card {
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-1);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
  box-shadow: var(--shadow-none);
}

.rs-country-card .fflag {
  width: 32px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}

.rs-country-card:hover,
.rs-country-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-border-color);
  box-shadow: var(--shadow-none);
  outline: none;
}

.rs-country-card .badge {
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
}

.rs-surface-plain p {
  color: color-mix(in srgb, var(--color-text) 84%, transparent);
}

/* Bootstrap base adjustments */
.card {
  border-radius: 18px;
  border-color: var(--color-border);
  background: var(--color-surface-1);
  box-shadow: var(--shadow-none);
}

.card:hover,
.card:focus-within {
  box-shadow: var(--shadow-none);
}

.list-group {
  border-radius: 16px;
  overflow: hidden;
}

.list-group-item {
  background: var(--color-surface-1);
  border-color: var(--color-divider);
}

.breadcrumb {
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.breadcrumb a {
  color: var(--color-link);
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--color-text-muted);
}

/* Bottom player */
.rs-bottom-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--player-height) + env(safe-area-inset-bottom));
  background: var(--color-surface-1);
  border-top: 1px solid var(--color-divider);
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.08);
  z-index: 1500;
}

.rs-bottom-player__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 16px);
  padding-inline: clamp(16px, 4vw, 32px);
  padding-bottom: env(safe-area-inset-bottom);
}


.rs-bottom-player__play-btn {
  width: clamp(42px, 5vw, 48px);
  height: clamp(42px, 5vw, 48px);
  border-radius: 50%;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-heading);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 0 0 auto;
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.rs-bottom-player__play-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand-primary) 42%, transparent);
  border-top-color: transparent;
  opacity: 0;
  pointer-events: none;
  animation: rs-play-spin 0.8s linear infinite;
  transition: opacity 0.2s ease;
}

.rs-bottom-player__play-btn:hover,
.rs-bottom-player__play-btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border-color);
  background: var(--color-surface-1);
  outline: none;
}

.rs-bottom-player__play-btn.is-playing {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
}

.rs-bottom-player__play-btn.is-loading {
  opacity: 0.7;
}

.rs-bottom-player__play-btn.is-loading::after {
  opacity: 1;
}

.rs-bottom-player__play-btn .btn-label {
  display: none;
}

.rs-bottom-player__play-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.rs-bottom-player__station {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 14px);
  min-width: 0;
  flex: 1 1 auto;
  text-decoration: none;
  color: inherit;
}

.rs-bottom-player__logo {
  width: clamp(64px, 10vw, 86px);
  height: clamp(36px, 6vw, 48px);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.rs-bottom-player__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rs-bottom-player__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rs-bottom-player__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rs-bottom-player__track {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rs-bottom-player__track.scrolling .scrolling-inner {
  --marquee-gap: 24px;
  display: inline-flex;
  align-items: center;
  gap: var(--marquee-gap);
  white-space: nowrap;
}

@keyframes marquee-loop {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--marquee-shift, 50%)));
  }
}

@keyframes rs-play-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rs-bottom-player__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

.rs-bottom-player__favorite-btn {
  width: clamp(36px, 4.6vw, 42px);
  height: clamp(36px, 4.6vw, 42px);
  border-radius: 999px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.rs-bottom-player__favorite-btn .bi {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 1em;
  height: 1em;
}

.rs-bottom-player__favorite-btn .bi::before {
  display: block;
  line-height: 1;
  vertical-align: 0;
}

.rs-bottom-player__favorite-btn:hover,
.rs-bottom-player__favorite-btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border-color);
  background: var(--color-surface-1);
  outline: none;
}

.rs-bottom-player__favorite-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.rs-bottom-player__mobile-toggle {
  display: none;
  width: clamp(36px, 8vw, 42px);
  height: clamp(36px, 8vw, 42px);
  border-radius: 999px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: auto;
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.rs-bottom-player__mobile-toggle:hover,
.rs-bottom-player__mobile-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border-color);
  background: var(--color-surface-1);
  outline: none;
}

@media (max-width: 575.98px) {
  .rs-bottom-player__inner {
    gap: 10px;
    padding-inline: 12px;
  }

  .rs-bottom-player__controls {
    display: none;
  }

  .rs-bottom-player__mobile-toggle {
    display: inline-flex;
  }

  .rs-bottom-player__name {
    font-size: 0.9rem;
  }

  .rs-bottom-player__track {
    font-size: 0.78rem;
  }
}

.rs-bottom-player .stream-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.rs-bottom-player .station-stream-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rs-bottom-player .station-hero__volume-control {
  --volume-percent: 100%;
  --volume-panel-width: clamp(180px, 24vw, 260px);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.rs-bottom-player .station-hero__volume-control.is-muted {
  color: var(--color-text-muted);
}

.rs-bottom-player__volume-control .station-volume__panel {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.8vw, 12px);
  min-width: 0;
  width: clamp(160px, 24vw, 260px);
  max-width: calc(100vw - clamp(28px, 6vw, 84px));
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-1);
  box-shadow: var(--shadow-none);
  position: absolute;
  bottom: calc(100% + 8px);
  left: auto;
  right: 0;
  transform: translate(0, 6px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.rs-bottom-player__volume-control.is-panel-open .station-volume__panel {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, 0) scale(1);
}

.rs-bottom-player__volume-control .station-volume__mute {
  width: clamp(36px, 4.6vw, 42px);
  height: clamp(36px, 4.6vw, 42px);
  min-width: clamp(36px, 4.6vw, 42px);
  border-radius: 50%;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  background: var(--color-surface-2);
  box-shadow: inset 0 0 0 1px var(--color-divider);
  transition: transform 0.16s ease, box-shadow 0.2s ease, background-color 0.18s ease, color 0.18s ease;
}

.rs-bottom-player__volume-control .station-volume__mute:hover,
.rs-bottom-player__volume-control .station-volume__mute:focus-visible {
  transform: translateY(-1px);
  background: var(--color-surface-1);
  box-shadow: inset 0 0 0 1px var(--accent-border-color);
  outline: none;
}

.rs-bottom-player__volume-control .station-volume__icon {
  font-size: 1rem;
  display: none;
}

.rs-bottom-player__volume-control .station-volume__icon--up {
  display: block;
}

.rs-bottom-player__volume-control.is-muted .station-volume__icon--up {
  display: none;
}

.rs-bottom-player__volume-control.is-muted .station-volume__icon--off {
  display: block;
}

.rs-bottom-player__volume-control .station-volume__slider {
  --volume-percent: 100%;
  flex: 1 1 auto;
  width: 100%;
  min-width: 110px;
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) 0%,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) var(--volume-percent),
      var(--color-surface-3) var(--volume-percent),
      var(--color-surface-3) 100%);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  transition: background 0.18s ease;
}

.rs-bottom-player__volume-control .station-volume__slider:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 24%, transparent);
}

.rs-bottom-player__volume-control .station-volume__slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) 0%,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) var(--volume-percent),
      var(--color-surface-3) var(--volume-percent),
      var(--color-surface-3) 100%);
}

.rs-bottom-player__volume-control .station-volume__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(14px, 2.6vw, 16px);
  height: clamp(14px, 2.6vw, 16px);
  border-radius: 50%;
  background: var(--color-surface-1);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-top: calc((clamp(14px, 2.6vw, 16px) / -2) + 3px);
}

.rs-bottom-player__volume-control .station-volume__slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) 0%,
      color-mix(in srgb, var(--brand-primary) 70%, var(--color-surface-2)) var(--volume-percent),
      var(--color-surface-3) var(--volume-percent),
      var(--color-surface-3) 100%);
}

.rs-bottom-player__volume-control .station-volume__slider::-moz-range-thumb {
  width: clamp(14px, 2.6vw, 16px);
  height: clamp(14px, 2.6vw, 16px);
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface-1);
  box-shadow: var(--shadow-sm);
}

.rs-bottom-player__volume-control.is-muted .station-volume__slider {
  background: var(--color-surface-3);
}

.rs-bottom-player__volume-control.is-muted .station-volume__slider::-webkit-slider-thumb,
.rs-bottom-player__volume-control.is-muted .station-volume__slider::-moz-range-thumb {
  background: var(--color-surface-1);
  box-shadow: var(--shadow-sm);
}

.rs-bottom-player__menu-btn {
  height: clamp(36px, 4.6vw, 42px);
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.rs-bottom-player__menu-btn:hover,
.rs-bottom-player__menu-btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border-color);
  background: var(--color-surface-1);
  outline: none;
}

.rs-bottom-player__menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text-muted);
}

.rs-bottom-player__menu-pop {
  display: none;
  min-width: 180px;
  padding: 12px;
  border-radius: 14px;
  border-color: var(--color-divider);
  box-shadow: var(--shadow-none);
  bottom: calc(100% + 8px);
  left: auto;
  right: 0;
}

.rs-bottom-player__menu-pop.open {
  display: block;
}

.rs-bottom-player__menu-pop .stream-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rs-bottom-player__menu-pop .stream-button {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-none);
}

.rs-bottom-player__menu-pop .stream-button.active-stream-button {
  box-shadow: var(--shadow-none);
}

/* Mobile controls overlay */
.mobile-controls-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(var(--player-height) + env(safe-area-inset-bottom) + 16px);
  background: rgba(15, 23, 42, 0.35);
}

.mobile-controls-overlay[hidden] {
  display: none;
}

.mobile-controls-overlay .mco-backdrop {
  position: absolute;
  inset: 0;
}

.mobile-controls-overlay .mco-panel {
  position: relative;
  width: min(100%, 520px);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-1);
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.mobile-controls-overlay .mco-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mobile-controls-overlay .mco-title {
  font-weight: 700;
  color: var(--color-heading);
}

.mobile-controls-overlay .mco-close {
  border: 0;
  background: var(--color-surface-2);
  color: var(--color-text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-controls-overlay .mco-section {
  margin: 14px 0;
}

.mobile-controls-overlay #mco-streams,
.mobile-controls-overlay #mco-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-controls-overlay #mco-volume {
  display: block;
}

.mobile-controls-overlay #mco-favorite {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.mobile-controls-overlay .stream-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-controls-overlay .stream-button {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 72px;
  text-align: center;
  box-shadow: var(--shadow-none);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.mobile-controls-overlay .stream-button:hover,
.mobile-controls-overlay .stream-button:focus-visible {
  border-color: var(--accent-border-color);
  background: var(--color-surface-1);
  transform: translateY(-1px);
  outline: none;
}

.mobile-controls-overlay .stream-button.active-stream-button {
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--color-surface-2));
}

.mobile-controls-overlay .station-hero__volume-control {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
}

.mobile-controls-overlay .station-volume__panel {
  position: static;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.mobile-controls-overlay .station-volume__mute {
  background: var(--color-surface-2);
}

.mobile-controls-overlay .station-volume__slider {
  height: 8px;
}

.mobile-controls-overlay .station-volume__slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: calc((22px / -2) + 4px);
}

.mobile-controls-overlay .station-volume__slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
}

body.mco-open {
  overflow: hidden;
}
