/*
 * Global Player Styles - New Design
 */

/*
  Current Track Display in Global Player
*/

/* NEW: Style the label as an icon */
.current-track-label {
  grid-area: icon;
  font-size: 0;
  /* Hide the "Now Playing" text */
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

.current-track-label::before {
  content: "\f001";
  /* Font Awesome music icon unicode */
  font-family: "Font Awesome 5 Free", "Font Awesome 5 Solid";
  font-weight: 900;
  /* Use the solid style */
  font-size: 12px;
  /* Icon size */
  color: var(--gray-600);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}



/* Main container */
#globalPlayer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--surface, #fff);
  border-top: 1px solid var(--border, #e0e0e0);
  z-index: 10000;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Smoother bezier */
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
  /* Softer, larger shadow */
  padding: 12px 32px;
  /* Standardize padding */
  backdrop-filter: blur(10px);
  /* Premium glass effect if supported */
}

#globalPlayer.active {
  transform: translateY(0);
}

body.global-player-active {
  padding-bottom: 90px;
}

.global-player-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* Changed from space-between */
  gap: 20px;
  /* Reduced from 32px */
  width: 100%;
}

/* Left Section: Cover & Info */
.global-player-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  /* Don't grow, fixed size */
  min-width: 0;
  max-width: 300px;
  /* Limit width */
}

#globalPlayerCover {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  /* Slightly tighter radius */
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--border, #e0e0e0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  /* Cover shadow */
}

.global-player-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  justify-content: center;
}

#globalPlayerTitle {
  margin: 0 0 2px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-text, #222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

a.global-player-title-link {
  color: var(--dark-text, #222);
  text-decoration: none;
}

a.global-player-title-link:hover {
  color: var(--primary);
}

#globalPlayerArtist {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--light-text, #666);
}

#globalPlayerArtist a {
  color: var(--light-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

#globalPlayerArtist a:hover {
  color: var(--dark-text);
}

.global-player-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

a.global-player-source {
  text-decoration: none;
  transition: all 0.2s ease;
}

a.global-player-source:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.global-player-source.soundcloud {
  background: rgba(255, 85, 0, 0.1);
  /* Subtle BG */
  color: #ff5500;
}

a.global-player-source.soundcloud {
  color: var(--soundcloud-color) !important;
}

span.global-player-source.mp3 {
  background: rgba(0, 123, 255, 0.1);
  color: var(--primary);
}

/* Center Section: Controls */
.global-player-controls-wrapper {
  flex: 1;
  /* Allow it to grow and show timeline */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 300px;
  /* Ensure minimum space for timeline */
  max-width: 600px;
}

/* Now Playing Track - Right Side Position (Desktop: 2-line stack) */
#globalCurrentTrack {
  flex: 0 1 auto;
  /* Don't grow, only take space needed */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 12px;
  border-left: 1px solid var(--border-light, #eee);
  margin-left: 12px;
  min-width: 200px;
  /* Minimum space for track info */
  max-width: 400px;
  /* Maximum to prevent excessive width */
  opacity: 0;
  transition: opacity 0.3s ease;
}

#globalCurrentTrack.visible {
  opacity: 1;
}

.current-track-info-stack {
  display: flex;
  flex-direction: column;
  /* Stack vertically on desktop */
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.current-track-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark-text, #222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.current-track-artist {
  font-weight: 400;
  font-size: 12px;
  color: var(--light-text, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.global-player-main-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

#globalPlayBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary, #007bff);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

#globalPlayBtn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

#globalPlayBtn:active {
  transform: scale(0.95);
}

#globalPlayBtn .fa-play {
  margin-left: 2px;
}

.global-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

#globalCurrentTime,
#globalTotalTime {
  font-size: 12px;
  color: var(--light-text, #888);
  font-variant-numeric: tabular-nums;
  /* Monospaced numbers */
  width: 35px;
  text-align: center;
}

#globalProgressBar {
  flex: 1;
  height: 4px;
  /* Slimmer bar */
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: visible;
  /* To allow hover handle */
  transition: height 0.2s ease;
}

