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

html, body {
  height: 100%;
  width: 100%;
  /* Prevent scroll anchoring from shifting viewport when content is appended */
  overflow-anchor: none;
  background: #000000; /* make sure html background matches body to avoid white gaps */
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-bottom: none; /* remove visible line at bottom */
  color: #ffffff;
  display: block;
}

/* Ensure the main page wrapper fills the viewport so body/background doesn't end prematurely */
#page-wrapper {
  min-height: 100vh;
  background: transparent;
}

/* Design tokens */
:root {
  --green: #15803d;         /* darker primary (tailwind green-700) */
  --green-hover: #166534;   /* darker hover (tailwind green-800) */
  --surface: #141414;       /* panels */
  --surface-alpha: rgba(20,20,20,0.72);
  --border: #2b2b2b;        /* darker border */
  /* extra gray tokens */
  --bg-deep: #070707;
  --bg-dark: #0f0f0f;
  --muted: #6b7280;
  --muted-2: #9aa0a6;
}

/* Queue cards (downloads list) */
.queue-card {
  background-color: rgba(20,20,20,0.9); /* increase opacity */
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.queue-title {
  flex: 1;
  color: #e5e7eb; /* lighter text for readability */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-status {
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: #ffffff;
}
.queue-completion {
  margin-right: 0.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: #e5e7eb;
  background: rgba(0,0,0,0.25);
}
.queue-status.pending { background: rgba(107,114,128,0.5); }
.queue-status.running { background: rgba(34,197,94,0.35); }
.queue-status.success { background: rgba(34,197,94,0.6); }
.queue-status.failed  { background: rgba(239,68,68,0.6); }

.queue-progress-outer {
  width: 100%;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 9999px;
  height: 0.5rem;
  overflow: hidden;
}

.queue-progress-inner {
  height: 100%;
  border-radius: 9999px;
  background-color: var(--green);
  transition: width 300ms ease;
}

.queue-details {
  display: none;
  margin-top: 0.5rem;
  color: #b0b6bb;
}
.queue-details.expanded { display: block; }

.queue-toggle {
  background: var(--bg-dark);
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.queue-toggle.rotated { transform: rotate(90deg); }

.queue-artist { font-weight: 600; margin-top: 0.25rem; }
.queue-album  { margin-left: 0.5rem; color: #d1d5db; }
.queue-track  { margin-left: 1rem; font-size: 0.875rem; color: #9ca3af; }

.queue-logs-btn {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-dark);
  color: #ffffff;
}

/* Desktop: flex-row layout */
@media (min-width: 1024px) {
  #page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .main-container {
    display: flex;
    gap: 1.5rem;
    width: 90%;
    max-width: 1400px;
    min-height: 60vh;
  }
  
  .left-block, .right-block {
    flex: 1;
    min-width: 0;
  }
}

/* Mobile: flex-col layout */
@media (max-width: 1023px) {
  #page-wrapper {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
}

.container {
  background: var(--surface);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

textarea {
  width: 100%;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  resize: vertical;
  background: var(--bg-dark);
  color: #ffffff;
  font-family: monospace;
}

button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}

button:hover {
  background: var(--green-hover);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.messages p {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: 8px;
  text-align: center;
}

/* === Migrations depuis index.html === */

/* Barres de bascule (indicateurs) */
#input-mode-indicator,
#toggle-indicator {
  position: absolute;
  height: 100%;
  border-radius: 0.5rem;
  transition: transform 300ms ease-in-out;
  background-color: var(--green);
  width: 50%;
  transform: translateX(0);
}

/* Barre d'occupation disque */
.disk-card {
  background-color: var(--surface);
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  /* glass-like */
  background-color: var(--surface-alpha);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.disk-bar-outer {
  width: 100%;
  background-color: var(--bg-dark);
  border-radius: 9999px;
  height: 1.5rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

#disk-bar {
  height: 100%;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background-color: var(--green);
  transition: width 500ms ease, background-color 200ms ease;
  width: 0%;
}

/* Dropdown artiste */
.dropdown-panel {
  background-color: rgba(26, 26, 26, 0.7);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: #b0b6bb;
  font-size: 0.875rem;
}

.dropdown-item:hover {
  background-color: var(--panel);
}

/* Bouton d'album */
.album-button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  color: #b0b6bb;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.album-button:hover {
  background-color: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.album-cover {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  object-fit: cover;
  flex-shrink: 0;
}

.album-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zone CSV preview */
.csv-preview {
  background-color: var(--bg-dark);
  color: var(--green);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow: auto;
  max-height: 20rem;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Mobile: hauteur réduite pour CSV preview */
@media (max-width: 767px) {
  .csv-preview {
    max-height: 12rem;
  }
}

/* Albums list scrollable */
#albums-list {
  max-height: 20rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

@media (max-width: 767px) {
  #albums-list {
    max-height: 15rem;
  }
}



/* Popup terminal */
#terminal-popup {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#terminal-popup.hidden {
  display: none;
}

#terminal-popup:not(.hidden) {
  display: flex;
}

.terminal-card {
  background-color: rgba(7,7,7,0.8);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  width: 91.666667%;
  height: 75%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (min-width: 768px) {
  .terminal-card {
    width: 75%;
  }
}

/* Mobile: ajustement hauteur terminal */
@media (max-width: 767px) {
  .terminal-card {
    width: 95%;
    height: 85%;
    padding: 0.75rem;
  }
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.terminal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #b0b6bb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Mobile: titre plus petit */
@media (max-width: 767px) {
  .terminal-title {
    font-size: 0.875rem;
  }
}

.terminal-close {
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 700;
  transition: color 200ms ease;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: auto;
  min-width: 44px;
  min-height: 44px;
}

.terminal-close:hover {
  color: #b0b6bb;
}

#terminal-content {
  background-color: var(--bg-deep);
  color: var(--muted-2);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow: auto;
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.625;
  white-space: pre-wrap;
}

/* Mobile: texte plus petit dans terminal */
@media (max-width: 767px) {
  #terminal-content {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
}

/* Boutons secondaires */
.btn-secondary {
  background-color: var(--bg-dark);
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

/* Entrées de formulaire */
.input-dark {
  width: 100%;
  background-color: var(--bg-dark);
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  min-height: 44px;
}

.input-dark:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.18);
}

/* Mobile: ajustement taille tactile */
@media (max-width: 767px) {
  .input-dark {
    font-size: 16px; /* Évite le zoom automatique sur iOS */
  }
}

/* En-têtes de sections albums */
.album-section-title {
  color: #ffffff;
  font-weight: 600;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.album-section-title.mt-4 {
  margin-top: 1rem;
}

/* Formulaire manuel */
.artist-block {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}


#artists {
  max-height: 25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

@media (max-width: 767px) {
  #artists {
    max-height: 20rem;
  }
}

.artist-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.album-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-dark);
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  cursor: pointer;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}

