/**
 * ============================================================
 * ANIME007 - 24/7 ANIME RADIO PLAYER (STICKY BOTTOM BAR)
 * Modern Anime Glassmorphism & Cyberpunk Audio Visualizer
 * ============================================================
 */

:root {
  --radio-bg: rgba(9, 14, 26, 0.94);
  --radio-border: rgba(56, 189, 248, 0.35);
  --radio-accent: #38bdf8;
  --radio-accent-purple: #a855f7;
  --radio-accent-pink: #ec4899;
  --radio-text: #f8fafc;
  --radio-subtext: #94a3b8;
  --radio-height: 64px;
}

/* Body spacing when radio is active so footer isn't covered */
body.has-radio-player {
  padding-bottom: var(--radio-height) !important;
}

/* YouTube Audio Host - kept in viewport and sized for YouTube embed decoder */
.anime-radio-hidden-iframe {
  position: fixed !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 240px !important;
  height: 180px !important;
  opacity: 0.001 !important;
  pointer-events: none !important;
  z-index: -9999 !important;
  border: none !important;
}

/* ================= MAIN DOCKED PLAYER BAR ================= */
#animeRadioPlayer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--radio-height);
  background: var(--radio-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--radio-border);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.65), 0 -1px 0 rgba(255, 255, 255, 0.08) inset;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  user-select: none;
  font-family: 'Prompt', sans-serif;
  color: var(--radio-text);
}

#animeRadioPlayer.radio-collapsed {
  transform: translateY(120%);
  pointer-events: none;
}

/* Thin Top Progress Bar for Live Track Position */
.radio-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  z-index: 10;
}

.radio-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #a855f7, #ec4899);
  transition: width 0.3s linear;
}

/* Left Section: Cover Art, Title & Visualizer */
.radio-left-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
  max-width: 45%;
}

/* Spinning Disc Cover */
.radio-cover-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #38bdf8, #a855f7, #ec4899);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.radio-cover-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  animation: radioDiscSpin 14s linear infinite;
  animation-play-state: paused;
  border: 2px solid #090e1a;
}

.is-playing .radio-cover-img {
  animation-play-state: running;
}

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

/* Center vinyl dot */
.radio-cover-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #090e1a;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.radio-meta-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.radio-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.radio-desktop-badge {
  display: inline;
}

.radio-mobile-badge {
  display: none;
}

.radio-live-time {
  margin-left: 6px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 700;
  white-space: nowrap;
}

.radio-live-dot {
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  animation: radioPulse 1.8s infinite;
}

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

.radio-title-marquee {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  line-height: 1.3;
}

.radio-artist {
  font-size: 0.72rem;
  color: var(--radio-subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* Audio Visualizer Waves */
.radio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
  padding-left: 0.5rem;
  flex-shrink: 0;
}

.radio-bar {
  width: 3px;
  height: 4px;
  background: linear-gradient(to top, #38bdf8, #a855f7);
  border-radius: 3px;
  transition: height 0.15s ease;
}

.is-playing .radio-bar:nth-child(1) { animation: radioWave 0.8s ease-in-out infinite alternate; }
.is-playing .radio-bar:nth-child(2) { animation: radioWave 1.1s ease-in-out infinite alternate 0.15s; }
.is-playing .radio-bar:nth-child(3) { animation: radioWave 0.7s ease-in-out infinite alternate 0.3s; }
.is-playing .radio-bar:nth-child(4) { animation: radioWave 1.2s ease-in-out infinite alternate 0.2s; }
.is-playing .radio-bar:nth-child(5) { animation: radioWave 0.9s ease-in-out infinite alternate 0.4s; }

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

/* Center Section: Playback Controls */
.radio-center-section {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
}

.radio-ctrl-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 1rem;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.radio-ctrl-btn:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.radio-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  transition: all 0.25s ease;
  margin: 0 0.25rem;
}

.radio-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.8);
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.radio-track-counter {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  padding: 0 0.4rem;
  font-variant-numeric: tabular-nums;
}

/* Right Section: Volume & Minimize */
.radio-right-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  max-width: 45%;
}

.radio-volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-vol-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.radio-vol-btn:hover {
  color: #38bdf8;
}

.radio-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 75px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.radio-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

.radio-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  border: none;
}

.radio-minimize-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.radio-minimize-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

