/* ============================================================================
   DESKTOP & MOBILE PLAYER DOCK (player.css)
   ============================================================================ */

/* Hidden State Rule - Highest Specificity */
#player-bar.hidden,
.music-player-bar.hidden,
#player-bar[style*="display: none"] {
  display: none !important;
}

/* Shared cover constraints — MUST exist outside media queries
   or mobile renders the raw album art at full resolution. */
.cover-wrapper-player {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.cover-wrapper-player .track-cover,
.cover-wrapper-player img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.music-player-bar .player-container,
#player-bar .player-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  direction: ltr;
  gap: 14px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.music-player-bar,
#player-bar {
  direction: ltr;
}

.music-player-bar .track-info,
#player-bar .track-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
}

.music-player-bar .btn-like-heart {
  flex-shrink: 0;
  color: #a1a1aa;
  font-size: 1rem;
  padding: 6px;
  transition: color 0.18s ease, transform 0.18s ease;
}

.music-player-bar .btn-like-heart:hover,
.music-player-bar .btn-like-heart.liked {
  color: #ffffff;
}

.music-player-bar .volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.track-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.track-details h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-details p {
  font-size: 0.78rem;
  color: #a1a1aa;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* DESKTOP PLAYER DOCK (min-width: 769px) — Spotify-style LTR */
@media (min-width: 769px) {
  #player-bar:not(.hidden),
  .music-player-bar:not(.hidden) {
    display: flex !important;
    position: fixed !important;
    bottom: 18px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 1000 !important;
    width: calc(100% - 40px) !important;
    max-width: 1120px !important;
    height: 84px !important;
    min-height: 84px !important;
    max-height: 84px !important;
    padding: 0 22px !important;
    border-radius: 28px !important;
    background: rgba(16, 16, 22, 0.96) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    align-items: center !important;
    overflow: visible !important;
    isolation: isolate !important;
    direction: ltr !important;
  }

  .music-player-bar .player-container,
  #player-bar .player-container {
    display: grid !important;
    grid-template-columns: minmax(200px, 1fr) minmax(280px, 2fr) minmax(200px, 1fr) !important;
    align-items: center !important;
    direction: ltr !important;
    gap: 12px !important;
  }

  .music-player-bar .track-info,
  #player-bar .track-info {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex-shrink: 1 !important;
    justify-self: start !important;
  }

  .cover-wrapper-player {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    border-radius: 12px !important;
  }

  .track-details h4 {
    font-size: 0.95rem !important;
    text-align: left !important;
  }

  .track-details p {
    font-size: 0.8rem !important;
    text-align: left !important;
  }

  .music-player-bar .player-controls,
  #player-bar .player-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    justify-self: center !important;
  }

  .music-player-bar .control-buttons,
  #player-bar .control-buttons {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    direction: ltr !important;
  }

  .btn-play,
  #btn-play,
  #btn-play-pause.btn-play,
  .music-player-bar .btn-play {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 1.05rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.35) !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease !important;
  }

  .btn-play:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 6px 18px rgba(255, 255, 255, 0.5) !important;
  }

  .btn-prev, .btn-next, .btn-shuffle, .btn-repeat,
  .music-player-bar .btn-ctrl {
    background: transparent !important;
    border: none !important;
    color: #a1a1aa !important;
    font-size: 1.05rem !important;
    cursor: pointer !important;
    transition: color 0.18s ease, transform 0.18s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
  }

  .btn-prev:hover, .btn-next:hover, .btn-shuffle:hover, .btn-repeat:hover {
    color: #ffffff !important;
    transform: scale(1.1) !important;
  }

  .progress-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 560px !important;
    direction: ltr !important;
  }

  .progress-time,
  .music-player-bar .time-label {
    font-size: 0.75rem !important;
    color: #a1a1aa !important;
    font-weight: 600 !important;
    min-width: 34px !important;
    text-align: center !important;
    font-variant-numeric: tabular-nums !important;
  }

  .progress-bar-wrapper {
    flex: 1 !important;
    height: 4px !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: 4px !important;
    position: relative !important;
    cursor: pointer !important;
  }

  .progress-bar-fill {
    height: 100% !important;
    background: #ffffff !important;
    border-radius: 4px !important;
  }

  .player-options {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    flex-shrink: 0 !important;
    justify-self: end !important;
    direction: ltr !important;
  }

  .volume-container {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 110px !important;
  }

  .volume-slider,
  .music-player-bar .volume-bar {
    width: 90px !important;
    accent-color: #ffffff !important;
    height: 4px !important;
  }
}

/* ============================================================================
   MOBILE FULLSCREEN PLAYER — modern glass / ambient redesign
   ============================================================================ */
.mobile-fullscreen-player {
  --mfp-accent: #e4e4e7;
  --mfp-glass: rgba(18, 18, 22, 0.55);
  --pf: 0;
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: #080809;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 18px calc(16px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.42s var(--ease-spring);
  overflow: hidden;
  box-sizing: border-box;
  font-family: var(--font-main), 'Yekan Bakh', Tahoma, sans-serif;
}

.mobile-fullscreen-player.hidden {
  display: none !important;
}

