/* ============================================
   Global Player — Fixed Bottom Bar
   TrueVideo Music Showcase
   ============================================ */

/* --- Player Container --- */
.global-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-top: 1px solid var(--border-subtle);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.global-player.active {
  transform: translateY(0);
}

/* Body offset when player visible */
body.player-visible {
  padding-bottom: 72px;
}

/* --- Progress Bar (top edge of player) --- */
/* Wrapper with bigger invisible hit-zone for easier grabbing */
.player-progress {
  position: absolute;
  top: -14px;                 /* extend hit-area upward */
  left: 0;
  right: 0;
  height: 18px;               /* 18px hit-zone — easy to tap on touch */
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: flex-end;      /* visible bar sits at bottom */
  touch-action: none;         /* prevent page scroll while dragging */
  -webkit-user-select: none;
  user-select: none;
  z-index: 2;
}

/* visible thin line at the bottom of the hit-zone */
.player-progress::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  transition: height 0.15s ease, bottom 0.15s ease;
}

.player-progress:hover::before,
.player-progress.dragging::before {
  height: 7px;
}

.player-progress-fill {
  height: 5px;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
  transition: width 0.1s linear, height 0.15s ease;
  position: relative;
  z-index: 1;
}

.player-progress:hover .player-progress-fill,
.player-progress.dragging .player-progress-fill {
  height: 7px;
}

.player-progress-fill::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 12px var(--glow-lime);
  transition: transform 0.15s ease;
}

.player-progress:hover .player-progress-fill::after,
.player-progress.dragging .player-progress-fill::after {
  transform: translateY(-50%) scale(1);
}

/* On mobile — bigger hit-zone, thicker bar, always-visible thumb */
@media (max-width: 768px) {
  .player-progress {
    top: -20px;
    height: 24px;
  }
  .player-progress::before {
    height: 6px;
  }
  .player-progress-fill {
    height: 6px;
  }
  .player-progress-fill::after {
    transform: translateY(-50%) scale(1); /* always show thumb on touch */
    width: 16px;
    height: 16px;
    right: -8px;
  }
}

/* --- Player Inner Layout --- */
.player-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  max-width: 1400px;
  margin: 0 auto;
  height: 56px;
}

/* --- Cover Art --- */
.player-cover {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.player-cover.playing {
  box-shadow: 0 0 16px var(--glow-lime), 0 0 4px var(--glow-yellow);
  animation: coverPulse 2s ease-in-out infinite;
}

@keyframes coverPulse {
  0%, 100% { box-shadow: 0 0 12px var(--glow-lime), 0 0 4px var(--glow-yellow); }
  50% { box-shadow: 0 0 20px var(--glow-lime), 0 0 8px var(--glow-yellow); }
}

/* --- Track Info --- */
.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.player-author {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* --- Controls --- */
.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.player-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-primary);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.player-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px var(--glow-lime);
}

.player-btn:active {
  transform: scale(0.95);
}

/* --- Social Actions (Like / Comment) --- */
.player-social {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.player-like-btn,
.player-comment-btn,
.player-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.player-like-btn:hover,
.player-comment-btn:hover,
.player-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: scale(1.08);
}

.player-like-btn:active,
.player-comment-btn:active,
.player-close:active {
  transform: scale(0.94);
}

.player-like-btn.liked {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
}

.player-like-btn.liked:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
}

.player-close {
  margin-left: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
}

.player-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

/* --- Time Display --- */
.player-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  text-align: center;
}

/* --- Volume --- */
.player-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.player-volume svg {
  flex-shrink: 0;
}

.volume-bar {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s ease;
}

.volume-bar:hover {
  height: 6px;
}

.volume-fill {
  height: 100%;
  background: var(--accent-lime);
  border-radius: 2px;
  position: relative;
  transition: width 0.05s linear;
}

.volume-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-lime);
  transition: transform 0.15s ease;
}

.volume-bar:hover .volume-fill::after {
  transform: translateY(-50%) scale(1);
}

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 768px) {
  .player-inner {
    padding: 8px 14px;
    gap: 10px;
    height: 52px;
  }

  .player-cover {
    width: 36px;
    height: 36px;
  }

  .player-volume {
    display: none;
  }

  .player-time {
    min-width: 64px;
    font-size: 0.7rem;
  }

  body.player-visible {
    padding-bottom: 64px;
  }
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 480px) {
  .player-inner {
    padding: 6px 10px;
    gap: 8px;
    height: 48px;
  }

  .player-cover {
    width: 32px;
    height: 32px;
    border-radius: 4px;
  }

  .player-title {
    font-size: 0.78rem;
  }

  .player-author {
    font-size: 0.68rem;
  }

  .player-btn {
    width: 34px;
    height: 34px;
  }

  .player-btn svg {
    width: 16px;
    height: 16px;
  }

  .player-time {
    display: none;
  }

  body.player-visible {
    padding-bottom: 56px;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .global-player {
    transition: none;
  }

  .player-cover.playing {
    animation: none;
  }

  .player-progress-fill::after,
  .volume-fill::after {
    transition: none;
  }
}
