* { box-sizing: border-box; }
body { font-family: -apple-system, Segoe UI, Arial, sans-serif; background: #0a0a0c; color: #e2e4ea; margin: 0; padding-bottom: 90px; }
.hidden { display: none !important; }
code { background: #0c0e12; padding: 2px 6px; border-radius: 4px; }

/* ---------- AUTH ---------- */
.auth-view { position: fixed; inset: 0; background: #0a0a0c; z-index: 300; display: flex; align-items: center; justify-content: center; }
.auth-box { width: 380px; max-width: 90vw; }
.logo { font-size: 20px; font-weight: bold; color: #1db954; }
.logo span { color: #fff; }
.auth-notice { background: #16281c; border: 1px solid #1db954; border-radius: 6px; padding: 12px 16px; font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
.auth-form h2 { margin: 0 0 16px; font-size: 22px; }
.auth-form input { width: 100%; background: #16171c; border: 1px solid #2a2d36; color: #fff; padding: 12px; border-radius: 4px; margin-bottom: 12px; font-size: 14px; }
.auth-form button { width: 100%; background: #1db954; border: none; color: #000; padding: 12px; border-radius: 20px; cursor: pointer; font-size: 15px; font-weight: 700; }
.auth-error { background: #3f1a1a; color: #fca5a5; padding: 10px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.auth-success { background: #14301c; color: #86efac; padding: 10px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: #999; }
.auth-switch a { color: #1db954; text-decoration: none; }

/* ---------- NAV ---------- */
.topnav { display: flex; align-items: center; gap: 24px; padding: 14px 28px; background: #16171c; position: sticky; top: 0; z-index: 50; }
.nav-tabs { display: flex; gap: 6px; }
.nav-tab { background: transparent; border: none; color: #a3a7b3; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.nav-tab:hover { color: #fff; }
.nav-tab.active { background: #2a2d36; color: #fff; font-weight: 600; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-right input { background: #0c0e12; border: 1px solid #2a2d36; color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px; width: 200px; }
.btn-ghost { background: transparent; border: 1px solid #444; color: #ccc; padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.btn-voice { background: #1db954; border: none; color: #000; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; flex-shrink: 0; }
.btn-voice:active { background: #17a54a; transform: scale(0.95); }
.current-user { color: #999; font-size: 13px; }

main { padding: 24px 28px; }
.section-title { font-size: 22px; margin: 0 0 16px; }

/* ---------- GRILLE (artistes/albums/playlists) ---------- */
.grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.grid-card { background: #16171c; border-radius: 8px; padding: 16px; cursor: pointer; transition: background 0.15s; position: relative; }
.grid-card:hover { background: #202127; }
.grid-icon { font-size: 40px; text-align: center; margin-bottom: 10px; }
.grid-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; margin-bottom: 10px; background: #2a2d36; }
.grid-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.grid-sub { color: #999; font-size: 12px; }
.station-card { background: linear-gradient(135deg, #1a2e1f, #16171c); border: 1px solid #1db95433; }
.station-card:hover { border-color: #1db954; }

/* ---------- COMMANDE VOCALE ---------- */
.voice-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 400; display: flex; align-items: center; justify-content: center; }
.voice-overlay-content { text-align: center; }
.voice-icon { font-size: 64px; margin-bottom: 20px; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
#voice-status { font-size: 22px; font-weight: 600; margin-bottom: 10px; }
.voice-heard { color: #999; font-size: 15px; font-style: italic; }

/* ---------- TABLEAU DE MORCEAUX ---------- */
.track-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.track-table th { text-align: left; color: #999; padding: 8px 12px; border-bottom: 1px solid #2a2d36; font-weight: 500; font-size: 12px; text-transform: uppercase; }
.track-table td { padding: 10px 12px; border-bottom: 1px solid #1a1b20; }
.track-table tr:hover { background: #16171c; }
.track-unidentified { opacity: 0.7; }
.badge-unid { background: #b45309; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.btn-play-row { background: #1db954; border: none; color: #000; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }

/* ---------- PLAYLISTS ---------- */
.playlists-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.inline-form-small { display: flex; gap: 8px; }
.inline-form-small input { background: #16171c; border: 1px solid #2a2d36; color: #fff; padding: 8px 12px; border-radius: 4px; }
.playlist-actions { margin-bottom: 16px; }
.playlist-track-list { display: flex; flex-direction: column; }
.playlist-track-row { display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-bottom: 1px solid #1a1b20; }
.playlist-track-pos { color: #666; width: 24px; text-align: center; }

/* ---------- BOUTONS ---------- */
.btn-primary { background: #1db954; border: none; color: #000; padding: 10px 20px; border-radius: 20px; cursor: pointer; font-weight: 700; font-size: 13px; }
.btn-small { background: #2a2d36; border: none; color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 12px; cursor: pointer; margin-left: 4px; }
.btn-small.btn-danger { background: #4c1d1d; color: #fca5a5; }
.hint { color: #6b6f7a; font-size: 12px; }

/* ---------- LECTEUR PERSISTANT ---------- */
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 80px; background: #16171c;
  border-top: 1px solid #2a2d36; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; z-index: 100;
}
.player-cover { width: 52px; height: 52px; border-radius: 4px; object-fit: cover; background: #2a2d36; }
.player-info { width: 180px; flex-shrink: 0; }
.player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 12px; color: #999; }
.player-controls { display: flex; gap: 10px; align-items: center; }
.player-controls button { background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; }
#player-playpause { background: #fff; color: #000; width: 34px; height: 34px; border-radius: 50%; font-size: 14px; }
.player-progress { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 11px; color: #999; }
.player-progress input { flex: 1; accent-color: #1db954; }
#player-favorite { background: transparent; border: none; color: #fff; font-size: 20px; cursor: pointer; }

/* ---------- PANNEAU ADMIN (repris de Home Netflix) ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; z-index: 200; }
.admin-shell { display: flex; width: 92vw; max-width: 1000px; height: 82vh; background: #111318; border-radius: 10px; overflow: hidden; border: 1px solid #24262e; }
.admin-sidebar { width: 220px; flex-shrink: 0; background: #0c0e12; border-right: 1px solid #1f2128; display: flex; flex-direction: column; padding: 20px 12px; }
.admin-sidebar-title { font-size: 11px; text-transform: uppercase; color: #5a5e6a; padding: 0 12px 16px; font-weight: 600; }
.admin-nav-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: none; color: #a3a7b3; padding: 11px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; margin-bottom: 2px; }
.admin-nav-item:hover { background: #181a21; color: #e2e4ea; }
.admin-nav-item.active { background: #1db954; color: #000; font-weight: 600; }
.admin-badge { margin-left: auto; background: #f59e0b; color: #1a1a1a; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.admin-sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid #1f2128; }
.close-btn-inline { width: 100%; background: transparent; border: 1px solid #2a2d36; color: #8a8e99; padding: 9px; border-radius: 7px; cursor: pointer; }
.admin-content { flex: 1; overflow-y: auto; padding: 28px 34px; }
.admin-panel-header h2 { font-size: 20px; margin: 0 0 6px; }
.admin-panel-header p { font-size: 13px; color: #8a8e99; }
.admin-card { background: #171921; border: 1px solid #23252e; border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.admin-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 1px solid #1f2128; font-size: 13px; }
.admin-list-item-sub { color: #6b6f7a; font-size: 11px; }
.admin-form-inline { display: flex; gap: 8px; margin-top: 14px; }
.admin-form-inline input { flex: 1; background: #0c0e12; border: 1px solid #2a2d36; color: #e2e4ea; padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.scan-progress { background: #0c0e12; border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.scan-progress-bar { background: #23252e; border-radius: 6px; height: 8px; overflow: hidden; margin-bottom: 6px; }
.scan-progress-bar > div { background: #1db954; height: 100%; transition: width 0.3s ease; }

/* ---------- ADAPTATION MOBILE ---------- */
@media (max-width: 768px) {
  .topnav { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .nav-tabs { gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex: 1 1 100%; order: 3; padding-bottom: 4px; }
  .nav-tab { padding: 6px 12px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
  .nav-right { gap: 6px; margin-left: 0; }
  .nav-right input { width: 110px; font-size: 12px; padding: 7px 10px; }
  .btn-ghost { padding: 5px 10px; font-size: 12px; }
  .current-user { display: none; } /* peu utile sur petit écran, gagne de la place */

  main { padding: 14px; }
  .section-title { font-size: 18px; }

  .grid-list { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .grid-card { padding: 10px; }
  .grid-icon { font-size: 28px; margin-bottom: 6px; }
  .grid-title { font-size: 12px; }
  .grid-sub { font-size: 11px; }

  /* Tableau de morceaux : masque les colonnes secondaires, défilement horizontal
     en secours si jamais ça déborde encore sur un très petit écran. */
  .track-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .track-table th, .track-table td { padding: 8px 6px; font-size: 12px; }
  .track-table th:nth-child(4), .track-table td:nth-child(4) { display: none; } /* colonne Album */
  .btn-play-row { width: 24px; height: 24px; }
  .btn-small { padding: 5px 9px; font-size: 11px; margin-left: 2px; }

  .playlists-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .inline-form-small { width: 100%; }
  .inline-form-small input { flex: 1; }

  /* Lecteur persistant : très compact, on garde l'essentiel */
  .player-bar { height: 64px; padding: 0 10px; gap: 8px; }
  .player-cover { width: 40px; height: 40px; }
  .player-info { width: 90px; }
  .player-title { font-size: 12px; }
  .player-artist { font-size: 11px; }
  .player-controls { gap: 4px; }
  .player-controls button { font-size: 15px; }
  #player-playpause { width: 28px; height: 28px; }
  .player-progress { display: flex; flex: 1; min-width: 0; }
  .player-progress span { display: none; } /* masque juste les chiffres de temps, garde le curseur */
  #player-favorite { font-size: 16px; }

  /* Panneau admin : sidebar devient une barre horizontale scrollable */
  .admin-shell { flex-direction: column; width: 96vw; height: 92vh; }
  .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 8px; border-right: none; border-bottom: 1px solid #1f2128; }
  .admin-sidebar-title, .admin-sidebar-footer { display: none; }
  .admin-nav-item { flex-shrink: 0; width: auto; white-space: nowrap; }
  .admin-content { padding: 16px; }
  .admin-form-inline { flex-direction: column; }
}

@media (max-width: 420px) {
  .grid-list { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .nav-right input { width: 80px; }
  .track-table th:nth-child(3), .track-table td:nth-child(3) { display: none; } /* colonne Artiste aussi masquée */
  .player-info { width: 70px; }
}
