/* ChartWave FM — Marine Corps Bubble Theme */

:root {
  --scarlet:      #CC0000;
  --scarlet-dark: #880000;
  --scarlet-dim:  rgba(204, 0, 0, 0.15);
  --gold:         #D4AF37;
  --gold-dim:     rgba(212, 175, 55, 0.2);
  --gold-faint:   rgba(212, 175, 55, 0.07);
  --bg:           #0a0a0a;
  --bg2:          #1a0000;
  --glass:        rgba(15, 0, 0, 0.45);
  --glass-border: rgba(204, 0, 0, 0.35);
  --text:         #f5f5f5;
  --text-muted:   rgba(255, 255, 255, 0.45);
  --success:      #22C55E;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 50%, var(--bg) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  overscroll-behavior: none;
}

/* ── Animated BG ─────────────────────────────────────────────────────────── */

.bg-glow {
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(circle at 20% 50%, rgba(204,0,0,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(212,175,55,0.06) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(204,0,0,0.04) 0%, transparent 50%);
  animation: floatBg 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes floatBg {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  33%     { transform: translate(30px,-30px) rotate(120deg); }
  66%     { transform: translate(-20px,20px) rotate(240deg); }
}

/* ── Main Bubble ─────────────────────────────────────────────────────────── */

.app-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 32px;
}

.main-bubble {
  width: 100%;
  max-width: 900px;
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 44px;
  border: 2px solid var(--glass-border);
  padding: 32px 28px;
  animation: bubblePulse 3s ease-in-out infinite;
}

@keyframes bubblePulse {
  0%,100% { box-shadow: 0 30px 90px rgba(204,0,0,0.4),  inset 0 0 50px rgba(212,175,55,0.04), 0 0 100px rgba(0,0,0,0.8); }
  50%     { box-shadow: 0 35px 110px rgba(204,0,0,0.55), inset 0 0 70px rgba(212,175,55,0.07), 0 0 120px rgba(0,0,0,0.9); }
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.logo-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark));
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 20px rgba(204,0,0,0.5), 0 0 8px rgba(212,175,55,0.3);
  flex-shrink: 0;
}

.logo-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 5px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,175,55,0.4);
}

.logo-sub {
  font-size: 10px;
  color: rgba(212,175,55,0.45);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 2px;
}

.on-air-badge {
  background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark));
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  animation: onAirPulse 1.4s ease-in-out infinite;
}

@keyframes onAirPulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.35; }
}

/* ── Waveform ─────────────────────────────────────────────────────────────── */

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 32px;
  margin: 8px 0;
}

.wave-bar {
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--scarlet), #FF4444);
  opacity: 0.85;
  transition: height 0.08s ease;
}

/* ── Station Grid ─────────────────────────────────────────────────────────── */

.stations-label {
  font-size: 9px;
  color: rgba(212,175,55,0.4);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 14px;
}

.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.station-btn {
  background: rgba(20,0,0,0.5);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s;
  backdrop-filter: blur(10px);
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.station-btn:hover,
.station-btn.active {
  background: rgba(204,0,0,0.25);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(204,0,0,0.35), 0 0 8px rgba(212,175,55,0.25);
  transform: translateY(-2px);
}

.station-btn .s-icon  { font-size: 26px; margin-bottom: 8px; }
.station-btn .s-name  { font-size: 14px; font-weight: 900; letter-spacing: 2px; color: var(--gold); margin-bottom: 4px; }
.station-btn .s-genre { font-size: 10px; color: var(--text-muted); margin-bottom: 8px; }
.station-btn .s-chart {
  display: inline-block;
  font-size: 8px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--scarlet-dim);
  border: 1px solid rgba(212,175,55,0.2);
  color: rgba(212,175,55,0.6);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.station-btn .s-freq  { font-size: 18px; font-weight: 900; color: var(--scarlet); }

.station-btn.active .s-name { color: #FFD700; }
.station-btn.active .s-freq { color: #FF4444; }

/* ── Now Playing Panel ───────────────────────────────────────────────────── */

.now-playing-panel {
  background: rgba(20,0,0,0.55);
  border: 1px solid var(--gold-dim);
  border-radius: 28px;
  padding: 22px 24px;
  margin-bottom: 16px;
}

.np-label {
  font-size: 9px;
  color: rgba(212,175,55,0.4);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.np-station {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(212,175,55,0.3);
}

.np-freq {
  font-size: 14px;
  font-weight: 700;
  color: var(--scarlet);
  margin-bottom: 12px;
}

.np-title  { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.np-artist { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

/* Progress bar */
.progress-wrap {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--scarlet), #FF4444);
  border-radius: 2px;
  width: 0%;
  transition: width 1s linear;
}

/* ── Controls ─────────────────────────────────────────────────────────────── */

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

.ctrl-btn {
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: all 0.25s;
  font-size: 18px;
}

.ctrl-btn.secondary {
  width: 44px; height: 44px;
  background: rgba(204,0,0,0.2);
  border: 1px solid rgba(212,175,55,0.25);
  color: rgba(212,175,55,0.7);
}

.ctrl-btn.secondary:hover {
  background: rgba(204,0,0,0.35);
  border-color: var(--gold);
  color: var(--gold);
  transform: scale(1.08);
}

.ctrl-btn.primary {
  width: 58px; height: 58px; font-size: 22px;
  background: linear-gradient(135deg, var(--scarlet), var(--scarlet-dark));
  border: 2px solid var(--gold);
  color: var(--gold);
  box-shadow: 0 0 20px rgba(204,0,0,0.5), 0 0 8px rgba(212,175,55,0.25);
}

.ctrl-btn.primary:hover {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(204,0,0,0.65), 0 0 12px rgba(212,175,55,0.35);
}

/* ── History Panel ───────────────────────────────────────────────────────── */

.history-panel {
  background: rgba(20,0,0,0.4);
  border: 1px solid rgba(212,175,55,0.12);
  border-radius: 20px;
  padding: 16px 20px;
  margin-top: 16px;
}

.history-label {
  font-size: 9px;
  color: rgba(212,175,55,0.35);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

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

.history-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--scarlet);
  flex-shrink: 0;
  opacity: 0.6;
}

.history-title  { font-size: 11px; font-weight: 600; color: var(--text); }
.history-artist { font-size: 10px; color: var(--text-muted); }

/* ── Status Bar ──────────────────────────────────────────────────────────── */

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: rgba(212,175,55,0.3);
  letter-spacing: 1px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(212,175,55,0.08);
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Loading State ───────────────────────────────────────────────────────── */

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay.show { display: flex; }

.spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(212,175,55,0.15);
  border-top-color: var(--scarlet);
  border-right-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 12px;
  color: rgba(212,175,55,0.6);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(20,0,0,0.92);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 1px;
  transition: transform 0.3s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .main-bubble { padding: 24px 16px; border-radius: 32px; }
  .logo-title  { font-size: 24px; letter-spacing: 3px; }
  .stations-grid { grid-template-columns: repeat(2, 1fr); }
  .np-station { font-size: 22px; }
  .np-title   { font-size: 15px; }
}
