:root {
  --bg-dark: #0c0c10;
  --bg-card: #18181f;
  --bg-elevated: #22222c;
  --violet-dark: #251a35;
  --violet-mid: #3d2a5c;
  --violet-accent: #5c3d8a;
  --violet-bright: #8b5cf6;
  --violet-glow: #a78bfa;
  --text-primary: #f8f6fb;
  --text-secondary: #c4b5fd;
  --text-muted: #9b8ab8;
  --border: rgba(167, 139, 250, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-dark);
  min-height: 100vh;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background: linear-gradient(180deg, var(--violet-dark) 0%, transparent 100%);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.header .logout-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.header .logout-link:hover {
  color: var(--violet-glow);
}

.main {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.player-box {
  position: relative;
  background: linear-gradient(145deg, var(--bg-elevated) 0%, var(--violet-dark) 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.player-box .now-playing {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.player-box .track-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Barre d'écoute personnalisée (bouton + temps visibles) */
.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.player-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--violet-bright);
  color: var(--bg-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter 0.2s, transform 0.15s;
}

.player-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}

.player-btn .icon-pause[hidden],
.player-btn.playing .icon-play { display: none !important; }
.player-btn.playing .icon-pause { display: block !important; }
.player-btn .icon-pause { display: none; }

.player-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 2.8rem;
}

.player-seek {
  flex: 1;
  min-width: 0;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--violet-mid);
  border-radius: 3px;
}

.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--violet-glow);
  cursor: pointer;
  border: 2px solid var(--text-primary);
}

.player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--violet-glow);
  cursor: pointer;
  border: 2px solid var(--text-primary);
}

.player-box audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.playlist-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.playlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist li {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.playlist li:hover {
  background: var(--bg-elevated);
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 4px 20px rgba(75, 0, 130, 0.2);
}

.playlist li.active {
  background: linear-gradient(90deg, var(--violet-accent) 0%, var(--violet-mid) 100%);
  border-color: var(--violet-glow);
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.35);
}

.playlist li .track-num {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(167, 139, 250, 0.25);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playlist li.active .track-num {
  background: var(--violet-glow);
  color: #0c0c10;
}

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

.playlist li .title {
  font-weight: 500;
  color: var(--text-primary);
  display: block;
}

.playlist li .artist {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--bg-dark) 0%, var(--violet-dark) 50%, var(--bg-dark) 100%);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-error {
  font-size: 0.9rem;
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  outline: none;
  border-color: var(--violet-glow);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
}

.login-btn {
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg-dark);
  background: linear-gradient(135deg, var(--violet-bright) 0%, var(--violet-accent) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

@media (max-width: 640px) {
  .header, .main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .playlist li {
    padding: 0.75rem 1rem;
  }
}
