/* ════════════════════════════════════════
   PLAYER POPUP — Apple-style fullscreen
════════════════════════════════════════ */

#player-popup {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: none;
  align-items: center;
  justify-content: center;
  animation: ppFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#player-popup.visible {
  display: flex;
}

#player-popup.hiding {
  animation: ppFadeOut 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes ppFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ppFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(28px); }
}

/* ── Blurred dynamic background ── */
.pp-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.pp-bg-color {
  position: absolute;
  inset: -40px;
  background: #0a0a0a;
  transition: background 0.8s ease;
}

/* Dynamic color blobs from album art */
.pp-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  transition: all 1s ease;
  pointer-events: none;
}
.pp-blob-1 {
  width: 70vw; height: 70vw;
  top: -20%; left: -20%;
}
.pp-blob-2 {
  width: 60vw; height: 60vw;
  bottom: -15%; right: -15%;
  opacity: 0.4;
}
.pp-blob-3 {
  width: 50vw; height: 50vw;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.25;
}

/* Grain overlay */
.pp-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

/* Glass overlay for depth */
.pp-glass-overlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(60px) saturate(180%) brightness(0.45);
  -webkit-backdrop-filter: blur(60px) saturate(180%) brightness(0.45);
  z-index: 2;
}

/* ── Close button ── */
.pp-close {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(20px);
  transition: all 0.2s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 4px 12px rgba(0,0,0,0.3);
}
.pp-close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

/* ── Main content wrapper ── */
.pp-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 52px;
  padding: 0 60px;
  width: 100%;
  max-width: 900px;
  animation: ppSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.05s;
  margin-top: -50px;
}

@keyframes ppSlideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Left panel: cover + controls ── */
.pp-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 320px;
  padding-top: 13px;
}

/* Album cover */
.pp-cover-wrap {
  position: relative;
  width: 100%;
  margin-top: 30px;
}

.pp-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--gray-800);
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.7),
    0 16px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pp-cover .pp-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  background: var(--gray-800);
}

/* Cover shine */
.pp-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.12) 0%,
    transparent 50%
  );
  pointer-events: none;
}

/* playing pulse animation */
.pp-cover.playing {
  animation: ppPulse 3s ease-in-out infinite;
}
@keyframes ppPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

/* ── Track info ── */
.pp-track-info {
  width: 100%;
  text-align: center;
}

.pp-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-artist {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.2s;
}
.pp-artist:hover { color: rgba(255,255,255,0.85); }

/* ── Like row ── */
.pp-like-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: -38px;
}

.pp-like-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
}
.pp-like-btn:hover { color: rgba(255,255,255,0.7); transform: scale(1.15); }
.pp-like-btn.liked { color: #fff; }

.pp-options-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.pp-options-btn:hover { color: rgba(255,255,255,0.7); }

/* ── Timeline ── */
.pp-timeline-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-tl {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s;
}
.pp-tl:hover { height: 6px; }

.pp-tl-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0.7), #fff);
  border-radius: 4px;
  position: relative;
  transition: width 0.1s linear;
}
.pp-tl-fill::after {
  content: '';
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%);
  width: 13px; height: 13px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
  opacity: 0;
  transition: opacity 0.15s;
}
.pp-tl:hover .pp-tl-fill::after { opacity: 1; }

.pp-times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.05em;
}

/* ── Controls ── */
.pp-ctrls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: -8px;
}

.pp-cb {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, transform 0.1s;
}
.pp-cb:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  transform: scale(1.08);
}
.pp-cb.on { color: #fff; }

/* Big play button */
.pp-pb {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  margin: 0 8px;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  background: rgba(255,255,255,0.95);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.15),
    0 8px 28px rgba(255,255,255,0.25),
    0 4px 12px rgba(0,0,0,0.4);
}
.pp-pb::before {
  content: '';
  position: absolute;
  top: 3px; left: 5px; right: 5px;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, transparent 100%);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}
.pp-pb:hover {
  transform: scale(1.1);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.5),
    0 12px 36px rgba(255,255,255,0.35),
    0 6px 16px rgba(0,0,0,0.4);
}
.pp-pb:active { transform: scale(0.96); }

/* ── Volume ── */
.pp-vol-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-vol-icon {
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s;
}
.pp-vol-icon:hover { color: rgba(255,255,255,0.7); }

.pp-vol-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  cursor: pointer;
  transition: height 0.15s;
  position: relative;
}
.pp-vol-bar:hover { height: 5px; }
.pp-vol-fill {
  height: 100%;
  background: rgba(255,255,255,0.65);
  border-radius: 3px;
  transition: background 0.15s;
}
.pp-vol-bar:hover .pp-vol-fill { background: #fff; }

/* ── Right panel: "Lyrics" placeholder ── */
.pp-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 480px;
  overflow: hidden;
}

.pp-right-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.pp-right-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.pp-lyrics-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.pp-lyrics-box {
  flex: 1;
  padding: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 rgba(0,0,0,0.15);
  min-height: 380px;
}

.pp-lyrics-example {
  text-align: center;
}

.pp-lyrics-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: rgba(255,255,255,0.25);
}

.pp-lyrics-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.04em;
}

.pp-lyrics-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.12);
  margin-top: 5px;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 768px) {
  #player-popup {
    align-items: flex-end;
  }

  .pp-close {
    top: 16px;
    right: 16px;
  }

  .pp-content {
    flex-direction: column;
    gap: 24px;
    padding: 32px 24px 36px;
    max-width: 100%;
    max-height: 100dvh;
    overflow-y: auto;
  }

  .pp-left {
    width: 100%;
    max-width: 300px;
  }

  .pp-right {
    width: 100%;
    max-height: 200px;
  }

  .pp-lyrics-box {
    min-height: 150px;
  }

  .pp-cover {
    max-width: 260px;
    margin: 0 auto;
    display: block;
  }
}