/* ── Prompteur — style.css ── */

:root {
  --bg:          #0a0b10;
  --panel:       #181b22;
  --panel-2:     #232734;
  --panel-3:     #2c3142;
  --border:      #2a2f3d;
  --border-2:    #3a4055;
  --text:        #e8eaf0;
  --muted:       #8b91a3;
  --accent:      #ff6b6b;
  --accent-hov:  #ff5757;
  --accent-2:    #4cc9f0;
  --ok:          #4ade80;
  --warn:        #fbbf24;
  --danger:      #ff8a8a;

  --sidebar-w:   270px;
  --sidebar-bg:  #13151c;
  --sidebar-hover:  #1e222c;
  --sidebar-active: #262b39;

  --radius:      10px;
  --radius-sm:   8px;
  --shadow:      0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.hidden { display: none !important; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
  font-family: 'Menlo','Consolas',monospace; font-size: 12px;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ── Toasts ──────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  box-shadow: var(--shadow); font-size: 14px;
  animation: toast-in .25s ease-out; pointer-events: auto;
}
.toast.error { border-color: #5a3340; color: var(--danger); }
.toast.ok    { border-color: #2b4a3a; color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Buttons ─────────────────────────────────────────────────────────── */
button {
  cursor: pointer; font-family: inherit; font-size: 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  padding: 8px 14px;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
button:hover:not(:disabled) { background: var(--panel-3); border-color: var(--border-2); }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); border-color: var(--accent-hov); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-danger { color: var(--danger); background: transparent; }
.btn-danger:hover:not(:disabled) { background: #3a2229; border-color: #5a3340; }
.btn-icon {
  width: 38px; height: 38px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}

.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 17px; flex-shrink: 0;
}

/* ── Form base ───────────────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--accent-2); }
.form-row textarea {
  min-height: 220px; resize: vertical;
  font-family: 'Menlo','Consolas',monospace; line-height: 1.5;
}
.form-grow { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.form-grow textarea { flex: 1; }

/* ── Auth ────────────────────────────────────────────────────────────── */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1a1f2e 0%, var(--bg) 60%); padding: 20px;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px 28px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow);
}
.auth-logo { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.auth-card h1 { margin: 18px 0 22px; font-size: 18px; font-weight: 600; }
.auth-switch { margin: 18px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.auth-demo {
  margin-top: 22px; padding: 10px; background: var(--panel-2);
  border: 1px dashed var(--border-2); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--muted); text-align: center;
}

/* ── App layout ──────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-search { padding: 12px 12px 4px; }
.sidebar-search input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 14px; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent-2); }

.sidebar-nav { padding: 6px 8px 0; }

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500;
  user-select: none; position: relative; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--text); }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-ic { width: 16px; text-align: center; opacity: .8; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  background: rgba(255,255,255,.1); color: var(--muted);
  font-size: 11px; padding: 1px 7px; border-radius: 10px; flex-shrink: 0;
}

.sidebar-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 4px;
}
.sidebar-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-icon-sidebar {
  width: 22px; height: 22px; padding: 0; flex-shrink: 0;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  border-radius: 5px; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon-sidebar:hover { background: var(--sidebar-hover); color: var(--text); border-color: transparent; }

/* Listes scrollables : groupes / albums = hauteur limitée, morceaux = flex */
.sidebar-list { padding: 2px 8px; overflow-y: auto; }
#artists-list, #albums-list { max-height: 22vh; flex-shrink: 0; }
.songs-list { flex: 1; min-height: 60px; }

.list-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; margin: 1px 0; border-radius: var(--radius-sm);
  cursor: pointer; position: relative; transition: background .12s;
  color: var(--muted); font-size: 13px;
}
.list-item:hover { background: var(--sidebar-hover); color: var(--text); }
.list-item.active { background: var(--sidebar-active); color: #fff; }
.list-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--accent-2); border-radius: 0 2px 2px 0;
}
.list-item.playing { color: var(--accent-2); font-weight: 600; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-sub {
  font-size: 11px; color: var(--muted); opacity: .8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item-badge {
  background: rgba(255,255,255,.1); color: var(--muted);
  font-size: 11px; padding: 1px 7px; border-radius: 10px; flex-shrink: 0;
}
.list-item-edit {
  flex-shrink: 0; width: 24px; height: 24px; padding: 0;
  background: transparent; border: none; color: var(--muted);
  border-radius: 5px; font-size: 12px; opacity: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.list-item:hover .list-item-edit { opacity: .8; }
.list-item-edit:hover { background: rgba(255,255,255,.12); opacity: 1; }
.list-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); opacity: .65; }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-profile {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent; color: var(--text);
  padding: 6px 8px; border-radius: var(--radius-sm); text-align: left;
}
.sidebar-profile:hover { background: var(--sidebar-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700; font-size: 14px;
}
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout {
  flex-shrink: 0; width: 36px; height: 36px; padding: 0; font-size: 16px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-logout:hover { background: var(--sidebar-hover); color: var(--text); border-color: transparent; }

/* ── Main / prompteur ────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.prompter-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.hamburger {
  display: none; width: 38px; height: 38px; padding: 0; font-size: 18px;
  background: transparent; border: 1px solid var(--border);
  align-items: center; justify-content: center; flex-shrink: 0;
}
.prompter-song { min-width: 160px; flex: 1 1 200px; }
.prompter-song h2 {
  margin: 0; font-size: 17px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prompter-meta { color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.prompter-settings {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.control-group { display: flex; align-items: center; gap: 8px; }
.control-group label {
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
}
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100px; height: 4px; background: var(--border); border-radius: 2px; outline: none;
}
.slider:disabled { opacity: .4; }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent-2); cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent-2); cursor: pointer; border: none;
}
.value-display { font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; font-weight: 600; font-size: 13px; }

.play-btn {
  background: var(--accent); color: #fff; border-color: var(--accent);
  width: 42px; height: 42px; border-radius: 50%; font-size: 18px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.play-btn:hover:not(:disabled) { transform: scale(1.05); background: var(--accent-hov); border-color: var(--accent-hov); }
.play-btn.playing { background: var(--accent-2); border-color: var(--accent-2); }

.btn-toggle { min-width: 52px; padding: 6px 10px; }
.btn-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.pulse {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border);
  transition: transform .08s ease-out, background .08s, box-shadow .08s;
}
.pulse.active { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px var(--accent); transform: scale(1.4); }

/* ── Lyrics area ─────────────────────────────────────────────────────── */
.lyrics-area { flex: 1; min-height: 0; position: relative; background: var(--bg); }
.lyrics-scroll {
  height: 100%; overflow-y: auto; scroll-behavior: auto;
  padding: 40vh 8% 60vh; line-height: 1.6;
  font-family: 'Menlo','Consolas',monospace; white-space: pre-wrap; font-size: 22px;
}
/* Accords détectés dans les paroles : couleur + graisse + léger fond.
   Pas de padding horizontal → l'alignement monospace avec les paroles est conservé. */
.chord {
  color: var(--accent-2);
  font-weight: 700;
  background: rgba(76, 201, 240, .10);
  border-radius: 3px;
  cursor: help;
}
.chord:hover { background: rgba(76, 201, 240, .22); }

/* Popover : diagramme d'accord sur le manche */
.chord-popover {
  position: fixed; z-index: 300; display: none;
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px;
  box-shadow: var(--shadow); pointer-events: none;
}
.chord-popover.show { display: block; }
.chord-pop-name {
  text-align: center; font-weight: 700; color: var(--accent-2);
  font-size: 14px; margin-bottom: 6px;
  font-family: 'Inter', sans-serif;
}
.chord-pop-none { color: var(--muted); font-size: 12px; font-family: 'Inter', sans-serif; }
.chord-svg { display: block; }

.lyrics-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px;
}
.lyrics-empty-inner { max-width: 420px; color: var(--muted); }
.lyrics-empty .big-note { font-size: 48px; margin-bottom: 8px; }
.lyrics-empty h2 { color: var(--text); margin: 0 0 8px; }
.lyrics-empty p { margin: 0 0 20px; }

/* ── Modales ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: 100%; max-width: 760px; max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal.modal-sm { max-width: 460px; }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-row3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 16px; }
.modal-sep { border: none; border-top: 1px solid var(--border); margin: 6px 0 14px; }
.modal-hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }

/* ── Sidebar overlay (mobile) ────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90;
}
.sidebar-overlay.show { display: block; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hamburger { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .prompter-settings { gap: 10px; }
  .slider { width: 78px; }
  .control-group label { display: none; }
  .modal-row3 { grid-template-columns: 1fr; }
  .lyrics-scroll { padding: 35vh 6% 60vh; }
  .list-item-edit { opacity: .6; }   /* visible au toucher (pas de hover) */
}
@media (max-width: 560px) {
  .prompter-bar { gap: 8px; }
  .prompter-song { flex-basis: 100%; order: -1; }
}
