﻿:root {
  --bg: #06060a;
  --fg: #ddd;
  --glass: rgba(10, 10, 16, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --muted: #9aa0a6;
}

* {
  box-sizing: border-box;
}

/* Floating bottom player */
#player.music-player {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 2fr 0.8fr;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  z-index: 10000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 1;
  visibility: visible;
}

/* Masquer le player avec une transition en douceur */
#player.music-player.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Left: cover + meta */
#player .left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#player .cover-img {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

#player .cover-img[src=""],
#player .cover-img:not([src]) {
  visibility: hidden;
}

#player .meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

#player .title {
  font-weight: 600;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  margin-bottom: -1px;
  text-align: left;
}

#player .subtitle {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -1px;
  text-align: left;
}

/* Center: controls + seek */
#player .center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#player .controls {
  display: flex;
  gap: 10px;
}

#player .controls button {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  background: none;
  color: #fff;
  box-shadow: none;
  font-size: 16px;
  transition: transform 0.1s ease;
}

#player .controls button:hover {
  transform: scale(1.05);
}

#player .seek {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#player #progress-bar {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#player #progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

#player #progress-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

#player #currentTime,
#player #duration {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* Right: expandable */
#player .right {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

/* Responsive tweaks */
@media (max-width: 900px) {
  #player.music-player {
    grid-template-columns: 1fr 1.5fr 0.8fr;
  }
}

@media (max-width: 720px) {
  #player.music-player {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #player .right {
    justify-content: space-between;
  }

  #player .center {
    order: 3;
  }
}

.hidden {
  display: none !important;
}

/* Animations pour le bouton scroll-to-top */
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(20px);
    opacity: 0;
  }
}

/* Scroll to top button in player */
.scroll-top-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #f7f7f7, #ffffff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 2rem;
  animation: slideUp 0.4s ease forwards;
}

.scroll-top-btn.hidden {
  display: flex !important;
  animation: slideDown 0.4s ease forwards;
  pointer-events: none;
}

.scroll-top-btn:hover {
  transform: scale(1.05);
}

.scroll-top-btn:active {
  transform: scale(0.98);
}

/* 🎵 Player Library Buttons */
.player-library-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.player-lib-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 0;
  background: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.player-lib-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-right: 8px;
}

.player-lib-btn span {
  display: none;
}

.player-lib-btn:hover {
  opacity: 0.8;
}

.player-lib-btn:active {
  opacity: 0.6;
}

/* 📋 Library Modal */
.library-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20000;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    background: rgba(0, 0, 0, 0);
    transform: translateY(20px);
  }
  to {
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(0);
  }
}

.library-modal-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: #999;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #fff;
}

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

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Playlists List */
.playlists-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.playlist-icon {
  font-size: 24px;
  flex-shrink: 0;
}

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

.playlist-name {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-meta {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

/* Form Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.1);
}

.form-input::placeholder {
  color: #666;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4fc3f7;
}

.checkbox-label span {
  font-size: 14px;
  color: #fff;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #4fc3f7 0%, #2196f3 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 195, 247, 0.4);
}

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

.btn-cancel {
  background: transparent;
  color: #999;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

/* Empty State */
.empty-message {
  text-align: center;
  color: #666;
  font-size: 14px;
  padding: 20px;
}

/* Responsive */
@media (max-width: 600px) {
  .library-modal-content {
    max-width: 100%;
  }
  
  .player-library-buttons {
    flex-wrap: wrap;
  }
}
