:root,
[data-theme="marron-dark"] {
  --bg-dark: #161210;
  --bg-sidebar: #0e0b09;
  --bg-panel: #1f1916;
  --bg-card: #2b221e;
  --bg-hover: #382c26;
  --accent: #a85a2a;
  --accent-hover: #c46d38;
  --accent-text: #ffffff;
  --accent-soft: #332016;
  --hero-grad: #332016;
  --special: #c084fc;
  --danger: #e53935;
  --text-main: #f8f2ec;
  --text-muted: #bfa99a;
  --border: #3d3029;
}

[data-theme="marron-light"] {
  --bg-dark: #faf5ef;
  --bg-sidebar: #f1e6d8;
  --bg-panel: #ffffff;
  --bg-card: #f4ebe1;
  --bg-hover: #e8d9c8;
  --accent: #7c3f1d;
  --accent-hover: #964f27;
  --accent-text: #ffffff;
  --accent-soft: #ebd9c6;
  --hero-grad: #ebd9c6;
  --special: #7e22ce;
  --danger: #d32f2f;
  --text-main: #2b1d14;
  --text-muted: #6e5544;
  --border: #dccab6;
}

[data-theme="vert-pastel"] {
  --bg-dark: #eff8f6;
  --bg-sidebar: #dff1ed;
  --bg-panel: #ffffff;
  --bg-card: #e6f4f1;
  --bg-hover: #d2ebe5;
  --accent: #008980;
  --accent-hover: #00a398;
  --accent-text: #ffffff;
  --accent-soft: #ccebe5;
  --hero-grad: #ccebe5;
  --special: #6d28d9;
  --danger: #d32f2f;
  --text-main: #123330;
  --text-muted: #4b736f;
  --border: #bddcd6;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body { background: var(--bg-dark); color: var(--text-main); height: 100vh; overflow: hidden; }
.hidden { display: none !important; }
.muted-text { color: var(--text-muted); font-size: 0.85rem; }

.offline-banner {
  background: #4a3b12; color: #ffd54f; padding: 6px 10px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600; text-align: center;
}

/* Auth & Modales */
.auth-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.auth-card {
  background: var(--bg-panel); padding: 26px; border-radius: 12px; width: 360px; max-width: 92vw;
  display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border);
}
.auth-card input, .request-form input, .queue-search-wrap input {
  padding: 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-main); width: 100%;
}
.error-msg { color: #ff5555; font-size: 0.85rem; min-height: 18px; }

/* Boutons */
button, .btn-link-ext { cursor: pointer; border: none; border-radius: 6px; transition: 0.15s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--accent); color: var(--accent-text); font-weight: bold; padding: 10px 14px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-special { background: #3b1f54; color: #e9d5ff; padding: 8px 12px; border: 1px solid #6b21a8; font-weight: 600; font-size: 0.85rem; }
.btn-special:hover { background: #581c87; }
.btn-secondary { background: var(--bg-card); color: var(--text-main); padding: 8px 12px; border: 1px solid var(--border); font-size: 0.85rem; }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: #3b1c1c; color: #ff7b7b; padding: 8px 12px; border: 1px solid #5c2828; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-link { background: transparent; color: var(--text-muted); font-size: 0.85rem; }
.icon-btn { background: var(--bg-card); color: var(--text-main); width: 34px; height: 34px; border-radius: 50%; font-size: 0.95rem; }

/* Layout */
.app-layout { display: flex; height: calc(100vh - 86px); position: relative; }

/* Sidebar */
.sidebar {
  width: 245px; background: var(--bg-sidebar); padding: 18px; display: flex; flex-direction: column;
  gap: 12px; border-right: 1px solid var(--border); flex-shrink: 0;
}
.logo { font-size: 1.4rem; font-weight: bold; color: var(--accent); }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-btn {
  text-align: left; justify-content: flex-start; padding: 10px; background: transparent; color: var(--text-muted); font-weight: 600;
}
.nav-btn.active, .nav-btn:hover { background: var(--bg-card); color: var(--text-main); }
.playlists-header { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; margin-top: 6px; }
.playlists-header button { background: transparent; color: var(--text-main); font-size: 1.2rem; }
.playlists-list { list-style: none; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.playlists-list li {
  padding: 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between;
  font-size: 0.9rem; color: var(--text-muted);
}
.playlists-list li:hover, .playlists-list li.active { background: var(--bg-card); color: var(--text-main); }
.sidebar-footer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.user-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; color: var(--text-muted); }

/* Main & Topbar */
.main-content { flex: 1; overflow-y: auto; padding: 20px 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { display: none; position: relative; }
.search-box.active { display: block; }
#search-input {
  width: 260px; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-main); outline: none;
}
#search-results {
  display: none; position: absolute; top: 100%; left: 0; width: 100%; margin-top: 6px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px;
  list-style: none; z-index: 20; max-height: 240px; overflow-y: auto;
}
#search-results li {
  padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem;
}
#search-results li:hover { background: var(--bg-hover); }