#globalProgressBar:hover {
  height: 6px;
  /* Grow on hover */
}

#globalProgress {
  height: 100%;
  background: var(--primary, #007bff);
  width: 0%;
  border-radius: 2px;
  position: relative;
}

/* Add a handle on the progress bar */
#globalProgress::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 10px;
  height: 10px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

#globalProgressBar:hover #globalProgress::after {
  transform: translateY(-50%) scale(1);
}

/* Right Section: Actions */
.global-player-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* Removed Volume Styles */
#globalVolumeControl,
#globalVolumeSlider {
  display: none;
}

#globalCloseBtn {
  background: none;
  border: none;
  color: var(--light-text, #888);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px;
  border-radius: 4px;
  margin-left: auto;
  /* Push to far right */
  flex-shrink: 0;
}

#globalCloseBtn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--dark-text, #222);
}

#globalCloseBtn i {
  pointer-events: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
  body.global-player-active {
    padding-bottom: 130px;
    /* Adjusted for mobile player height */
  }

  #globalPlayer {
    padding: 12px 16px 24px 16px;
    /* Reduced bottom padding */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .global-player-content {
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    justify-content: center;
    /* Center content */
  }

  /* Row 1: Info & Cover */
  .global-player-info {
    order: 1;
    flex-basis: 100%;
    max-width: 100%;
    padding-right: 40px;
    /* Space for close button */
    margin-bottom: 4px;
    gap: 12px;
  }

  #globalPlayerCover {
    display: block;
    width: 44px;
    /* Slightly larger */
    height: 44px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .global-player-details {
    overflow: hidden;
    /* Ensure text truncates */
  }

  #globalPlayerTitle {
    font-size: 14px;
    margin: 0 0 2px 0;
  }

  #globalPlayerArtist {
    font-size: 12px;
    margin-bottom: 2px;
  }

  /* Order 2: Current Track - Single Row on Mobile */
  #globalCurrentTrack {
    order: 2;
    width: 100%;
    margin: 0 0 8px 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    border-left: none;
    flex: none;
  }

  .current-track-info-stack {
    flex-direction: row;
    /* Single row on mobile */
    align-items: center;
    gap: 6px;
    font-size: 12px;
  }

  .current-track-title {
    font-size: 12px;
    font-weight: 600;
  }

  .current-track-artist {
    font-size: 12px;
  }

  /* Add separator between title and artist on mobile */
  .current-track-artist::before {
    content: "•";
    margin-right: 6px;
    color: var(--light-text, #999);
  }

  .current-track-playing-now-label {
    margin-right: 6px;
  }

  .current-track-label {
    width: 12px;
    height: 12px;
    margin-right: 4px;
  }

  .current-track-label::before {
    font-size: 9px;
  }

  /* Order 3: Controls */
  .global-player-controls-wrapper {
    order: 3;
    width: 100%;
    max-width: none;
    flex: none;
  }

  .global-player-main-controls {
    gap: 12px;
  }

  #globalPlayBtn {
    width: 38px;
    height: 38px;
    font-size: 14px;
    margin-left: 0;
  }

  #globalCurrentTime,
  #globalTotalTime {
    font-size: 11px;
    min-width: 25px;
    text-align: center;
  }

  /* Actions (Close Button) */
  .global-player-actions {
    position: absolute;
    top: 0;
    /* Align with top of container */
    right: 0;
    max-width: none;
    height: 44px;
    /* Match cover height for alignment */
    align-items: center;
    justify-content: center;
    width: 40px;
  }

  #globalVolumeControl {
    display: none;
  }

  #globalCloseBtn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    /* Subtle background */
    border-radius: 50%;
    color: var(--light-text);
  }

  #globalCloseBtn:hover,
  #globalCloseBtn:active {
    background: rgba(0, 0, 0, 0.1);
    color: var(--dark-text);
  }

  /* Resume Message */
  .mobile-resume-message {
    bottom: calc(100% + 12px);
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}