.btn-icon:hover {
  background-color: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.btn-add-album {
  margin-top: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  color: #ffffff;
  font-size: 0.875rem;
  background-color: var(--bg-dark);
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  cursor: pointer;
  width: auto;
  min-height: 44px;
}

.btn-add-album:hover {
  background-color: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.flex-1 {
  flex: 1;
}

/* === RESPONSIVE MOBILE === */

/* Ajustements globaux mobile */
@media (max-width: 767px) {
  /* Réduction du padding body */
  body.flex.flex-col.items-center.p-8 {
    padding: 1rem !important;
  }
  
  /* Titre principal plus petit */
  h1.text-3xl {
    font-size: 1.5rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Gap réduit entre les sections */
  .flex.flex-col.md\\:flex-row.gap-6 {
    gap: 1rem !important;
  }
  
  /* Cards avec padding réduit */
  .shadow-lg.border.rounded-2xl.p-6 {
    padding: 1rem !important;
  }
  
  /* Albums list hauteur réduite */
  .max-h-64.overflow-y-auto {
    max-height: 10rem !important;
  }
  
  /* Textes légèrement plus petits */
  .text-xl {
    font-size: 1.125rem !important;
  }
  
  /* Status text */
  .mt-3.text-sm {
    margin-top: 0.75rem !important;
  }
}

/* Amélioration des zones tactiles mobile */
@media (max-width: 767px) {
  /* Boutons de toggle */
  #musicbrainz-btn,
  #manual-btn,
  #mp3-btn,
  #flac-btn {
    min-height: 44px;
    padding: 0.75rem;
  }
  
  /* Bouton principal télécharger */
  #download {
    min-height: 48px;
    font-size: 1rem;
  }
  
  /* Bouton ajouter artiste */
  #add-artist {
    min-height: 44px;
  }
}

