:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232732;
  --text: #e8eaed;
  --muted: #9aa0aa;
  --primary: #6c5ce7;
  --primary-h: #5a4bd4;
  --danger: #e74c3c;
  --insta: #e1306c;
  --spotify: #1db954;
  --tidal: #0ff;
  --soundcloud: #ff5500;
  --radius: 14px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; }
main { max-width: 880px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid #2a2e38;
  position: sticky; top: 0; z-index: 10;
}
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; text-decoration: none; display: flex; align-items: center; }
.logo img { display: block; height: 40px; width: auto; }
.site-header nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.site-header nav a:hover { color: var(--text); }
.admin-link { color: var(--primary) !important; }

/* Hero */
.hero { text-align: center; padding: 2.5rem 1rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); margin: 0; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid #2a2e38;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0; }
.center { text-align: center; }
.page-title { margin-bottom: 1.25rem; }
.empty, .muted { color: var(--muted); }

/* Contenu Markdown (description association / groupe / événement) */
.md p { margin: 0 0 .75em; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .5em 0; padding-left: 1.3em; }
.md li { margin: .2em 0; }
.md a { color: var(--primary); text-decoration: underline; }
.md strong { color: var(--text); }
.md blockquote {
  margin: .5em 0; padding: .2em 1em;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}
.md code {
  background: var(--surface-2); border-radius: 4px;
  padding: .1em .35em; font-size: .9em;
}
.md h1, .md h2, .md h3 { margin: .6em 0 .3em; line-height: 1.3; }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }

