/* ==========================================================================
   Base & CSS Variables
   ========================================================================== */
:root {
  --bg-main: #090d16;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-glow: rgba(99, 102, 241, 0.15);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --accent-stop: #ef4444;
  --accent-stop-hover: #dc2626;
  --accent-stop-glow: rgba(239, 68, 68, 0.3);

  --accent-live: #10b981;
  --accent-live-glow: rgba(16, 185, 129, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.03);

  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --radius-full: 9999px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-main);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 16px;
}

/* ==========================================================================
   Ambient Background Decorations
   ========================================================================== */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0) 70%);
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  animation: pulseGlow 10s ease-in-out infinite alternate;
}

.glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.18) 0%, rgba(14, 165, 233, 0) 70%);
  bottom: -100px;
  right: -50px;
}

.ambient-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  z-index: 0;
  pointer-events: none;
}

@keyframes pulseGlow {
  0% { transform: translateX(-50%) scale(1); opacity: 0.5; }
  100% { transform: translateX(-45%) scale(1.15); opacity: 0.75; }
}

/* ==========================================================================
   Player Container & Card
   ========================================================================== */
.player-container {
  width: 100%;
  max-width: 480px;
  z-index: 1;
  margin: auto;
}

.player-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 20px 40px -15px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.player-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.6;
}

/* ==========================================================================
   Card Header & Brand
   ========================================================================== */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.station-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: #fff;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Live Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  transition: var(--transition);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.status-badge.status-offline {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-dim);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.status-badge.status-offline .pulse-dot {
  background: var(--text-dim);
}

.status-badge.status-live {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.status-live .pulse-dot {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: liveBlink 1.4s infinite ease-in-out;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ==========================================================================
   Visualizer Canvas Area
   ========================================================================== */
.visualizer-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  background: rgba(10, 15, 26, 0.65);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

#visualizerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visualizer-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 26, 0.4);
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.visualizer-overlay.fade-out {
  opacity: 0;
}

.overlay-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.state-icon-pulse {
  color: var(--primary-light);
  opacity: 0.7;
}

.overlay-hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ==========================================================================
   Stream Meta Info
   ========================================================================== */
.meta-section {
  text-align: center;
}

.stream-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.stream-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  min-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-tags {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tag svg {
  color: var(--primary-light);
}

/* ==========================================================================
   Controls Section (Play, Stop, Volume)
   ========================================================================== */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(13, 20, 36, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 18px 16px;
}

.playback-buttons {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px;
}

/* Primary Play Button */
.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  height: 56px;
  position: relative;
  transition: var(--transition);
  user-select: none;
}

.btn-play {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-play:hover:not(:disabled) {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-play:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-play.playing {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 20px var(--accent-live-glow);
}

/* Stop Button */
.btn-stop {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-stop:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--accent-stop-glow);
}

.btn-stop:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-stop:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner during buffer */
.btn-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.buffering .btn-spinner {
  display: inline-block;
}

.buffering .btn-icon {
  display: none;
}

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

/* Volume Slider Control */
.volume-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.btn-mute {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-mute:hover {
  color: var(--text-main);
  background: var(--glass-bg);
}

.hidden {
  display: none !important;
}

.volume-slider-wrapper {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
}

.volume-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  background: transparent;
  outline: none;
  position: absolute;
  left: 0;
  top: 0;
  cursor: pointer;
  margin: 0;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.7);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.7);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume-val {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   Footer Status
   ========================================================================== */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding-top: 4px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.indicator-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* ==========================================================================
   Mobile Responsive Styles (<480px)
   ========================================================================== */
@media (max-width: 480px) {
  body {
    padding: 12px 10px;
  }

  .player-card {
    padding: 20px 16px;
    gap: 18px;
    border-radius: 20px;
  }

  .stream-title {
    font-size: 1.35rem;
  }

  .visualizer-wrapper {
    height: 100px;
  }


  .playback-buttons {
    gap: 8px;
  }

  .btn {
    height: 52px;
    font-size: 0.98rem;
  }
}
