/* 🎵 Music Player - Modern Styles */

.music-container {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 20px;
  width: 100%;
  max-width: 800px;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 8px 32px var(--shadow-elevated);
  border: 1px solid var(--border-color);
  margin: 20px auto;
  min-height: 90vh;
}

/* ===== Now Playing Section ===== */
.now-playing {
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(119, 74, 255, 0.1) 100%);
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.album-art-wrapper {
  position: relative;
  flex-shrink: 0;
}

.album-art {
  width: 140px;
  height: 140px;
  min-width: 140px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.album-art.playing {
  animation: pulse-art 2s ease-in-out infinite;
}

@keyframes pulse-art {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.album-art-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

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

.track-title {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.track-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent-blue);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ===== Progress Section ===== */
.progress-section {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 5px;
}

.time-current,
.time-total {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 45px;
  text-align: center;
}

.time-current { text-align: right; }

.progress-bar-wrapper {
  flex: 1;
  cursor: pointer;
  padding: 8px 0;
}

.progress-bar {
  position: relative;
  height: 6px;
  background: rgba(119, 74, 255, 0.2);
  border-radius: 3px;
  overflow: visible;
  transition: height 0.2s ease;
}

.progress-bar-wrapper:hover .progress-bar {
  height: 8px;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  background: white;
  border: 3px solid #667eea;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  transition: transform 0.2s ease;
}

.progress-bar-wrapper:hover .progress-handle {
  transform: translateY(-50%) scale(1);
}

/* ===== Controls ===== */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 15px 10px;
}

.control-btn {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.control-btn:hover {
  background: var(--border-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
}

.btn-icon {
  font-size: 20px;
  line-height: 1;
}

.play-btn {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}

.play-btn:hover {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a41d6 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6);
}

.play-btn .btn-icon {
  font-size: 26px;
}

.rewind-btn,
.forward-btn {
  width: 44px;
  height: 44px;
}

/* ===== Volume Section ===== */
.volume-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
}

.volume-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 22px;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
  color: var(--text-primary);
}

.volume-btn:hover {
  background: var(--border-color);
}

.volume-slider-wrapper {
  width: 120px;
}

.volume-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(119, 74, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  transition: transform 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* ===== Upload Section ===== */
.upload-section {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 14px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.upload-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(102, 126, 234, 0.6);
  background: linear-gradient(135deg, #5a6fd6 0%, #6a41d6 100%);
}

.upload-icon {
  font-size: 20px;
}

/* ===== Search Tracks ===== */
.search-tracks-section {
  padding: 0 5px;
}

.search-tracks-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card-hover);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
  outline: none;
}

.search-tracks-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.search-tracks-input::placeholder {
  color: var(--text-secondary);
}

/* ===== Playlist Section ===== */
.playlist-section {
  background: var(--bg-card-hover);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(119, 74, 255, 0.08);
  border-bottom: 1px solid var(--border-color);
}

.playlist-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.playlist-count {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 10px;
}

.playlist {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 6px;
}

.playlist-item:hover {
  background: rgba(119, 74, 255, 0.1);
  transform: translateX(4px);
}

.playlist-item.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.15) 100%);
  border-left: 4px solid var(--accent-purple);
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
}

.playlist-item-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.playlist-item.playing .playlist-item-icon {
  animation: equalizer 1s ease-in-out infinite;
}

@keyframes equalizer {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.1); }
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-artist {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-duration {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.playlist-item-delete {
  opacity: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.playlist-item:hover .playlist-item-delete {
  opacity: 1;
}

.playlist-item-delete:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

/* Empty Playlist */
.playlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.playlist-empty p {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.upload-link {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.upload-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Scrollbar */
.playlist::-webkit-scrollbar {
  width: 8px;
}

.playlist::-webkit-scrollbar-track {
  background: transparent;
}

.playlist::-webkit-scrollbar-thumb {
  background: rgba(119, 74, 255, 0.3);
  border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb:hover {
  background: rgba(119, 74, 255, 0.5);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .music-container {
    grid-template-rows: auto auto auto auto auto 1fr;
    max-width: 100%;
    margin: 10px;
    padding: 15px;
    min-height: auto;
  }

  .now-playing {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .album-art {
    width: 120px;
    height: 120px;
    min-width: 120px;
    font-size: 48px;
  }

  .album-art-glow {
    width: 140px;
    height: 140px;
  }

  .track-title {
    font-size: 18px;
  }

  .track-artist {
    font-size: 14px;
  }

  .track-meta {
    justify-content: center;
  }

  .controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .control-btn {
    width: 44px;
    height: 44px;
    padding: 10px;
  }

  .play-btn {
    width: 58px;
    height: 58px;
    order: -1;
    flex-basis: 100%;
  }

  .volume-section {
    flex-wrap: wrap;
  }

  .volume-slider-wrapper {
    width: 100px;
  }

  .upload-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  .playlist-item-delete {
    opacity: 1;
  }
}

/* ===== Loading Animation ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ===== Notification ===== */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.notification.success {
  border-left: 4px solid #2ecc71;
}

.notification.error {
  border-left: 4px solid #e74c3c;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