/* Icons */
.icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}
.back .icon { width: .95em; height: .95em; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid #353a46;
  padding: .6rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  font-size: .95rem;
}
.btn:hover { background: #2c313d; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; }
.btn-lg { padding: .9rem 1.4rem; font-size: 1.05rem; }
.btn-insta { background: var(--insta); border-color: var(--insta); }
.btn-spotify { background: var(--spotify); border-color: var(--spotify); color:#04210f; }
.btn-tidal { background: var(--tidal); border-color: var(--tidal); color:#00201f; }
.btn-soundcloud { background: var(--soundcloud); border-color: var(--soundcloud); }
.btn-youtube { background: #ff0000; border-color: #ff0000; }
.btn-tiktok { background: #010101; border-color: #25f4ee; }
.btn-facebook { background: #1877f2; border-color: #1877f2; }
.btn-deezer { background: #a238ff; border-color: #a238ff; }
.btn-apple { background: #fa243c; border-color: #fa243c; }
.btn-merch { background: #111; border-color: #555; }
.btn-site { background: #2c313d; border-color: #4a5160; }
.btn-linktree { background: #43e660; border-color: #43e660; color:#04210f; }

/* Tarifs billetterie (API HelloAsso) */
.tarifs { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: .6rem; }
.tarif {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface-2); border: 1px solid #353a46;
  border-radius: 10px; padding: .8rem 1rem;
}
.tarif-info { display: flex; flex-direction: column; gap: .15rem; }
.tarif-label { font-weight: 700; }
.tarif-desc { color: var(--muted); font-size: .85rem; }
.tarif-stock { font-size: .8rem; color: var(--spotify); font-weight: 600; }
.tarif-stock.complet { color: var(--danger); }
.tarif-prix { font-weight: 700; color: var(--primary); white-space: nowrap; }
.tarif-complet { opacity: .55; }

/* Events list */
.evt-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.evt-item {
  display: flex; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid #2a2e38;
  border-radius: var(--radius); padding: 1rem; align-items: center;
}
.evt-photo {
  width: 160px; height: 120px; object-fit: cover; border-radius: 10px; flex-shrink: 0;
}
.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 2.5rem;
}
.evt-photo-link { display: block; flex-shrink: 0; }
.evt-body { flex: 1; min-width: 220px; }
.evt-body h2 { margin: 0 0 .25rem; }
.evt-titre { text-decoration: none; }
.evt-titre:hover { text-decoration: underline; }
.date { color: var(--primary); font-weight: 600; margin: .1rem 0; text-transform: capitalize; }
.lieu { color: var(--muted); margin: .1rem 0 .6rem; }
.evt-groupes { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.tag {
  background: var(--surface-2); border: 1px solid #353a46;
  padding: .25rem .6rem; border-radius: 999px; font-size: .8rem;
  text-decoration: none;
}
.tag:hover { background: var(--primary); border-color: var(--primary); }
.evt-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Événements passés */
.evt-passes { margin-top: 2rem; }
.evt-passes-titre {
  cursor: pointer; font-weight: 700; color: var(--muted);
  padding: .6rem 0; border-top: 1px solid #2a2e38; list-style: none;
}
.evt-passes-titre::-webkit-details-marker { display: none; }
.evt-passes-titre::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.evt-passes[open] .evt-passes-titre::before { transform: rotate(90deg); }
.evt-passes-titre:hover { color: var(--text); }
.evt-list-passes { margin-top: 1rem; }
.evt-item-passe { opacity: .6; filter: grayscale(.5); transition: opacity .15s, filter .15s; }
.evt-item-passe:hover { opacity: .9; filter: grayscale(.2); }
.badge-passe {
  display: inline-block; vertical-align: middle;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid #353a46; border-radius: 999px; padding: .15rem .55rem;
}

/* Evt mini (accueil) */
.evt-mini { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.evt-mini img { width: 180px; height: 130px; object-fit: cover; border-radius: 10px; }

/* Page événement dédiée */
.evenement-photo { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1.25rem; }
.evenement-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 3rem; height: 220px; background: var(--surface); }
.evenement-description { margin: 1.25rem 0; }
.evenement-page .evt-groupes { margin: 1rem 0; }

/* Groupe page */
.back { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: 1rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.groupe-page { text-align: center; }
.groupe-photo { width: 220px; height: 220px; object-fit: cover; border-radius: 50%; margin: 0 auto 1rem; }
.presentation { max-width: 600px; margin: 0 auto 1.5rem; color: var(--muted); }
.rs-links, .socials { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* Billetterie */
.helloasso-embed iframe { width: 100%; min-height: 700px; border: 0; border-radius: 12px; }

/* Admin */
.admin-head, .admin-list li details summary { display: flex; }
.admin-head { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.admin-head-actions { display: flex; gap: .6rem; align-items: center; }
form label { display: block; margin: .6rem 0; font-weight: 600; font-size: .9rem; }
.md-hint { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; margin: .1rem 0 .2rem; }
form input[type=text], form input[type=password], form input[type=date],
form input:not([type]), form textarea {
  width: 100%; margin-top: .25rem; padding: .55rem .7rem;
  background: var(--bg); border: 1px solid #353a46; border-radius: 8px;
  color: var(--text); font: inherit;
}
form textarea { resize: vertical; }
.sub-form { padding: 1rem; background: var(--surface-2); border-radius: 10px; margin-top: .75rem; }
.admin-list { list-style: none; padding: 0; }
.admin-list > li { border-top: 1px solid #2a2e38; padding: .6rem 0; }
details summary { cursor: pointer; padding: .4rem 0; }
fieldset { border: 1px solid #353a46; border-radius: 8px; margin: .6rem 0; }
.check { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; font-weight: 400; }
.thumb { max-width: 120px; border-radius: 8px; display: block; margin: .4rem 0; }
.login form { max-width: 320px; margin: 1rem auto 0; }
.error { color: var(--danger); }

/* Apparence (admin) */
.couleurs-grille {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem; margin: .75rem 0 1.25rem;
}
.couleurs-grille label { margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.couleurs-grille input[type=color] {
  width: 100%; height: 38px; padding: 2px;
  background: var(--bg); border: 1px solid #353a46; border-radius: 8px; cursor: pointer;
}
.apercu-titre { font-weight: 600; margin: 1.25rem 0 .4rem; }
.apercu-carte {
  border: 1px solid #353a46; border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.25rem; transition: background .15s, color .15s;
}

/* Footer */
.site-footer { text-align: center; padding: 2rem 1rem; color: var(--muted); border-top: 1px solid #2a2e38; }

@media (max-width: 540px) {
  .evt-photo, .evt-mini img { width: 100%; height: 180px; }
}

/* ===================== PLANNING ===================== */
.planning-head { margin-bottom: 1.5rem; }
.planning-jour { margin-bottom: 2.5rem; }
.jour-titre { text-transform: capitalize; border-bottom: 1px solid #2a2e38; padding-bottom: .5rem; }

/* --- Grille desktop --- */
.grille {
  display: grid;
  grid-template-columns: 56px repeat(var(--scenes), 1fr);
  gap: 0;
}
.grille-coin { }
.grille-scene-titre {
  text-align: center; font-weight: 700; padding: .5rem .25rem;
  background: var(--surface-2); border: 1px solid #2a2e38; border-bottom: none;
  border-radius: 8px 8px 0 0; font-size: .9rem;
}
.grille-scene-titre + .grille-scene-titre { margin-left: 2px; }

/* corps : hauteur = (maxH - minH) px, 1 min = 1px */
.grille-corps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 56px repeat(var(--scenes), 1fr);
  position: relative;
  height: calc((var(--maxH) - var(--minH)) * 1px);
}
.grille-heures { position: relative; }
.heure-repere {
  position: absolute; left: 0; right: 0;
  top: calc((var(--t) - var(--minH)) * 1px);
  border-top: 1px dashed #2a2e38;
  font-size: .7rem; color: var(--muted);
}
.heure-repere span { position: absolute; top: -.6em; left: 2px; background: var(--bg); padding-right: 3px; }

.grille-colonne {
  grid-column: calc(var(--col) + 1);
  position: relative;
  border-left: 1px solid #2a2e38;
}
/* lignes horizontales de fond dans chaque colonne */
.grille-colonne::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, #2a2e3855 59px, #2a2e3855 60px);
  pointer-events: none;
}
.creneau {
  position: absolute; left: 3px; right: 3px;
  top: calc((var(--start) - var(--minH)) * 1px);
  height: calc((var(--end) - var(--start)) * 1px);
  background: var(--primary); color: #fff;
  border-radius: 8px; padding: .3rem .5rem; overflow: hidden;
  display: flex; flex-direction: column; gap: .1rem;
  box-shadow: 0 2px 6px #0006;
}
.creneau-heure { font-size: .7rem; opacity: .85; }
.creneau-groupe { font-weight: 700; font-size: .85rem; color: #fff; text-decoration: none; line-height: 1.15; }
a.creneau-groupe:hover { text-decoration: underline; }

/* --- Liste mobile --- */
.planning-liste { display: none; list-style: none; padding: 0; margin: 0; }
.pl-item {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: .8rem 0; border-bottom: 1px solid #2a2e38;
}
.pl-heure { min-width: 52px; font-weight: 700; color: var(--primary); font-size: .9rem; }
.pl-fin { color: var(--muted); font-weight: 400; font-size: .8rem; }
.pl-info { display: flex; flex-direction: column; gap: .15rem; }
.pl-groupe { font-weight: 700; text-decoration: none; }
a.pl-groupe:hover { text-decoration: underline; }
.pl-scene { font-size: .8rem; color: var(--muted); }

/* bascule grille <-> liste */
@media (max-width: 720px) {
  .grille { display: none; }
  .planning-liste { display: block; }
}

/* lien planning sur la liste événements */
.btn-planning { background: var(--surface-2); border-color: #4a5160; }

/* Éditeur de créneaux (admin) */
.creneau-row {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  margin-bottom: .5rem; padding: .5rem; background: var(--bg); border-radius: 8px;
}
.creneau-row select, .creneau-row input {
  margin: 0; flex: 1; min-width: 90px;
}
.creneau-row select { min-width: 130px; }
.add-creneau { margin-top: .3rem; }

/* ===================== FOND ANIMÉ (métal + chauves-souris) ===================== */
body { background: var(--bg); }

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-metal {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(108, 92, 231, .14), transparent 65%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .028) 0px, rgba(255, 255, 255, .028) 1px, transparent 1px, transparent 5px),
    linear-gradient(160deg, #14161c 0%, #0b0c10 55%, #060708 100%);
  box-shadow: inset 0 0 18vw 4vw rgba(0, 0, 0, .5);
}

.bat-fly {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.bat {
  display: block;
  width: 42px;
  height: auto;
  fill: #454b5c;
  opacity: .5;
  filter: drop-shadow(0 0 5px rgba(108, 92, 231, .25));
  animation: bat-flap .5s ease-in-out infinite;
}

@keyframes bat-flap {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(.7); }
}

@keyframes bat-fly-1 { 0% { transform: translate(-10vw, 78vh); } 100% { transform: translate(115vw, 8vh); } }
@keyframes bat-fly-2 { 0% { transform: translate(-12vw, 15vh); } 100% { transform: translate(118vw, 65vh); } }
@keyframes bat-fly-3 { 0% { transform: translate(-8vw, 45vh); } 100% { transform: translate(112vw, 25vh); } }
@keyframes bat-fly-4 { 0% { transform: translate(-14vw, 60vh); } 100% { transform: translate(120vw, 90vh); } }
@keyframes bat-fly-5 { 0% { transform: translate(-9vw, 5vh); } 100% { transform: translate(114vw, 40vh); } }
@keyframes bat-fly-6 { 0% { transform: translate(-11vw, 88vh); } 100% { transform: translate(116vw, 50vh); } }

.bat-fly-1 { animation: bat-fly-1 26s linear infinite; }
.bat-fly-2 { animation: bat-fly-2 33s linear infinite; animation-delay: -9s; }
.bat-fly-3 { animation: bat-fly-3 21s linear infinite; animation-delay: -4s; }
.bat-fly-3 .bat { width: 28px; opacity: .35; }
.bat-fly-4 { animation: bat-fly-4 38s linear infinite; animation-delay: -16s; }
.bat-fly-4 .bat { width: 52px; opacity: .4; }
.bat-fly-5 { animation: bat-fly-5 29s linear infinite; animation-delay: -22s; }
.bat-fly-5 .bat { width: 24px; opacity: .3; }
.bat-fly-6 { animation: bat-fly-6 24s linear infinite; animation-delay: -12s; }
.bat-fly-6 .bat { width: 34px; opacity: .45; }

@media (max-width: 700px) {
  .bat-fly-5, .bat-fly-6 { display: none; }
  .bat { width: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .bat-fly { display: none; }
}
