/* ========== CSS Variables ========== */
:root {
  --primary: #d81b60;
  --primary-dark: #ad1457;
  --primary-light: #f48fb1;
  --accent: #d4a04a;
  --accent-dark: #b8860b;
  --accent-light: #ffd700;
  --bg-dark: #1a0a1e;
  --bg-card: #2d1032;
  --bg-surface: #3d1a40;
  --text-primary: #ffffff;
  --text-secondary: #d4a4c8;
  --text-muted: #8a6080;
  --danger: #ff6b6b;
  --success: #00e676;
  --warning: #ffd93d;
  --fm-color: #d81b60;
  --am-color: #d4a04a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --glow-pink: 0 0 20px rgba(216, 27, 96, 0.3);
  --glow-gold: 0 0 20px rgba(212, 160, 74, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ========== Reset & Base ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* ========== API Source Toggle ========== */
.api-source-toggle {
  position: relative;
}

.api-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.api-toggle-btn:hover,
.api-toggle-btn:active {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
  color: var(--text-primary);
}

.api-toggle-btn.verified-active {
  border-color: var(--success);
  background: rgba(0, 230, 118, 0.12);
  color: var(--success);
}

.api-toggle-btn .fa-database {
  font-size: 11px;
}

.api-toggle-btn .fa-caret-down {
  font-size: 10px;
  opacity: 0.6;
}

.api-dropdown {
  position: fixed;
  top: calc(50px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  min-width: 240px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1100;
  animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.api-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.api-dropdown-item:last-child {
  border-bottom: none;
}

.api-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.api-dropdown-item.active {
  background: rgba(216, 27, 96, 0.15);
}

.api-dropdown-item.active .fa-globe,
.api-dropdown-item.active .fa-check-circle {
  color: var(--primary-light);
}

.api-dropdown-item i {
  font-size: 18px;
  color: var(--text-muted);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.api-dropdown-item div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.api-opt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.api-opt-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  touch-action: manipulation;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.2);
}

.band-toggle {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--primary);
  background: rgba(216, 27, 96, 0.15);
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.5px;
}

.band-toggle:active {
  transform: scale(0.95);
}

.band-toggle.fm-active {
  border-color: var(--fm-color);
  background: rgba(216, 27, 96, 0.3);
  color: #fff;
  box-shadow: var(--glow-pink);
}

.band-toggle.am-active {
  border-color: var(--am-color);
  background: rgba(212, 160, 74, 0.25);
  color: var(--accent-light);
  box-shadow: var(--glow-gold);
}

/* ========== Map ========== */
#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Leaflet controls — offset for safe areas */
.leaflet-top.leaflet-left {
  padding-left: var(--safe-left);
  top: calc(56px + var(--safe-top));
}

.leaflet-top.leaflet-right {
  padding-right: var(--safe-right);
}

.leaflet-bottom.leaflet-left {
  padding-left: var(--safe-left);
  padding-bottom: var(--safe-bottom);
}

.leaflet-bottom.leaflet-right {
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-surface) !important;
}

/* ========== Search ========== */
.search-overlay {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  z-index: 1001;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(45, 16, 50, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid rgba(216, 27, 96, 0.2);
  box-shadow: var(--shadow);
}

.search-box i {
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.icon-btn-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.search-results {
  margin-top: 6px;
  background: rgba(45, 16, 50, 0.98);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid rgba(216, 27, 96, 0.15);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:active {
  background: rgba(216, 27, 96, 0.2);
}

.search-result-item i {
  color: var(--primary-light);
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.search-result-item span {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========== Station Badge ========== */
.station-badge {
  position: fixed;
  top: calc(118px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--primary);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ========== Bottom Sheet ========== */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1002;
  background: var(--bg-dark);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 30px rgba(216, 27, 96, 0.12);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(calc(100% - 110px - var(--safe-bottom)));
  max-height: 75dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  will-change: transform;
}

.bottom-sheet.expanded {
  transform: translateY(0);
}

.bottom-sheet.with-player {
  transform: translateY(calc(100% - 110px - 72px - var(--safe-bottom)));
}

.bottom-sheet.expanded.with-player {
  transform: translateY(0);
}

.sheet-handle {
  display: flex;
  justify-content: center;
  padding: 14px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.handle-bar {
  width: 40px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.sheet-header {
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sheet-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.sheet-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  touch-action: manipulation;
  min-height: 36px;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.filter-btn:active {
  transform: scale(0.95);
}

/* ========== Station List ========== */
.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  overscroll-behavior-y: contain;
}

/* Extra padding when now-playing bar is visible so last items aren't hidden */
.bottom-sheet.with-player .sheet-content {
  padding-bottom: calc(80px + var(--safe-bottom));
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 260px;
}

.station-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  touch-action: manipulation;
  min-height: 68px;
}

.station-card:active {
  background: rgba(216, 27, 96, 0.15);
}

.station-card.playing {
  background: rgba(216, 27, 96, 0.1);
  border-left: 3px solid var(--primary);
}

.station-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.station-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.station-icon .fallback-icon {
  font-size: 20px;
  color: var(--primary-light);
}

.station-band-tag {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.station-band-tag.fm {
  background: var(--fm-color);
  color: white;
}

.station-band-tag.am {
  background: var(--am-color);
  color: #1a0a1e;
}

.station-info {
  flex: 1;
  min-width: 0;
}

.station-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.station-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-freq {
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 600;
  margin-top: 2px;
}

.station-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  touch-action: manipulation;
}

.station-play-btn:active {
  transform: scale(0.9);
  background: var(--primary-dark);
}

/* ========== Now Playing Bar ========== */
.now-playing {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1003;
  background: linear-gradient(
    180deg,
    var(--bg-card) 0%,
    rgba(26, 10, 30, 0.98) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(216, 27, 96, 0.3);
  padding: 10px 16px;
  padding-top: 10px;
  padding-bottom: calc(10px + var(--safe-bottom));
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -4px 30px rgba(216, 27, 96, 0.15);
  animation: slideUp 0.3s ease;
  will-change: transform;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.np-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.np-favicon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  object-fit: cover;
  flex-shrink: 0;
}

.np-text {
  flex: 1;
  min-width: 0;
}

.np-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-meta {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.np-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.np-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  touch-action: manipulation;
}

.np-btn:active {
  transform: scale(0.9);
}

.np-btn-main {
  width: 48px;
  height: 48px;
  background: var(--primary);
  font-size: 18px;
}

.np-btn-main:active {
  background: var(--primary-dark);
}

.np-volume-slider {
  width: 100%;
  padding: 4px 0;
}

.np-volume-slider input[type='range'] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

.np-volume-slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(216, 27, 96, 0.4);
}

.np-volume-slider input[type='range']::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(216, 27, 96, 0.4);
}

/* ========== Loading Overlay ========== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.loading-spinner {
  text-align: center;
  color: var(--text-primary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(216, 27, 96, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner p {
  font-size: 14px;
  color: var(--text-secondary);
}

.loading-countdown {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

.cancel-loading-btn {
  margin-top: 16px;
  padding: 8px 28px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.cancel-loading-btn:hover,
.cancel-loading-btn:active {
  background: rgba(255, 107, 107, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

/* ========== Utilities ========== */
.hidden {
  display: none !important;
}

/* ========== Custom Map Marker ========== */
.pin-marker {
  position: relative;
}

.pin-marker .pulse {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(216, 27, 96, 0.3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* Station markers on map */
.station-marker-icon {
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ========== Scrollbar ========== */
.sheet-content::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 4px;
}

.sheet-content::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.sheet-content::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ========== Small Screens ========== */
@media (max-width: 374px) {
  .np-controls {
    gap: 0;
  }

  .np-btn {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .np-btn-main {
    width: 42px;
    height: 42px;
    font-size: 15px;
  }

  .station-icon {
    width: 42px;
    height: 42px;
  }

  .station-play-btn {
    width: 40px;
    height: 40px;
  }

  .search-box {
    padding: 8px 12px;
  }
}

/* ========== Landscape Mobile ========== */
@media (max-height: 500px) and (orientation: landscape) {
  .search-overlay {
    top: calc(8px + var(--safe-top));
  }

  .bottom-sheet {
    max-height: 60dvh;
    transform: translateY(calc(100% - 80px - var(--safe-bottom)));
  }

  .bottom-sheet.with-player {
    transform: translateY(calc(100% - 80px - 64px - var(--safe-bottom)));
  }

  .sheet-handle {
    padding: 8px;
  }

  .sheet-header {
    padding: 0 12px 8px;
  }

  .sheet-header h2 {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .now-playing {
    padding: 6px 16px;
    padding-bottom: calc(6px + var(--safe-bottom));
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }

  .np-favicon {
    width: 32px;
    height: 32px;
  }

  .np-btn-main {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .station-badge {
    top: calc(90px + var(--safe-top));
  }

  .station-card {
    padding: 10px 16px;
    min-height: 56px;
  }

  .station-icon {
    width: 40px;
    height: 40px;
  }
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .bottom-sheet {
    left: auto;
    right: calc(16px + var(--safe-right));
    bottom: calc(16px + var(--safe-bottom));
    width: 380px;
    border-radius: var(--radius-lg);
    max-height: calc(100vh - 140px);
    transform: translateY(calc(100% - 130px));
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
  }

  .bottom-sheet.expanded {
    transform: translateY(0);
  }

  .now-playing {
    left: auto;
    right: calc(16px + var(--safe-right));
    width: 380px;
    bottom: calc(16px + var(--safe-bottom));
    border-radius: var(--radius);
    border: 1px solid rgba(216, 27, 96, 0.3);
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 10px;
  }

  .bottom-sheet.with-player {
    bottom: calc(96px + var(--safe-bottom));
  }

  .search-overlay {
    max-width: 400px;
  }
}

@media (min-width: 1024px) {
  .bottom-sheet {
    width: 420px;
  }

  .now-playing {
    width: 420px;
  }
}

/* ========== Equalizer Animation ========== */
.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.equalizer .bar {
  width: 3px;
  background: var(--primary);
  border-radius: 1px;
  animation: equalize 0.8s ease infinite alternate;
}

.equalizer .bar:nth-child(1) {
  height: 60%;
  animation-delay: 0s;
}
.equalizer .bar:nth-child(2) {
  height: 100%;
  animation-delay: 0.2s;
}
.equalizer .bar:nth-child(3) {
  height: 40%;
  animation-delay: 0.4s;
}
.equalizer .bar:nth-child(4) {
  height: 80%;
  animation-delay: 0.1s;
}

@keyframes equalize {
  0% {
    height: 20%;
  }
  100% {
    height: 100%;
  }
}

/* Leaflet popup custom styles */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid rgba(216, 27, 96, 0.15) !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid rgba(216, 27, 96, 0.15) !important;
}

.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
}

.popup-station {
  padding: 4px 0;
}

.popup-station-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.popup-station-freq {
  font-size: 12px;
  color: var(--accent-light);
}

.popup-play-btn {
  margin-top: 8px;
  padding: 6px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.popup-play-btn:hover {
  background: var(--primary-dark);
}

/* ========== Safe Area Fallback (older browsers) ========== */
@supports not (padding: env(safe-area-inset-bottom)) {
  :root {
    --safe-bottom: 0px;
    --safe-top: 0px;
    --safe-left: 0px;
    --safe-right: 0px;
  }
}

/* Android navigation bar extra bottom padding for gesture nav */
@supports (padding: max(0px)) {
  .now-playing {
    padding-bottom: max(10px, calc(10px + var(--safe-bottom)));
  }

  .bottom-sheet {
    padding-bottom: max(0px, var(--safe-bottom));
  }
}