.mobile-fullscreen-player.active {
  transform: translateY(0);
}

.mfp-bg-blur {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(52px) saturate(1.35) brightness(0.55);
  transform: scale(1.12);
  z-index: 0;
  pointer-events: none;
  transition: background-image 0.45s ease, opacity 0.45s ease;
}

.mfp-bg-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 8, 9, 0.35) 0%, rgba(8, 8, 9, 0.15) 28%, rgba(8, 8, 9, 0.55) 62%, rgba(8, 8, 9, 0.92) 100%),
    radial-gradient(ellipse 80% 50% at 50% 18%, rgba(255, 255, 255, 0.08), transparent 70%);
}

.mfp-topbar,
.mfp-artwork-container,
.mfp-track-info,
.mfp-progress-container,
.mfp-controls,
.mfp-action-dock {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.mfp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mfp-close-btn,
.mfp-more-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #f4f4f5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: background 0.2s ease, border-color 0.2s ease;
  position: relative;
  z-index: 40;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mfp-close-btn:active,
.mfp-more-btn:active {
  background: rgba(255, 255, 255, 0.14);
}

.mfp-now-playing {
  font-size: 0.78rem;
  color: rgba(244, 244, 245, 0.72);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mfp-artwork-container {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  max-height: min(44vh, 360px);
  margin: 6px 0 4px;
  position: relative;
  overflow: visible;
}

.mfp-artwork-glow {
  position: absolute;
  width: min(70vw, 300px);
  height: min(70vw, 300px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 42%, transparent 70%);
  filter: blur(28px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.mfp-artwork-wrapper {
  position: relative;
  z-index: 1;
  width: min(72vw, 300px);
  max-width: 100%;
  max-height: min(42vh, 300px);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 40px rgba(255, 255, 255, 0.06);
  transform: scale(0.96);
  transition: transform 0.45s var(--ease-spring), box-shadow 0.45s ease;
}

.mfp-artwork-wrapper.playing {
  transform: scale(1);
  box-shadow:
    0 32px 70px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 56px rgba(255, 255, 255, 0.12);
}

.mfp-artwork-wrapper.playing + .mfp-artwork-glow,
.mfp-artwork-container:has(.mfp-artwork-wrapper.playing) .mfp-artwork-glow {
  opacity: 1;
  transform: scale(1.08);
}

.mfp-artwork {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.mfp-track-info {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 14px;
  direction: rtl;
}

.mfp-track-text {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.mfp-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mfp-artist {
  margin: 6px 0 0;
  color: rgba(228, 228, 231, 0.68);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mfp-like-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f4f4f5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mfp-like-btn:active {
  transform: scale(0.94);
}

.mfp-like-btn.liked,
.mfp-like-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.mfp-progress-container {
  margin-bottom: 6px;
  direction: ltr;
}

.mfp-progress-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #ffffff 0%,
    #ffffff calc(var(--pf) * 1%),
    rgba(255, 255, 255, 0.18) calc(var(--pf) * 1%),
    rgba(255, 255, 255, 0.18) 100%
  );
  outline: none;
  cursor: pointer;
  transition: height 0.18s ease;
}

.mfp-progress-container:active .mfp-progress-bar,
.mfp-progress-bar:focus-visible {
  height: 7px;
}

.mfp-progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  margin-top: 0;
}

.mfp-progress-container:active .mfp-progress-bar::-webkit-slider-thumb,
.mfp-progress-bar:focus-visible::-webkit-slider-thumb,
.mfp-progress-bar:hover::-webkit-slider-thumb {
  opacity: 1;
  transform: scale(1.05);
}

.mfp-progress-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  opacity: 0;
}

.mfp-progress-bar::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.mfp-time-labels {
  display: flex;
  justify-content: space-between;
  color: rgba(161, 161, 170, 0.95);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  direction: ltr;
}

.mfp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 14px 0 18px;
  direction: ltr;
}

.mfp-ctrl-btn {
  background: transparent;
  border: none;
  color: rgba(244, 244, 245, 0.78);
  cursor: pointer;
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.mfp-ctrl-btn:active {
  transform: scale(0.92);
}

.mfp-ctrl-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.mfp-play {
  width: 68px !important;
  height: 68px !important;
  background: #ffffff !important;
  color: #09090b !important;
  font-size: 1.35rem !important;
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.18);
}

.mfp-play:active {
  transform: scale(0.94);
}

.mfp-volume-row {
  display: none !important;
}

.mfp-action-dock {
  margin-top: auto;
  padding: 4px 0 2px;
}

.mfp-action-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 8px;
  border-radius: 22px;
  background: rgba(18, 18, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.mfp-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 16px;
  color: rgba(228, 228, 231, 0.78);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mfp-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
  color: #f4f4f5;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.mfp-action-btn:active {
  transform: scale(0.96);
}

.mfp-action-btn.active,
.mfp-action-btn:hover {
  color: #ffffff;
}

.mfp-action-btn.active .mfp-action-icon,
.mfp-action-btn:hover .mfp-action-icon {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}

.mfp-repeat-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.55rem;
  font-weight: 800;
}