/* Hero morceau en cours */
.hero {
  display: flex; align-items: center; gap: 20px; background: linear-gradient(135deg, var(--hero-grad), var(--bg-panel));
  padding: 20px; border-radius: 12px; border: 1px solid var(--border);
}
.hero img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; background: var(--bg-card); }
.hero-info { flex: 1; }
.hero-main { display: flex; align-items: center; gap: 15px; }
.hero-main p { color: var(--text-muted); margin-top: 4px; }
.hero-extra { display: none; gap: 20px; margin-top: 12px; font-size: 0.9rem; color: var(--text-muted); }
.hero-extra.active { display: flex; }

/* Liste des pistes & partage */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.share-chip {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 3px 10px; font-size: 0.8rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px;
}
.share-chip button { background: transparent; color: #ff7b7b; font-size: 0.8rem; }
#track-count { color: var(--text-muted); font-size: 0.85rem; }
.tracks-list { display: flex; flex-direction: column; gap: 4px; }
.track-row {
  display: grid; grid-template-columns: 44px 1fr 1fr 60px 160px; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 6px; cursor: pointer;
}
.track-row:hover { background: var(--bg-hover); }
.track-row.playing { background: var(--accent-soft); color: var(--accent); }
.track-row img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--bg-card); }
.track-sub { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-actions { display: flex; gap: 5px; justify-content: flex-end; }
.track-actions button { background: transparent; color: var(--text-muted); font-size: 0.95rem; padding: 2px 4px; }
.track-actions button:hover { color: var(--text-main); }

/* Tiroirs latéraux (File d'attente / Historique / Paroles) */
.side-drawer {
  width: 350px; max-width: 92vw; background: var(--bg-panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 30;
}
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border); gap: 8px;
}
.drawer-tabs { display: flex; gap: 6px; flex: 1; }
.drawer-tab {
  background: transparent; color: var(--text-muted); padding: 6px 10px;
  font-size: 0.84rem; font-weight: 600; border-radius: 6px;
}
.drawer-tab.active, .drawer-tab:hover { background: var(--bg-card); color: var(--text-main); }
.drawer-tab.active { color: var(--accent); }
.drawer-tab-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.queue-search-wrap { padding: 12px 16px 0; position: relative; }
.queue-search-results {
  margin-top: 6px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; max-height: 210px; overflow-y: auto;
}
.queue-search-item {
  padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem;
}
.queue-search-item:last-child { border-bottom: none; }
.queue-search-btns { display: flex; gap: 4px; flex-shrink: 0; }
.queue-search-btns button { background: var(--bg-hover); color: var(--text-main); padding: 4px 7px; font-size: 0.75rem; border-radius: 4px; }
.queue-search-btns button:hover { background: var(--accent); color: #000; }
.queue-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.04em; display: flex; justify-content: space-between; align-items: center; }
.queue-list { display: flex; flex-direction: column; gap: 6px; }
.queue-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px;
  background: var(--bg-card); cursor: pointer;
}
.queue-item.current { border: 1px solid var(--accent); background: var(--accent-soft); }
.queue-item img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-title { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-artist { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-actions { display: flex; gap: 3px; flex-shrink: 0; }
.queue-item-actions button { background: transparent; color: var(--text-muted); font-size: 0.85rem; padding: 3px; }
.queue-item-actions button:hover { color: var(--text-main); }

/* Paroles synchronisées */
.lyrics-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 40px; }
.lyric-line {
  font-size: 0.95rem; line-height: 1.5; color: var(--text-muted); cursor: pointer;
  padding: 4px 6px; border-radius: 6px; transition: 0.2s;
}
.lyric-line:hover { color: var(--text-main); background: var(--bg-card); }
.lyric-line.active { color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.lyrics-plain { white-space: pre-wrap; line-height: 1.7; font-size: 0.92rem; color: var(--text-main); }

/* Mode Blindtest Plein Écran */
.blindtest-overlay {
  position: fixed; inset: 0; background: radial-gradient(circle at top, #1f1630 0%, #0d0d0d 70%);
  z-index: 200; display: flex; flex-direction: column; padding: 24px 32px;
}
.blindtest-topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.blindtest-brand { font-size: 1.3rem; font-weight: 800; color: var(--special); }
.blindtest-top-actions { display: flex; align-items: center; gap: 10px; }
.blindtest-select {
  background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 6px; font-size: 0.85rem;
}
.blindtest-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; text-align: center;
}
.bt-mystery-box, .bt-revealed-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 600px;
}
.bt-mystery-cover {
  width: 260px; height: 260px; border-radius: 20px; background: linear-gradient(135deg, #2b1d42, #181818);
  border: 2px dashed #6b21a8; display: flex; align-items: center; justify-content: center;
  font-size: 5rem; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.bt-revealed-box img {
  width: 300px; height: 300px; max-width: 75vw; max-height: 75vw; object-fit: cover;
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75); border: 2px solid var(--accent);
}
.bt-revealed-box h1 { font-size: 2rem; line-height: 1.2; }
.bt-revealed-box p { font-size: 1.25rem; color: var(--accent); font-weight: 600; }
.bt-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.bt-big-btn { padding: 12px 24px; font-size: 1rem; border-radius: 24px; }

/* Minuteur */
.timer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timer-custom-row { display: flex; gap: 8px; }

/* Propositions & Gestion utilisateurs */
.request-form {
  background: var(--bg-panel); padding: 18px; border-radius: 10px; border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.requests-list, .users-list { display: flex; flex-direction: column; gap: 10px; }
.req-card, .user-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.user-card { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.req-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-meta { font-size: 0.85rem; color: var(--text-muted); }
.req-actions, .user-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { padding: 3px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-pending { background: #4a3b12; color: #ffd54f; }
.badge-queued { background: #1a334d; color: #64b5f6; }
.badge-downloading { background: #2d1f47; color: #ce93d8; }
.badge-completed { background: #1b3d24; color: #69f0ae; }
.badge-rejected { background: #3b1c1c; color: #ff8a80; }
.badge-failed { background: #4a1515; color: #ff5252; }
.badge-admin { background: #4a3b12; color: #ffd54f; }
.badge-special { background: #3b1f54; color: #e9d5ff; }
.badge-standard { background: #2a2a2a; color: #b3b3b3; }

/* Lecteur bas */
.player-bar {
  height: 86px; background: var(--bg-panel); border-top: 1px solid var(--border);
  padding: 0 18px; display: grid; grid-template-columns: 1.1fr 1.8fr 1.1fr; align-items: center; gap: 12px;
}
.player-track { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-track img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; background: var(--bg-card); flex-shrink: 0; }
.player-meta { min-width: 0; flex: 1; }
.p-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.92rem; }
.p-artist { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-fav-btn {
  background: transparent; font-size: 1.25rem; padding: 6px; flex-shrink: 0;
}
.player-fav-btn:hover { transform: scale(1.15); }
.player-controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.control-buttons { display: flex; align-items: center; gap: 14px; }
.control-buttons button { background: transparent; color: var(--text-main); font-size: 1.1rem; }
.control-buttons button.active { color: var(--accent); }
.play-main { background: var(--accent) !important; color: var(--accent-text) !important; width: 34px; height: 34px; border-radius: 50%; }
.progress-row { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 480px; font-size: 0.75rem; color: var(--text-muted); }
#seek-bar { flex: 1; accent-color: var(--accent); }
.player-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.player-tool-btn {
  background: transparent; color: var(--text-muted); font-size: 1.05rem; padding: 6px 8px;
  gap: 4px; border-radius: 6px;
}
.player-tool-btn:hover, .player-tool-btn.active { background: var(--bg-card); color: var(--accent); }
#timer-badge { font-size: 0.75rem; font-weight: 700; }
.player-volume { display: flex; align-items: center; gap: 6px; }
#volume-bar { width: 85px; accent-color: var(--accent); }

@media (max-width: 820px) {
  .sidebar { width: 175px; padding: 12px; }
  .track-row { grid-template-columns: 40px 1fr 130px; }
  .track-row > :nth-child(3), .track-row > :nth-child(4) { display: none; }
  .player-bar { grid-template-columns: 1fr 1.3fr auto; }
  .player-volume { display: none; }
  .side-drawer { position: absolute; right: 0; top: 0; bottom: 0; box-shadow: -8px 0 24px rgba(0,0,0,0.6); }
}

/* Drag & Drop File d'attente */
.queue-item.draggable-item {
  user-select: none;
  -webkit-user-select: none;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transition: transform 0.12s, opacity 0.12s, border-color 0.12s;
}
.queue-item.dragging {
  opacity: 0.4;
  background: var(--bg-hover);
}
.queue-item.drag-over-top {
  border-top-color: var(--accent);
}
.queue-item.drag-over-bottom {
  border-bottom-color: var(--accent);
}
.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1.05rem;
  padding: 4px 2px;
  line-height: 1;
  flex-shrink: 0;
  touch-action: none;
}
.drag-handle:active {
  cursor: grabbing;
  color: var(--accent);
}

/* Double onglet Ajout à la playlist (Builder + Zone de dépôt) */
.builder-sources {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  flex-wrap: wrap;
}
.builder-source-btn {
  flex: 1;
  min-width: 70px;
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 7px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.builder-source-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}
.builder-source-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.builder-playlist-picker {
  padding: 10px 16px 0;
}
.builder-playlist-picker select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.builder-hint {
  padding: 8px 16px 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.builder-item {
  cursor: grab;
}
.builder-item:active {
  cursor: grabbing;
}
.builder-item.in-playlist {
  opacity: 0.55;
}
.tracks-section.playlist-dropzone-active {
  outline: 2px dashed var(--accent);
  outline-offset: 8px;
  border-radius: 10px;
  background: rgba(168, 90, 42, 0.12);
  transition: background 0.15s, outline-color 0.15s;
}

/* Sélecteur de thème */
.theme-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  cursor: pointer;
}
