/* ==========================================================================
   RHEMA RADIO 88.6 FM - MODERN PROFESSIONAL STREAM PLAYER
   Responsive, Clean, Accessible & High Performance
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-dark: #070a13;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151e36 0%, #070a13 70%);
  --card-bg: rgba(16, 23, 42, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-glow: rgba(239, 68, 68, 0.25);
  
  --primary-red: #ef4444;
  --primary-red-glow: rgba(239, 68, 68, 0.45);
  --primary-blue: #3b82f6;
  --primary-blue-glow: rgba(59, 130, 246, 0.35);
  --accent-gold: #f59e0b;
  --live-green: #10b981;
  --live-green-glow: rgba(16, 185, 129, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-family);
  background: var(--bg-dark);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(12px, 3vw, 28px);
  background: var(--bg-gradient);
  position: relative;
}

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

.ambient-glow.top-left {
  top: -100px;
  left: -80px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--primary-red-glow) 0%, transparent 70%);
}

.ambient-glow.bottom-right {
  bottom: -120px;
  right: -80px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, var(--primary-blue-glow) 0%, transparent 70%);
}

/* Main Container */
.player-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}

/* Card Container with Glassmorphism */
.player-card {
  background: var(--card-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: clamp(18px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vw, 24px);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.player-card.is-playing {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 25px 60px -15px rgba(239, 68, 68, 0.15),
              0 0 40px -10px rgba(59, 130, 246, 0.12);
}

/* Header Section */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 16px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-img {
  height: 38px;
  max-width: 160px;
  object-fit: contain;
}

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

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-freq {
  color: var(--primary-red);
  font-weight: 800;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Badges */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--live-green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-live .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--live-green);
  box-shadow: 0 0 10px var(--live-green);
  animation: pulse-dot 1.8s infinite;
}

.badge-live.offline {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--text-dim);
}

.badge-live.offline .live-dot {
  background-color: var(--text-dim);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-icon-header {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-header:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

/* Center Stage: Artwork & Visualizer */
.player-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  position: relative;
  padding-block: 6px;
}

.artwork-wrapper {
  position: relative;
  width: clamp(140px, 32vw, 190px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(59, 130, 246, 0.2) 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.vinyl-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0d121f;
  border: 2px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  animation: rotate-vinyl 16s linear infinite;
  animation-play-state: paused;
}

.is-playing .vinyl-disc {
  animation-play-state: running;
}

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

.artwork-img {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  object-fit: cover;
  background: #111827;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.vinyl-center-hole {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #070a13;
  border: 2px solid rgba(255, 255, 255, 0.3);
  z-index: 2;
}

/* Sound Waves / Visualizer Bar */
.equalizer-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  margin-top: -4px;
}

.eq-bar {
  width: 4px;
  height: 6px;
  background: linear-gradient(to top, var(--primary-blue), var(--primary-red));
  border-radius: var(--radius-full);
  transition: height 0.1s ease;
  opacity: 0.4;
}

.is-playing .eq-bar {
  opacity: 1;
  animation: eq-bounce 1.2s ease-in-out infinite alternate;
}

.is-playing .eq-bar:nth-child(1) { animation-duration: 0.8s; }
.is-playing .eq-bar:nth-child(2) { animation-duration: 1.1s; animation-delay: 0.1s; }
.is-playing .eq-bar:nth-child(3) { animation-duration: 0.7s; animation-delay: 0.2s; }
.is-playing .eq-bar:nth-child(4) { animation-duration: 1.3s; animation-delay: 0.15s; }
.is-playing .eq-bar:nth-child(5) { animation-duration: 0.9s; animation-delay: 0.3s; }
.is-playing .eq-bar:nth-child(6) { animation-duration: 1.2s; animation-delay: 0.25s; }
.is-playing .eq-bar:nth-child(7) { animation-duration: 0.75s; animation-delay: 0.05s; }
.is-playing .eq-bar:nth-child(8) { animation-duration: 1.0s; animation-delay: 0.35s; }

@keyframes eq-bounce {
  0% { height: 6px; }
  50% { height: 28px; }
  100% { height: 10px; }
}

/* Track Metadata Info */
.track-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-title {
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-inline: 8px;
}

.track-artist {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--primary-red);
  letter-spacing: 0.01em;
}

.track-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-divider {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Playback & Volume Controls */
.controls-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.playback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Big Play Button */
.btn-play-main {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.45);
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.btn-play-main:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.6);
}

.btn-play-main:active {
  transform: scale(0.96);
}

.btn-play-main svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform var(--transition-fast);
}

.btn-play-main.buffering svg {
  animation: spin 1s linear infinite;
}

.btn-play-main.autoplay-waiting {
  animation: pulse-attention 1.6s ease-in-out infinite;
}

@keyframes pulse-attention {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
    transform: scale(1.06);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    transform: scale(1);
  }
}

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

/* Playback Status & Duration */
.playback-status-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.playback-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.playback-timer {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* Stream Server Selector */
.server-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.server-select:hover, .server-select:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.server-select option {
  background: #0f172a;
  color: #fff;
}

/* Volume Slider */
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.btn-mute:hover {
  color: #fff;
}

.btn-mute svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.vol-slider-wrap {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.vol-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.vol-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.vol-input::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: var(--primary-red);
}

.vol-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

.vol-value-text {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Secondary Actions / Footer Bar */
.player-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: translateY(-2px);
}

.btn-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* External App Playlist Downloads Modal / Dropdown */
.playlist-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
  padding: 16px;
}

.playlist-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.playlist-dialog {
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(20px);
  transition: transform var(--transition-smooth);
}

.playlist-modal.active .playlist-dialog {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
}

.modal-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.playlist-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-opt-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.playlist-opt-link:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fff;
}

.playlist-opt-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-smooth);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Footer Tag */
.player-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.player-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.player-footer a:hover {
  color: var(--primary-red);
}

/* ==========================================================================
   POPUP / MINI EMBED / RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .player-card {
    padding: 16px;
    gap: 14px;
  }

  .player-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .brand-logo-img {
    height: 32px;
  }
}

/* Dedicated Mini-Player / Popup Mode */
body.embed-mode, body.mini-mode {
  padding: 6px;
  justify-content: flex-start;
}

body.embed-mode .player-wrapper,
body.mini-mode .player-wrapper {
  max-width: 100%;
}

body.embed-mode .player-card,
body.mini-mode .player-card {
  padding: 14px;
  gap: 12px;
  border-radius: var(--radius-lg);
  box-shadow: none;
}

body.embed-mode .player-stage,
body.mini-mode .player-stage {
  gap: 10px;
}

body.embed-mode .artwork-wrapper,
body.mini-mode .artwork-wrapper {
  width: 100px;
}

body.embed-mode .player-footer,
body.mini-mode .player-footer {
  display: none;
}