/* Optimisation du scroll mobile */
@media (max-width: 767px) {
  /* Smooth scroll */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Éviter le bounce sur iOS */
  body {
    overscroll-behavior-y: contain;
  }
  
  /* Albums section scroll amélioré */
  #albums-section {
    -webkit-overflow-scrolling: touch;
  }
  
  /* CSV preview scroll amélioré */
  .csv-preview {
    -webkit-overflow-scrolling: touch;
  }
}

/* Ajustements pour très petits écrans (iPhone SE, etc.) */
@media (max-width: 375px) {
  body.flex.flex-col.items-center.p-8 {
    padding: 0.75rem !important;
  }
  
  h1.text-3xl {
    font-size: 1.25rem !important;
  }
  
  .disk-card {
    padding: 0.75rem;
  }
  
  .shadow-lg.border.rounded-2xl.p-6 {
    padding: 0.75rem !important;
  }
  
  .csv-preview {
    height: 10rem;
    padding: 0.75rem;
  }
  
  .btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 44px;
    min-height: 44px;
  }
  
  .album-cover {
    width: 2rem;
    height: 2rem;
  }
}

/* Landscape mobile */
@media (max-width: 767px) and (orientation: landscape) {
  h1.text-3xl {
    font-size: 1.25rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .disk-card {
    margin-bottom: 0.75rem;
  }
  
  .csv-preview {
    height: 8rem;
  }
  
  .terminal-card {
    height: 90%;
  }
}
/* Import CSV Button */
#import-csv-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--green);
  color: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  font-size: 0.875rem;
}

#import-csv-btn:hover {
  background-color: var(--green-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

#csv-file-input {
  display: none;
}

/* Modal d'import CSV */
#csv-import-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

#csv-import-modal.active {
  display: flex;
}

.csv-import-card {
  background-color: rgba(7,7,7,0.8);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  width: 90%;
  max-width: 500px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.csv-import-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
}

.csv-import-preview {
  background-color: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  max-height: 12rem;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  color: var(--muted-2);
  white-space: pre-wrap;
  word-break: break-all;
}

.csv-import-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.csv-import-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms ease;
  font-size: 0.875rem;
  min-height: 44px;
}

.csv-import-btn-confirm {
  background-color: var(--green);
  color: white;
}

.csv-import-btn-confirm:hover {
  background-color: var(--green-hover);
}

.csv-import-btn-cancel {
  background-color: var(--bg-dark);
  color: #ffffff;
}

.csv-import-btn-cancel:hover {
  background-color: var(--panel);
}

.csv-import-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: 0.5rem;
  padding: 0.75rem;
  color: #fca5a5;
  font-size: 0.875rem;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .csv-import-card {
    width: 95%;
    padding: 1rem;
  }
  
  #import-csv-btn {
    width: 100%;
  }
}

/* Indicateurs de toggle - corrigé */
#input-mode-indicator,
#toggle-indicator,
#tracks-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 0.5rem;
  transition: transform 300ms ease-in-out;
  background-color: var(--green);
  width: 50%;
  transform: translateX(0);
  pointer-events: none;
}

/* Safer overrides by ID for key elements */
#download { background-color: var(--green) !important; }
#download:hover { background-color: var(--green-hover) !important; }
#disk-bar:not(.bg-red-500) { background-color: var(--green) !important; }

