/* Global Persistent Audio Player */
.global-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,1) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-player.visible {
  transform: translateY(0);
}

.global-player-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Cover/Icon */
.gp-cover {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, #c026d3, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}

.gp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Track Info */
.gp-info {
  flex: 1;
  min-width: 0;
}

.gp-title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.gp-artist {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Bar */
.gp-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 80px;
  max-width: 400px;
}

@media (min-width: 640px) {
  .gp-progress-wrap {
    min-width: 120px;
  }
}

.gp-progress {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gp-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #c026d3, #a855f7);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.gp-progress:hover .gp-progress-bar {
  background: linear-gradient(90deg, #a855f7, #c026d3);
}

.gp-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

/* Controls */
.gp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gp-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #475569;
  transition: all 0.2s;
}

.gp-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.gp-btn-play {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #c026d3, #a855f7);
  color: white;
  font-size: 18px;
}

.gp-btn-play svg {
  display: block;
}

.gp-btn-play:hover {
  background: linear-gradient(135deg, #a855f7, #c026d3);
  color: white;
  transform: scale(1.05);
}

.gp-btn-prev,
.gp-btn-next {
  color: #64748b;
}

.gp-btn-prev:hover,
.gp-btn-next:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.gp-btn-close {
  width: 32px;
  height: 32px;
  font-size: 18px;
  color: #94a3b8;
}

.gp-btn-close:hover {
  color: #ef4444;
  background: #fef2f2;
}

/* Mobile adjustments */
@media (max-width: 639px) {
  .global-player {
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .global-player-inner {
    gap: 8px;
  }

  .gp-cover {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .gp-info {
    display: none;
  }

  .gp-progress-wrap {
    display: flex !important;
    flex: 1;
    min-width: 60px;
  }

  .gp-progress {
    height: 8px;
  }

  .gp-time {
    font-size: 10px;
  }

  .gp-btn {
    width: 32px;
    height: 32px;
  }

  .gp-btn-play {
    width: 36px;
    height: 36px;
  }

  .gp-btn svg {
    width: 14px;
    height: 14px;
  }

  .gp-btn-play svg {
    width: 16px;
    height: 16px;
  }

  .gp-btn-close {
    width: 26px;
    height: 26px;
  }

  .gp-controls {
    gap: 4px;
  }
}

/* Loading state */
.global-player.loading .gp-btn-play {
  pointer-events: none;
  opacity: 0.7;
}

.global-player.loading .gp-btn-play::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: gp-spin 0.8s linear infinite;
  position: absolute;
}

@keyframes gp-spin {
  to { transform: rotate(360deg); }
}

/* Spacer to prevent content from being hidden behind player */
body.has-global-player {
  padding-bottom: 80px;
}

@media (max-width: 639px) {
  body.has-global-player {
    padding-bottom: 70px;
  }
}