/* ================= AUTOPLAY PROMPT TOAST ================= */
.radio-autoplay-notice {
  position: fixed;
  bottom: 74px;
  right: 1.5rem;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(12px);
  border: 1px solid #38bdf8;
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
  cursor: pointer;
  z-index: 9991;
  font-size: 0.8rem;
  color: #fff;
  font-weight: 600;
  animation: radioBounce 2.5s infinite;
  transition: opacity 0.3s, transform 0.3s;
}

.radio-autoplay-notice:hover {
  transform: scale(1.04);
}

@keyframes radioBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ================= FLOATING MINI BUBBLE (WHEN MINIMIZED) ================= */
#animeRadioMiniBubble {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  height: 44px;
  background: rgba(9, 14, 26, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--radio-border);
  border-radius: 9999px;
  padding: 0 0.9rem 0 0.45rem;
  display: none;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.3);
  z-index: 9989;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Prompt', sans-serif;
  color: #fff;
}

#animeRadioMiniBubble:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 22px rgba(56, 189, 248, 0.5);
  border-color: #38bdf8;
}

.radio-mini-disc {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #38bdf8;
  animation: radioDiscSpin 14s linear infinite;
  animation-play-state: paused;
}

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

.radio-mini-text {
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= MOBILE RESPONSIVENESS ================= */
@media (max-width: 768px) {
  :root {
    --radio-height: 60px;
  }

  #animeRadioPlayer {
    padding: 0 0.75rem;
    height: 60px;
    gap: 0.5rem;
  }

  /* Left Section: Cover Art & Text takes all available space */
  .radio-left-section {
    max-width: none !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    gap: 0.6rem;
    overflow: hidden;
  }

  .radio-cover-wrap {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .radio-meta-wrap {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    overflow: hidden;
    gap: 2px;
    justify-content: center;
  }

  /* Top line: Compact Live tag and timestamp */
  .radio-badge-live {
    display: flex !important;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.64rem;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100%;
    line-height: 1.2;
  }

  .radio-desktop-badge {
    display: none !important;
  }

  .radio-mobile-badge {
    display: inline !important;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
  }

  .radio-live-time {
    margin-left: 3px !important;
    font-size: 0.65rem !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
  }

  /* Bottom line: Song title fits cleanly without overflowing */
  .radio-title-marquee {
    max-width: 100% !important;
    font-size: 0.82rem !important;
    line-height: 1.25;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Hide artist subtitle on mobile to maintain 2 clean, vertically centered lines */
  .radio-artist {
    display: none !important;
  }

  /* Hide visualizer and volume slider on mobile */
  .radio-visualizer {
    display: none !important;
  }

  .radio-volume-wrap {
    display: none !important;
  }

  .radio-track-counter {
    display: none !important;
  }

  /* Center Controls: Compact playback buttons */
  .radio-center-section {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .radio-play-btn {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
    margin: 0;
    flex-shrink: 0;
  }

  .radio-ctrl-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  /* Right Section: Compact minimize button */
  .radio-right-section {
    max-width: none !important;
    flex: 0 0 auto !important;
    gap: 0.25rem;
    justify-content: flex-end;
  }

  .radio-minimize-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  /* Mini floating bubble mobile adjustment */
  #animeRadioMiniBubble {
    bottom: 0.75rem;
    left: 0.75rem;
    max-width: calc(100vw - 1.5rem);
    height: 40px;
    padding: 0 0.75rem 0 0.35rem;
    font-size: 0.75rem;
  }

  .radio-mini-disc {
    width: 28px;
    height: 28px;
  }

  .radio-mini-text {
    max-width: 120px;
    font-size: 0.74rem;
  }

  /* Autoplay notice toast */
  .radio-autoplay-notice {
    bottom: 72px;
    left: 1rem;
    right: 1rem;
    justify-content: center;
    font-size: 0.76rem;
    padding: 0.4rem 0.85rem;
  }
}

/* Extra small mobile screens (<= 420px) */
@media (max-width: 420px) {
  #animeRadioPlayer {
    padding: 0 0.5rem;
    gap: 0.35rem;
  }

  .radio-left-section {
    gap: 0.45rem;
  }

  .radio-cover-wrap {
    width: 36px;
    height: 36px;
  }

  .radio-ctrl-btn {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  .radio-play-btn {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .radio-minimize-btn {
    width: 28px;
    height: 28px;
  }

  .radio-title-marquee {
    font-size: 0.78rem !important;
  }

  .radio-badge-live {
    font-size: 0.6rem !important;
  }

  .radio-live-time {
    font-size: 0.6rem !important;
  }
}

/* Tiny mobile screens (<= 340px) */
@media (max-width: 340px) {
  .radio-ctrl-btn {
    display: none !important;
  }
}