/* Frosted cards using existing shadow + border utility combo */
.shadow-lg.border {
  background-color: var(--surface-alpha) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


/* === Overrides: full black background + transparent gray overlays === */
body { background: #000000 !important; }

/* Main cards using shadow + border utilities */
.shadow-lg.border {
  background-color: rgba(38, 38, 38, 0.55) !important;
  border-color: rgba(68, 68, 68, 0.55) !important;
}

/* Disk usage card and bar */
.disk-card {
  background-color: rgba(38, 38, 38, 0.55) !important;
  border-color: rgba(68, 68, 68, 0.55) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.disk-bar-outer {
  background-color: rgba(26, 26, 26, 0.5) !important;
  border-color: rgba(68, 68, 68, 0.45) !important;
}

/* Dropdowns and lists */
.dropdown-panel {
  background-color: rgba(26, 26, 26, 0.6) !important;
  border-color: rgba(68, 68, 68, 0.5) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* CSV preview */
.csv-preview {
  background-color: rgba(26, 26, 26, 0.6) !important;
  border-color: rgba(68, 68, 68, 0.5) !important;
}

/* Terminal */
.terminal-card {
  background-color: rgba(30, 30, 30, 0.6) !important;
  border-color: rgba(68, 68, 68, 0.5) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#terminal-content {
  background-color: rgba(13, 13, 13, 0.7) !important;
  border-color: rgba(51, 51, 51, 0.5) !important;
}

/* CSV import modal */
#csv-import-modal { background-color: rgba(0,0,0,0.8) !important; }

.csv-import-card {
  background-color: rgba(30, 30, 30, 0.6) !important;
  border-color: rgba(68, 68, 68, 0.5) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.csv-import-preview {
  background-color: rgba(13, 13, 13, 0.7) !important;
  border-color: rgba(51, 51, 51, 0.5) !important;
}

/* Inputs and secondary buttons */
.input-dark,
.btn-secondary,
.btn-icon,
.btn-add-album,
.album-button {
  background-color: rgba(26, 26, 26, 0.6) !important;
  border-color: rgba(68, 68, 68, 0.5) !important;
}

.album-button:hover,
.btn-secondary:hover,
.btn-icon:hover,
.btn-add-album:hover {
  background-color: rgba(38, 38, 38, 0.6) !important;
}

/* Background particles canvas layering */
canvas#bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Ensure all other content stays above the background canvas without affecting layout */
/* Keep app content above the background canvas, but don't affect overlays/modals */
body > :not(canvas#bg-particles):not(#terminal-popup):not(#csv-import-modal) {
  position: relative;
  z-index: 1;
}

/* Ensure overlays sit above everything */
#terminal-popup { z-index: 1000; }
#csv-import-modal { z-index: 1000; }
/* Changelog popup - styles gérés inline, juste le hidden ici */
#changelog-popup.hidden {
  display: none !important;
}

/* Changelog modal overlay */
#changelog-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.7);
  z-index: 1001;
  display: none;
}

#changelog-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Floating changelog button smaller size */
#open-changelog {
  font-size: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  width: auto !important;
  display: inline-block !important;
}

/* Simple, subtle hover glow for #open-changelog */
#open-changelog {
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  transition: transform 160ms ease, box-shadow 160ms ease;
  z-index: 10000 !important;
}

#open-changelog:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34,197,94,0.12), 0 0 40px rgba(34,197,94,0.06);
}

/* Changelog content fills card width */
#changelog-popup .csv-import-preview {
  width: 100%;
}

/* Reduce vertical padding inside the changelog content and avoid extra leading spaces */
#changelog-popup .csv-import-preview {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
  white-space: pre-line !important;
}

/* Changelog popup: smaller card than terminal */
#changelog-popup .terminal-card {
  width: 65% !important;
  height: 60% !important;
}

@media (max-width: 767px) {
  #changelog-popup .terminal-card {
    width: 90% !important;
    height: 70% !important;
  }
}

