/* =============================================================
   Ecole de musique Marianne — feuille de style commune
   Compatible desktop + mobile
   ============================================================= */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: #1f2340;
  min-height: 100vh;
  padding: 0 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---- Fond fixe commun à toutes les pages ---- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(165deg, rgba(26, 19, 64, .45), rgba(52, 26, 94, .35) 45%, rgba(26, 19, 64, .55)),
    url("../images/background.webp") center / cover no-repeat;
}

/* ---- Carte de contenu ---- */
.card {
  background: rgba(255, 255, 255, .94);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(10, 8, 40, .35);
  max-width: 780px;
  margin: 5vh auto 40px;
  padding: 30px clamp(16px, 4vw, 42px) 34px;
}

h1 { color: #2b2160; font-size: clamp(1.45rem, 4.5vw, 2.15rem); margin: 0 0 8px; }
.subtitle { color: #6b6f8f; margin: 0 0 20px; }
.center { text-align: center; }
code { background: #eef0f8; padding: 2px 6px; border-radius: 6px; }

/* =============================================================
   Page principale : liste défilante des utilisateurs
   ============================================================= */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(58vh, 540px);
  overflow-y: auto;
  padding: 4px 8px 4px 2px;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.user-list::-webkit-scrollbar { width: 10px; }
.user-list::-webkit-scrollbar-thumb { background: #c9cbe4; border-radius: 8px; }
.user-list::-webkit-scrollbar-track { background: transparent; }

.user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 16px;
  border-radius: 14px;
  background: #f4f4fb;
  border: 1px solid #e3e4f4;
  color: #2b2160;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.user-item:hover,
.user-item:focus-visible {
  background: #fff;
  box-shadow: 0 6px 18px rgba(43, 33, 96, .16);
  transform: translateY(-1px);
}
.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #c026d3);
}
.chevron { margin-left: auto; color: #9aa0c4; font-size: 1.5rem; line-height: 1; }

/* =============================================================
   Page utilisateur
   ============================================================= */
.topbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 780px;
  margin: 4vh auto 16px;
}
.topbar h1 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 16px rgba(10, 8, 40, .55);
  font-size: clamp(1.25rem, 4vw, 1.9rem);
}
.back {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, .94);
  color: #2b2160;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(10, 8, 40, .28);
  white-space: nowrap;
  transition: background .15s ease;
}
.back:hover { background: #fff; }

/* Tableau des fichiers : 1 colonne PDF + 1 colonne MP3 + 1 colonne Titre */
.files-card { padding: 4px 0 10px; margin-bottom: 40px; }
body.with-player .files-card { margin-bottom: 130px; }

.files-head,
.files-list { list-style: none; margin: 0; padding: 0; }
.files-head {
  display: grid;
  grid-template-columns: 72px 72px 1fr;
  padding: 14px 20px 10px;
  border-bottom: 1px solid #e6e7f4;
  color: #8a8eb2;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.file-row {
  display: grid;
  grid-template-columns: 72px 72px 1fr;
  align-items: center;
  min-height: 62px;
  padding: 7px 20px;
  border-bottom: 1px solid #eef0f8;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #f6f6fd; }
.cell { display: flex; align-items: center; }
.cell-title {
  font-weight: 600;
  color: #23264a;
  padding-left: 4px;
  overflow-wrap: anywhere;
}

.icon-btn {
  display: inline-flex;
  border: none;
  background: none;
  padding: 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease;
}
.icon-btn:hover { transform: scale(1.1); }
.icon-btn:focus-visible { outline: 3px solid #4f46e5; outline-offset: 2px; }
.icon-btn img { width: 40px; height: 40px; display: block; }
.btn-mp3.playing { background: #eef2ff; }
.btn-mp3.playing img { filter: drop-shadow(0 0 6px rgba(79, 70, 229, .8)); }

.empty { padding: 28px 18px 34px; color: #6b6f8f; text-align: center; margin: 0; }

.btn-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #4f46e5;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 999px;
  transition: background .15s ease;
}
.btn-home:hover { background: #5b52ee; }

/* =============================================================
   Lecteur mp3 : fixe en bas, invisible tant qu'aucun mp3 cliqué
   ============================================================= */
.player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 6px 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(22, 18, 46, .94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  box-shadow: 0 14px 40px rgba(8, 6, 30, .5);
  transform: translateY(135%);
  transition: transform .28s ease;
}
.player.open { transform: translateY(0); }
.player[hidden] { display: none; }

.p-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.p-btn:hover { background: rgba(255, 255, 255, .24); }
.p-btn:focus-visible { outline: 3px solid #ec4899; outline-offset: 2px; }
.p-btn svg { display: block; }
#p-play { width: 48px; height: 48px; background: #4f46e5; }
#p-play:hover { background: #5b52ee; }
#p-repeat.active { background: #ec4899; }
.p-close { width: 38px; height: 38px; background: rgba(255, 255, 255, .08); }

.p-mid { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.p-title {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-seekrow { display: flex; align-items: center; gap: 10px; }
#p-seek {
  flex: 1 1 auto;
  min-width: 70px;
  height: 22px;
  accent-color: #ec4899;
  cursor: pointer;
}
.p-time {
  font-size: .78rem;
  color: #c9cbff;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Vitesse : liste verticale ouverte au-dessus du bouton */
.p-speed { position: relative; }
.p-speed-btn {
  width: auto;
  min-width: 58px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
.speed-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 88px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(22, 18, 46, .97);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(8, 6, 30, .55);
  max-height: min(46vh, 380px);
  overflow-y: auto;
}
.speed-list li {
  padding: 9px 14px;
  border-radius: 9px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.speed-list li:hover,
.speed-list li:focus-visible { background: rgba(255, 255, 255, .16); }
.speed-list li.active { background: #ec4899; color: #fff; }

.hidden { display: none !important; }

/* =============================================================
   Mobile
   ============================================================= */
@media (max-width: 560px) {
  body { padding: 0 10px; }
  .card { margin-top: 3vh; border-radius: 16px; }
  .back { padding: 9px 13px; font-size: .9rem; }
  .files-head,
  .file-row { grid-template-columns: 60px 60px 1fr; padding-left: 12px; padding-right: 12px; }
  .player { left: 8px; right: 8px; bottom: 8px; padding: 10px; gap: 6px; border-radius: 14px; }
  #p-play { width: 44px; height: 44px; }
  .p-btn { width: 40px; height: 40px; }
  .p-close { width: 34px; height: 34px; }
  .p-speed-btn { min-width: 50px; padding: 0 9px; font-size: .84rem; }
  .p-time { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
