:root {
  --bg: #0b0730;
  --ink: #17123f;          /* texte sur papier (tickets) */
  --light: #f4f1ff;        /* texte sur fond sombre */
  --muted: #5b5784;
  --muted-light: #bdb8e6;
  --blue: #0b2a8c;
  --blue-dark: #081f69;
  --gold: #ffc21a;
  --gold-dark: #e8a600;
  --neon: #19f06a;
  --red: #d4153a;
  --green: #0e7a4b;
  --amber: #b45309;
  --paper: #ffffff;
  --glass: rgba(14, 9, 54, .78);
  --line: #cfc9ec;
  --line-light: rgba(255, 255, 255, .2);
  --radius: 14px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Public Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--light);
  font: 16px/1.5 var(--body);
  min-height: 100vh;
}
/* Image de l'événement en arrière-plan (fixe, assombrie pour la lisibilité) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 7, 48, .72) 0%, rgba(11, 7, 48, .86) 55%, rgba(11, 7, 48, .95) 100%),
    url("/img/event-bg.jpg") center top / cover no-repeat;
}
h1, h2, h3 { color: var(--light); font-family: var(--display); line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 .5rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* --- En-tête ------------------------------------------------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 7, 48, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--neon), var(--gold), #7a3cff) 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .25rem;
  padding: .5rem 1rem;
}
.brand { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; margin: 0 auto; }
.brand img { display: block; height: 52px; width: auto; }
.top nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }
.tab {
  font: 600 .95rem var(--body);
  color: #dfe6ff;
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: .5rem .9rem;
  min-height: 40px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.tab:hover { background: rgba(255, 255, 255, .12); }
.tab[aria-current="page"] { background: var(--gold); color: #1b1240; }
.tab.quiet { color: var(--muted-light); }

.wrap { max-width: 880px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.who { color: var(--muted-light); font-size: .9rem; margin-bottom: 1rem; }
.section { margin-top: 2.5rem; }

/* --- Formulaires --------------------------------------------------- */
label { color: inherit; display: block; font-weight: 600; font-size: .95rem; margin: 1rem 0 .3rem; }
input, select {
  width: 100%;
  min-height: 48px;
  font: 1rem var(--body);
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: .6rem .8rem;
}
input:focus, select:focus { border-color: var(--gold-dark); }
.btn {
  font: 700 1rem var(--body);
  min-height: 48px;
  padding: .6rem 1.2rem;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: var(--gold);
  color: #1b1240;
  cursor: pointer;
}
.btn:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.ghost:hover { background: rgba(255, 194, 26, .16); }
.btn.wide { width: 100%; margin-top: 1.25rem; }
.link {
  background: none; border: 0; padding: .6rem 0; min-height: 44px;
  color: var(--gold); font: 600 .95rem var(--body); text-decoration: underline; cursor: pointer;
}
.error { color: #ff6b86; font-weight: 600; min-height: 1.5em; margin-top: .75rem; }
.row { display: flex; gap: .75rem; align-items: stretch; flex-wrap: wrap; }
.row > input { flex: 1 1 200px; width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* --- Ticket (élément principal) ----------------------------------- */
.ticket {
  --stub: 210px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--stub);
  background: var(--paper);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .7);
  margin-bottom: 1.25rem;
}
.ticket-main {
  padding: 1.25rem 1.5rem;
  border-right: 2px dashed var(--line);
  border-left: 8px solid var(--gold);
  border-radius: var(--radius) 0 0 var(--radius);
}
.ticket-main p { color: var(--muted); }
.ticket h1, .ticket h2, .ticket h3 { color: var(--ink); }
.ticket-ref { font: 600 .85rem ui-monospace, Menlo, monospace; color: var(--muted); margin-top: .75rem; }
.ticket-stub {
  position: relative;
  padding: 1rem;
  display: grid;
  place-items: center;
  text-align: center;
  gap: .4rem;
}
/* Encoches de perforation */
.ticket-stub::before, .ticket-stub::after {
  content: "";
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #0f0a3a;
  left: -13px;
}
.ticket-stub::before { top: -12px; }
.ticket-stub::after { bottom: -12px; }
.qr { width: 100%; max-width: 180px; height: auto; image-rendering: pixelated; }
.hint { font-size: .8rem; color: var(--muted); }

.ticket.used .ticket-main { border-left-color: var(--line); }
.ticket.used .ticket-main > * { opacity: .55; }
.stamp {
  font: 800 1.15rem var(--display);
  color: var(--red);
  border: 3px solid var(--red);
  border-radius: 8px;
  padding: .35rem .7rem;
  transform: rotate(-7deg);
}