/* === Queue section styles === */
.queue-card {
  background-color: var(--surface-alpha);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.queue-toggle {
  background: var(--bg-dark);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  transition: transform 160ms ease;
}
.queue-toggle.rotated { transform: rotate(90deg); }

.queue-title {
  flex: 1;
  min-width: 0;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.queue-status.pending { background-color: #4b5563; color: #fff; }
.queue-status.running { background-color: #f59e0b; color: #1f2937; }
.queue-status.success { background-color: #22c55e; color: #07280f; }
.queue-status.failed { background-color: #ef4444; color: #fff; }

.queue-progress-outer {
  margin-top: 0.5rem;
  width: 100%;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}
.queue-progress-inner {
  height: 100%;
  background-color: #22c55e;
  width: 0%;
  transition: width 400ms ease;
}

.queue-details { display: none; margin-top: 0.5rem; }
.queue-details.expanded { display: block; }
.queue-artist { margin-top: 6px; font-weight: 600; }
.queue-album { margin-left: 12px; font-weight: 500; }
.queue-track { margin-left: 24px; opacity: 0.85; }

.queue-logs-btn {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-dark);
  color: #fff;
  width: auto;
}

/* ===== Modern theme upgrades (non-breaking, CSS-only) ===== */
:root {
  --accent: #22c55e;
  --accent-soft: rgba(34,197,94,0.18);
  /* Darker background without blue hue, subtle green tint at top-left */
  --gradient-1: radial-gradient(1200px 600px at 15% 0%, rgba(34,197,94,0.06), transparent 60%), linear-gradient(180deg, #0c0c0c 0%, #0a0a0a 100%);
}

/* Background: subtle gradient overlay covering full page */
html { background: var(--gradient-1) !important; background-attachment: fixed !important; }
body { background: var(--gradient-1) !important; background-attachment: fixed !important; }

/* Page wrapper fade-in for a modern touch */
#page-wrapper { animation: fadeIn 320ms ease-out both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography polish */
h1 {
  letter-spacing: 0.25px;
  background: linear-gradient(180deg, #ffffff, #cfcfcf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { letter-spacing: 0.2px; }
p, li { line-height: 1.6; }

/* Modern scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) rgba(255,255,255,0.08); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 9999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* Inputs: refined focus */
.input-dark { transition: box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease; }
.input-dark:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background-color: rgba(26, 26, 26, 0.75) !important;
}

/* Buttons micro-interactions */
.btn-secondary,
.btn-icon,
.btn-add-album { transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease; }
.btn-secondary:hover,
.btn-icon:hover,
.btn-add-album:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,0.30); }
.btn-secondary:focus-visible,
.btn-icon:focus-visible,
.btn-add-album:focus-visible,
#download:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
#download { transition: transform 160ms ease, box-shadow 160ms ease; }
#download:hover { box-shadow: 0 12px 24px rgba(34,197,94,0.18); transform: translateY(-1px); }

/* Cards subtle hover */
.shadow-lg.border { transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.shadow-lg.border:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,0.40); }
.disk-card { box-shadow: 0 12px 28px rgba(0,0,0,0.35); }
.csv-import-card { box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.csv-import-preview { border-radius: 0.625rem; transition: border-color 180ms ease, background-color 180ms ease; }

/* Queue progress stripes */
.queue-progress-inner {
  background-image: linear-gradient(90deg, rgba(255,255,255,0.15) 0 20%, transparent 20% 40%, rgba(255,255,255,0.15) 40% 60%, transparent 60% 80%, rgba(255,255,255,0.15) 80% 100%);
  background-size: 200% 100%;
  animation: stripes 1200ms linear infinite;
}
@keyframes stripes { 0% { background-position-x: 0%; } 100% { background-position-x: 100%; } }

/* Dropdown polish */
.dropdown-panel { box-shadow: 0 10px 24px rgba(0,0,0,0.35); transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.dropdown-panel:hover { transform: translateY(-1px); }

/* Terminal text tweaks */
#terminal-content { font-feature-settings: "ss01" on, "zero" on; letter-spacing: 0.1px; }

