/* ==========================================================================
   MobilePlayer.css - Isolated Styles for Beatport Drop Charts Mobile Player
   ========================================================================== */

/* 1. ARCHITECTURAL ISOLATION */

/* Desktop view: Mobile player is completely hidden */
@media (min-width: 769px) {
  #mobile-player-container {
    display: none !important;
  }
}

/* Mobile view: Move desktop docks offscreen (preserving Spotify/YouTube iframes and audio lifecycle) */
@media (max-width: 768px) {
  #bp-audio-dock,
  #spotify-audio-dock,
  #youtube-audio-dock {
    position: fixed !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    visibility: visible !important;
  }

  #mobile-player-container {
    display: block;
  }
  
  body.has-mobile-player {
    padding-bottom: 254px !important;
  }
}

/* 2. MOBILE PLAYER CONTAINER & CARD LAYOUT */

#mobile-player-container {
  position: fixed;
  bottom: 12px;
  left: 50%;
  right: auto;
  width: calc(100% - 24px);
  max-width: 380px;
  height: 232px;
  border-radius: 22px;
  overflow: hidden;
  z-index: 9999;
  background: #090c15;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 24px rgba(0, 0, 0, 0.65);
  transform: translateX(-50%) translateY(140%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
  opacity: 0;
  pointer-events: none;
  touch-action: none; /* Controlled gesture handling in JS */
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

#mobile-player-container.is-active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Ambient Canvas Background */
#mobile-ambient-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
}

/* Card Content Overlay */
.mobile-card-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* TOP BAR: Track Meta on Left, Close & Favorite Actions on Right */
.mobile-top-bar {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  box-sizing: border-box;
}

.mobile-top-meta {
  flex: 1;
  min-width: 0;
  margin-right: 8px;
  text-align: left;
  overflow: hidden;
  pointer-events: none;
}

.mobile-track-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.mobile-track-artist {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}

.mobile-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 6;
}

.mobile-icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s ease, transform 0.15s ease, color 0.18s ease;
  touch-action: manipulation;
}

.mobile-icon-btn:active {
  transform: scale(0.90);
  background: rgba(255, 255, 255, 0.22);
}

.mobile-fav-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.mobile-fav-btn.is-fav {
  background: rgba(225, 29, 72, 0.25);
  border-color: rgba(225, 29, 72, 0.5);
  color: #f43f5e;
}

.mobile-fav-btn.is-fav svg {
  fill: #f43f5e;
  stroke: #f43f5e;
}

.mobile-close-btn {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}

/* 3. MAIN TAP ZONE: Covers top & middle area for Gestures (0 to 160px) */
/* Single tap on this area triggers Play / Pause */
/* Double tap triggers Add to Drop */
/* Swipe Up / Down triggers Next / Prev */
.mobile-main-tap-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 160px;
  cursor: pointer;
  touch-action: none;
  z-index: 3;
}

/* CENTER: Cover Wrapper (Dock height = 232px, cover top: 48px, 108×108px) */
.mobile-cover-wrap {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 108px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 14px rgba(0, 0, 0, 0.4);
  background: #121622;
  border: 1px solid rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.mobile-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
  display: block;
  pointer-events: none;
}

/* Play/Pause state badge overlay on cover */
.mobile-play-state-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.mobile-play-state-badge svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Double-Tap Pop Feedback */
.mobile-drop-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: rgba(225, 29, 72, 0.95);
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 4px 24px rgba(225, 29, 72, 0.75);
  opacity: 0;
}

.mobile-drop-feedback svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.mobile-drop-feedback.is-popping {
  animation: mobileDropPop 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes mobileDropPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.25);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -85%) scale(0.8);
  }
}

/* 4. PROGRESS BAR (LOCATED STRICTLY IN LOWER ZONE AT 162px, 32PX TOUCH TARGET) */
.mobile-progress-wrapper {
  position: absolute;
  top: 162px;
  left: 14px;
  right: 14px;
  height: 32px;
  padding: 4px 2px;
  cursor: pointer;
  touch-action: none; /* Strict touch isolation for seeking */
  z-index: 6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.mobile-progress-bar {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  overflow: visible;
}

.mobile-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #00d084 0%, #06b6d4 100%);
  pointer-events: none;
}

.mobile-progress-thumb {
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.8), 0 0 3px rgba(6, 182, 212, 0.6);
  pointer-events: none;
}

.mobile-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* 5. BOTTOM SOURCE INDICATORS: Beatport / YouTube / Spotify */
.mobile-source-dots {
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 6;
}

.mobile-src-btn {
  padding: 2px 14px;
  height: 22px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.mobile-src-btn:active {
  transform: scale(0.92);
}

.mobile-src-btn.is-active#mobileSrcBp {
  background: #00d084;
  color: #000;
  border-color: #00d084;
  box-shadow: 0 0 8px rgba(0, 208, 132, 0.5);
}

.mobile-src-btn.is-active#mobileSrcYt {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.mobile-src-btn.is-active#mobileSrcSp {
  background: #1ed760;
  color: #000;
  border-color: #1ed760;
  box-shadow: 0 0 8px rgba(30, 215, 96, 0.5);
}

.mobile-src-btn.is-disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* Directional Swipe Toast Indicator */
.mobile-swipe-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  z-index: 25;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.mobile-swipe-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
