/* 🎵 Music Player - Clean Design */

/* ===== Wrapper ===== */
.music-player-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  z-index: 100;
}

/* ===== Main Player Card ===== */
.music-player {
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  position: relative;
  z-index: 10;
}

/* ===== Section 1: Album Art ===== */
.album-art-section {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 15px 0 20px 0;
  position: relative;
}

.album-art-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-art-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
}

.album-art {
  width: 450px;
  height: 450px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 100px;
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
  border: 3px solid rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  backface-visibility: visible;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: auto;
}

/* Текст внутри обложки */
.album-art .lyrics-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-art-icon {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.album-art.tilt-active {
  transition: transform 0.05s ease-out;
}

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

.album-art.playing.tilt-active {
  animation: none;
}

@keyframes pulse-art {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 18px 50px rgba(102, 126, 234, 0.7);
  }
}

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

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

/* ===== Lyrics Overlay (внутри обложки) ===== */
.lyrics-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 10;
}

.lyrics-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Затемнение фона */
.lyrics-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 1;
  pointer-events: none;
}

.lyrics-content {
  position: relative;
  z-index: 2;
  width: 85%;
  max-height: 240px;
  overflow-y: auto;
  padding: 20px;
  color: white;
  text-align: center;
  scroll-behavior: smooth;
  font-size: 14px;
  line-height: 1.6;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: auto;
  cursor: pointer;
}

/* Скрываем скролл-ленту */
.lyrics-content::-webkit-scrollbar {
  display: none;
}

.lyrics-content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.lyrics-text {
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-line;
  font-weight: 400;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lyrics-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.6);
  padding: 30px 0;
  font-size: 14px;
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.5;
}

.placeholder-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 12px;
  margin-top: 8px;
  display: inline-block;
}

/* ===== Section 2: Track Info ===== */
.track-info-section {
  width: 100%;
  text-align: center;
  padding: 15px 0;
  border-top: none;
  border-bottom: none;
  margin-bottom: 10px;
}

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

.track-artist {
  margin: 0;
  font-size: 18px;
  color: var(--text-secondary);
  opacity: 0.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

/* ===== Section 3: Progress Bar ===== */
.progress-section {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 10px;
}

.time-current,
.time-total {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

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

.progress-bar-wrapper {
  flex: 1;
  cursor: pointer;
  padding: 6px 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;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.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);
}

/* ===== Section 4: Controls ===== */
.controls-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
}

.controls-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.control-btn {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 10px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 44px;
  height: 44px;
  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: 18px;
  line-height: 1;
}

.play-btn {
  width: 58px;
  height: 58px;
  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: 24px;
}

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

/* Volume Row */
.volume-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
}

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

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

.volume-slider {
  flex: 1;
  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: 14px;
  height: 14px;
  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: 14px;
  height: 14px;
  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);
}

/* ===== Test Badge ===== */
.test-badge {
  position: fixed;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #f39c12, #e74c3c);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
  animation: pulse-badge 2s ease-in-out infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .music-player {
    max-width: 100%;
    padding: 15px 10px;
    border-radius: 0;
  }

  .album-art {
    width: 280px;
    height: 280px;
    font-size: 72px;
  }

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

  .track-title {
    font-size: 20px;
    opacity: 0.7;
  }

  .track-artist {
    font-size: 15px;
    opacity: 0.5;
  }

  .controls-row {
    gap: 6px;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
  }

  .play-btn {
    width: 52px;
    height: 52px;
  }

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

  .volume-row {
    max-width: 150px;
  }
}

/* ===== Playlist Controls Row ===== */
.playlist-controls-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(119, 74, 255, 0.15);
}

.playlist-btn {
  width: 44px;
  height: 44px;
  position: relative;
}

.playlist-btn input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ===== Empty Playlist Screen ===== */
.empty-playlist {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 50;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 40px 20px;
  text-align: center;
}

.empty-playlist.visible {
  display: flex;
}

.empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.6;
  animation: float-icon 3s ease-in-out infinite;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.empty-playlist h2 {
  margin: 0 0 10px 0;
  font-size: 24px;
  color: var(--text-primary);
}

.empty-playlist p {
  margin: 0 0 25px 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.upload-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  display: inline-block;
}

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

/* ===== Playlist Sidebar ===== */
.playlist-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.playlist-sidebar.open {
  right: 0;
}

.playlist-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.playlist-sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.playlist-header h3 {
  margin: 0;
  font-size: 20px;
  color: var(--text-primary);
}

.playlist-actions {
  display: flex;
  gap: 8px;
}

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

.playlist-action-btn:hover,
.playlist-close-btn:hover {
  background: var(--border-color);
}

.playlist-drop-zone {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background: rgba(102, 126, 234, 0.1);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.playlist-drop-zone.visible {
  display: flex;
}

.drop-icon {
  font-size: 48px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.playlist-drop-zone p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

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

.playlist-content::-webkit-scrollbar {
  width: 6px;
}

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

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

/* ===== Playlist Item ===== */
.playlist-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.playlist-item:hover {
  background: var(--bg-card-hover);
}

.playlist-item.active {
  background: rgba(102, 126, 234, 0.15);
  border-left-color: #667eea;
}

.playlist-item.dragging {
  opacity: 0.5;
}

.playlist-item.drag-over {
  border-top: 2px solid #667eea;
}

.playlist-item-icon {
  font-size: 20px;
  min-width: 24px;
  text-align: center;
}

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

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

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

.playlist-item-duration {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.playlist-item-actions {
  display: none;
  gap: 4px;
}

.playlist-item:hover .playlist-item-actions {
  display: flex;
}

.playlist-item-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.playlist-item-action-btn:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

/* ===== Context Menu ===== */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  padding: 8px 0;
  z-index: 10000;
  display: none;
  min-width: 180px;
}

.context-menu.visible {
  display: block;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-menu-item:hover {
  background: var(--bg-card-hover);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}

.track-info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(119, 74, 255, 0.15);
}

.track-info-row:last-child {
  border-bottom: none;
}

.track-info-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.track-info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

/* ===== Loading Indicator ===== */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  display: none;
}

.loading-indicator.visible {
  display: block;
}

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

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

/* ===== Minimal UI Mode ===== */
.music-player-wrapper.minimal-ui .controls-section,
.music-player-wrapper.minimal-ui .progress-section,
.music-player-wrapper.minimal-ui .track-info-section {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.music-player-wrapper.minimal-ui:hover .controls-section,
.music-player-wrapper.minimal-ui:hover .progress-section,
.music-player-wrapper.minimal-ui:hover .track-info-section {
  opacity: 1;
}

/* ===== Responsive for Playlist ===== */
@media (max-width: 768px) {
  .playlist-sidebar {
    width: 100%;
    right: -100%;
  }

  .playlist-controls-row {
    flex-wrap: wrap;
  }

  .playlist-btn {
    width: 40px;
    height: 40px;
  }
}
