/* ==============================================================================
   SaharaZik 2.0 — Persistent Floating Audio Player & Equalizer System
   Smooth, non-stop music playback across all pages, with lock screen integration
   ============================================================================== */

.persistent-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
  padding: 0.6rem 2rem 0.8rem 2rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth);
}

/* Sticky Monetization Ad Bar (above controls, unobtrusive) */
.player-ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.05);
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  margin: -0.6rem -2rem 0.5rem -2rem;
  padding: 0.25rem 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.player-ad-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ad-sponsor-tag {
  background: var(--gold-primary);
  color: #070a12;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.65rem;
}

.ad-text {
  color: var(--text-secondary);
  font-weight: 600;
}

.ad-link {
  color: var(--gold-primary);
  text-decoration: underline;
}

/* Player Inner Grid */
.player-grid {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  align-items: center;
  gap: 1.5rem;
}

/* 1. Track Info (Left in LTR, Right in RTL) */
.player-track-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.player-thumb-wrapper {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.player-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-track-meta {
  min-width: 0;
}

.player-track-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-artist {
  font-size: 0.82rem;
  color: var(--gold-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* Live Equalizer Bars */
.player-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  margin-top: 3px;
}

.eq-bar {
  width: 3px;
  background: var(--gold-primary);
  border-radius: 2px;
  height: 4px;
  transition: height 0.15s ease;
}

.persistent-player.is-playing .eq-bar:nth-child(1) { animation: eqJump 0.8s infinite alternate ease-in-out; }
.persistent-player.is-playing .eq-bar:nth-child(2) { animation: eqJump 0.6s infinite alternate ease-in-out 0.2s; }
.persistent-player.is-playing .eq-bar:nth-child(3) { animation: eqJump 0.9s infinite alternate ease-in-out 0.1s; }
.persistent-player.is-playing .eq-bar:nth-child(4) { animation: eqJump 0.7s infinite alternate ease-in-out 0.3s; }
.persistent-player.is-playing .eq-bar:nth-child(5) { animation: eqJump 1.0s infinite alternate ease-in-out 0.15s; }

@keyframes eqJump {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* 2. Main Playback Controls & Scrubber (Center) */
.player-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.ctrl-btn {
  color: var(--text-secondary);
  font-size: 1.15rem;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.ctrl-btn.active {
  color: var(--gold-primary);
}

.play-pause-main {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold-primary), #b89224);
  color: #070a12;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
  transition: var(--transition-fast);
}

.play-pause-main:hover {
  transform: scale(1.08);
  background: linear-gradient(135deg, var(--gold-hover), var(--gold-primary));
}

/* Scrubber / Progress Bar */
.player-scrubber-row {
  width: 100%;
  max-width: 580px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.time-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 42px;
  text-align: center;
  font-family: var(--font-latin);
}

.progress-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--tuareg-blue), var(--gold-primary));
  border-radius: 4px;
  transition: width 0.1s linear;
}

/* 3. Extra Controls & Volume (Right/Left) */
.player-extra-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 130px;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-primary);
  cursor: pointer;
}

/* Radio Live Mode Indicator */
.radio-live-tag {
  display: none;
  background: #ef4444;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  animation: pulse 1.8s infinite;
}

.persistent-player.is-radio .radio-live-tag {
  display: inline-block;
}

.persistent-player.is-radio .player-scrubber-row {
  opacity: 0.35;
  pointer-events: none;
}

/* ==============================================================================
   NATIVE MOBILE & TABLET RESPONSIVE PLAYER (Spotify / Anghami Native Style)
   ============================================================================== */
@media (max-width: 820px) {
  .persistent-player {
    position: fixed !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 52px !important;
    padding: 0 0.75rem !important;
    background: rgba(12, 17, 32, 0.97) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border-top: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.6) !important;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.7) !important;
    z-index: 9999 !important;
    justify-content: center !important;
  }

  .player-ad-slot {
    display: none !important;
  }

  .player-grid {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 0.5rem !important;
    margin: 0 !important;
  }

  .player-track-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
  }

  .player-thumb-wrapper {
    width: 38px !important;
    height: 38px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
  }

  .player-track-meta {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .player-track-title {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  .player-track-artist {
    font-size: 0.7rem !important;
    color: var(--gold-primary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  .player-equalizer {
    display: none !important;
  }

  /* Compact native playback controls */
  .player-center-controls {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 0.3rem !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .player-buttons {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    margin: 0 !important;
  }

  .player-buttons #shuffleBtn,
  .player-buttons #repeatBtn,
  .player-buttons .radio-live-tag {
    display: none !important;
  }

  .ctrl-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.85rem !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
  }

  .play-pause-main {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
    border-radius: 50% !important;
    background: var(--gold-primary) !important;
    color: #070a12 !important;
    border: none !important;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4) !important;
  }

  /* Sleek native progress hairline at top edge of player */
  .player-scrubber-row {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 2.5px !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
  }

  .player-scrubber-row .time-badge {
    display: none !important;
  }

  .player-scrubber-row .progress-container {
    width: 100% !important;
    height: 2.5px !important;
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.12) !important;
    margin: 0 !important;
  }

  .player-scrubber-row .progress-fill {
    height: 100% !important;
    background: var(--gold-primary) !important;
    box-shadow: 0 0 6px var(--gold-primary) !important;
  }

  .player-extra-controls {
    display: none !important;
  }
}