@media (max-width: 560px) {
  .ticket { grid-template-columns: 1fr; }
  .ticket-main { border-right: 0; border-bottom: 2px dashed var(--line); border-radius: var(--radius) var(--radius) 0 0; }
  .ticket-stub::before { top: -12px; left: -12px; }
  .ticket-stub::after { top: -12px; bottom: auto; left: auto; right: -12px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* --- Événements ---------------------------------------------------- */
.event {
  background: var(--glass);
  border: 1px solid var(--line-light);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, .8);
}
.event-info { flex: 1 1 260px; }
.event-info p { color: var(--muted-light); }
.event-buy { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.event-buy select { width: 5rem; }
.price { font: 800 1.3rem var(--display); color: var(--gold); }
.left { font-size: .9rem; color: var(--muted-light); }
.left.low { color: #ff8da1; font-weight: 600; }
.empty { background: var(--glass); border: 1px solid var(--line-light); border-radius: var(--radius); padding: 2rem 1.5rem; text-align: center; }

/* --- Connexion ------------------------------------------------------ */
.auth-ticket { --stub: 280px; margin-top: 1rem; }
.auth-ticket .ticket-stub { text-align: left; place-items: start; align-content: center; padding: 1.5rem; }
.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin-bottom: .6rem; }

/* --- Contrôle d'entrée (admin) -------------------------------------- */
.result {
  margin-top: 1.25rem;
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  text-align: center;
}
.result strong { display: block; font: 800 clamp(1.6rem, 6vw, 2.2rem) var(--display); }
.result p { color: rgba(255, 255, 255, .92); margin-top: .35rem; }
.result.ok { background: var(--green); }
.result.bad { background: var(--red); }
.result.warn { background: var(--amber); }
#reader { margin-top: 1rem; border-radius: var(--radius); overflow: hidden; background: #000; }
.admin-event {
  background: var(--glass);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .75rem 1.5rem;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.8);
}
.admin-event.closed { opacity: .6; }
.stats { display: flex; gap: 1.25rem; color: var(--muted-light); font-size: .95rem; }
.stats b { color: var(--light); }

/* --- Notification ---------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%; bottom: 1.25rem;
  transform: translateX(-50%);
  background: #1b1240;
  border: 1px solid var(--gold);
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  max-width: calc(100% - 2rem);
  z-index: 10;
}
.toast.error { background: var(--red); border-color: var(--red); }

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

/* --- Paiements ------------------------------------------------------ */
.event-buy select { width: auto; min-width: 5rem; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.badge {
  display: inline-block;
  font: 700 .8rem var(--body);
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #dbe3fb;
  color: var(--blue);
}
.badge.paid { background: #d3f0e1; color: var(--green); }
.badge.refund_needed, .badge.failed { background: #fbdce2; color: var(--red); }
.badge.cancelled, .badge.expired { background: #e4e7ef; color: var(--muted); }
.verify { display: flex; gap: .5rem; flex: 1 1 100%; }
.verify input { flex: 1; min-height: 40px; }
.verify .btn { min-height: 40px; padding: .3rem .9rem; }
.note { flex: 1 1 100%; color: #ff8da1; font-weight: 600; font-size: .9rem; margin: 0; }

/* --- Affiche : DJ confirmés ---------------------------------------- */
.hero { margin: .5rem 0 2rem; }
.hero-title { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; margin-bottom: 1rem; }
.hero-title h1 {
  margin: 0;
  color: var(--gold);
  text-shadow: 0 3px 0 #b36a00, 0 8px 24px rgba(0, 0, 0, .5);
  font-size: clamp(2rem, 8vw, 3.4rem);
}
.hero-title p { margin: 0; color: var(--neon); font-weight: 700; white-space: nowrap; }
.hero-date { font-size: 1.15rem; }
.hero-venue { font-size: 1.05rem; }
.lineup {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lineup img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line-light);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .8);
}
@media (max-width: 640px) {
  .lineup {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 72%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: .5rem;
  }
  .lineup li { scroll-snap-align: center; }
}
.auth-logo { display: block; width: min(260px, 70%); height: auto; margin: 0 auto 1rem; }

.otp-input { font: 700 1.8rem var(--display); letter-spacing: .5em; text-align: center; }

#reader video { display: block; width: 100%; border-radius: 12px; }

/* Remplace les style="" en ligne (bloqués par le CSP) */
.mt1 { margin-top: 1rem; }
.mt125 { margin-top: 1.25rem; }
.mt15 { margin-top: 1.5rem; }
.row.between { justify-content: space-between; align-items: center; }

/* --- Choix MonCash / NatCash (logos) --- */
.pay-opts { display: flex; gap: .6rem; flex-wrap: wrap; }
.pay-opt {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: .35rem .7rem; background: #fff; color: #111;
  border: 2px solid transparent; border-radius: 12px; cursor: pointer;
}
.pay-opt img { height: 100%; width: auto; max-width: 96px; object-fit: contain; display: block; }
.pay-opt[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.pay-opt[aria-pressed="false"] { opacity: .85; }

/* --- Bilan (admin) --- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-top: 1rem; }
.tile {
  display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem;
  background: var(--glass); border: 1px solid var(--line-light); border-radius: var(--radius);
}
.tile strong { font: 800 1.35rem var(--display); color: var(--gold); }
.tile-label { font-size: .9rem; font-weight: 600; }
.tile-note { font-size: .8rem; color: var(--muted-light); }

/* Texte d'aide lisible sur les fonds sombres */
.event .hint, .admin-event .hint, .section .hint { color: var(--muted-light); }

/* L'attribut hidden doit toujours cacher (même un .btn) */
[hidden] { display: none !important; }
