/* player.css — Audio player for consume view */

/* ─── Mini Player ─── */

.player-mini {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease;
}

@media (min-width: 769px) {
  .player-mini {
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    border-radius: 14px 14px 0 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .player-mini.player-mini-hidden {
    transform: translateX(-50%) translateY(100%);
  }
}

.player-mini-hidden {
  transform: translateY(100%);
}

/* Seek area — large touch target above the thin bar */
.player-mini-seek {
  position: relative;
  padding: 20px 0 0;
  margin: -20px 0 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.player-mini-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
}

.player-mini-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.45);
  width: 0;
}

.player-mini-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  cursor: pointer;
}

.player-mini-cover {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
  flex-shrink: 0;
}

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

.player-mini-info {
  flex: 1;
  min-width: 0;
}

.player-mini-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-mini-artist {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-mini-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-shrink: 0;
}

.player-loading .player-mini-play {
  animation: pulse-loading 0.8s ease infinite;
}

@keyframes pulse-loading {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── Full Player ─── */

.player-full {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Backdrop blur layer — separate from bg image so blur works on iOS */
.player-full-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(30px) saturate(1.2);
  -webkit-backdrop-filter: blur(30px) saturate(1.2);
  z-index: 0;
}

.player-full-bg {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  z-index: 0;
}

.player-full-bg.has-cover {
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.35) saturate(1.5);
  transform: scale(1.3);
}

.player-full-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0.85) 100%);
}

.player-full-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem 2rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  gap: 1.5rem;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

/* Header: drag handle + close X */
.player-full-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 0;
  flex-shrink: 0;
}

.player-full-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.3);
}

.player-full-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 6px;
  display: flex;
}

.player-full-close:hover { color: #fff; }

/* Drag zone — the area that responds to swipe down */
.player-full-drag-zone {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ─── Cover ─── */

.player-full-cover-wrap {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
}

.player-full-cover {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.2);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

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

/* ─── Info ─── */

.player-full-info {
  text-align: center;
  width: 100%;
}

.player-full-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-full-artist {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

/* ─── Seek bar (custom div-based, works everywhere) ─── */

.player-full-seek {
  width: 100%;
  padding: 12px 0;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.player-seek-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.player-seek-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  width: 0;
}

.player-seek-thumb {
  display: none;
}

.player-full-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
}

/* ─── Controls ─── */

.player-full-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.player-ctrl {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.player-ctrl:hover { color: #fff; }
.player-ctrl.active { color: var(--primary-color); }

.player-ctrl-main {
  background: #fff;
  color: #000 !important;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.player-ctrl-main:hover { background: rgba(255,255,255,0.9); }

.player-ctrl-speed {
  font-size: 12px;
  font-weight: 700;
  min-width: 36px;
  font-family: var(--font-mono);
}

.player-ctrl-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-ctrl-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Repeat-one badge */
.player-mode-icon {
  position: relative;
  display: inline-flex;
}

.player-repeat-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  font-size: 9px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

/* ─── Volume (desktop only — created dynamically via JS) ─── */

.player-vol-wrap {
  position: relative;
}

.player-vol-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 8px;
  height: 100px;
  display: none;
  align-items: center;
}

.player-vol-popup.open {
  display: flex;
}

.player-vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  height: 80px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  writing-mode: vertical-lr;
  direction: rtl;
}

.player-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player-vol-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* ─── Light theme overrides ─── */

[data-theme="light"] .player-mini {
  background: rgba(250, 248, 244, 0.92);
  border-top-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .player-mini-title { color: var(--text-primary); }
[data-theme="light"] .player-mini-artist { color: var(--text-muted); }
[data-theme="light"] .player-mini-btn { color: var(--text-primary); }
[data-theme="light"] .player-mini-cover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .player-mini-bar { background: rgba(0,0,0,0.08); }
[data-theme="light"] .player-mini-fill { background: rgba(0,0,0,0.35); }

@media (min-width: 769px) {
  [data-theme="light"] .player-mini {
    border-left-color: rgba(0,0,0,0.08);
    border-right-color: rgba(0,0,0,0.08);
  }
}
