:root {
  --violet: #a335ee;
  --violet-soft: #c77dff;
  --bg: #0e0b16;
  --bg2: #17111f;
  --panel: #1b1526;
  --text: #ece8f4;
  --muted: #9a93ac;
  --line: rgba(163, 53, 238, .18);

  /* Rôles (couleurs WoW-ish) */
  --tank: #4a90e2;
  --melee: #e0603a;
  --ranged: #b06fe0;
  --healer: #38c172;

  /* FullCalendar dark overrides */
  --fc-border-color: var(--line);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255, 255, 255, .02);
  --fc-today-bg-color: rgba(163, 53, 238, .10);
  --fc-list-event-hover-bg-color: rgba(163, 53, 238, .12);
  --fc-neutral-text-color: var(--muted);
  --fc-button-text-color: #fff;
  --fc-button-bg-color: #241b34;
  --fc-button-border-color: #3a2d55;
  --fc-button-hover-bg-color: #322547;
  --fc-button-hover-border-color: #4a3a6b;
  --fc-button-active-bg-color: var(--violet);
  --fc-button-active-border-color: var(--violet);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -15%, rgba(163, 53, 238, .22), transparent 60%),
    var(--bg);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }

header.top {
  display: flex; align-items: center; gap: .8rem;
  margin-bottom: 1.4rem;
}
header.top .logo { font-size: 1.9rem; filter: drop-shadow(0 0 10px rgba(163, 53, 238, .55)); }
header.top h1 {
  font-size: 1.4rem; margin: 0; letter-spacing: .3px;
  background: linear-gradient(90deg, var(--violet-soft), #fff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
header.top .sub { color: var(--muted); font-size: .85rem; margin-left: auto; }

/* Calendrier */
#calendar {
  background: linear-gradient(180deg, rgba(27, 21, 38, .7), rgba(14, 11, 22, .7));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.fc { --fc-event-border-color: transparent; }
.fc a { color: inherit; }
.fc .fc-toolbar-title { color: var(--text); text-transform: capitalize; }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number { color: var(--muted); text-decoration: none; }
.fc .fc-daygrid-day.fc-day-today { border-radius: 8px; }
.fc-event { cursor: pointer; border: none; padding: 1px 4px; font-size: .78rem; }
.fc-event .fc-event-title { font-weight: 600; }
.fc-daygrid-event-dot { display: none; }

/* Pastilles de difficulté sur l'event */
.ev-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* Panneau détail (modal) */
.overlay {
  position: fixed; inset: 0; background: rgba(4, 2, 8, .65);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem; z-index: 50; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 640px;
  background: linear-gradient(180deg, var(--panel), #120d1b);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  overflow: hidden;
  animation: rise .18s ease;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal .bar { height: 5px; background: var(--violet); }
.modal .body { padding: 1.4rem 1.5rem 1.7rem; }
.modal h2 { margin: 0 0 .2rem; font-size: 1.3rem; }
.modal .meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .5rem 0 .2rem; }
.modal .desc { color: var(--text); margin: .8rem 0 0; opacity: .9; }
.modal .close {
  position: absolute; top: 4vh; right: 1rem; /* fallback */
}
.modal .head { display: flex; align-items: flex-start; gap: 1rem; }
.modal .head .x {
  margin-left: auto; cursor: pointer; color: var(--muted);
  font-size: 1.4rem; line-height: 1; background: none; border: none;
}
.modal .head .x:hover { color: var(--text); }

.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1.1rem; }
@media (max-width: 560px) { .roles { grid-template-columns: repeat(2, 1fr); } }
.role h3 { margin: 0 0 .4rem; font-size: .85rem; letter-spacing: .3px; }
.role.tank h3 { color: var(--tank); }
.role.melee h3 { color: var(--melee); }
.role.ranged h3 { color: var(--ranged); }
.role.healer h3 { color: var(--healer); }
.role ul { list-style: none; margin: 0; padding: 0; }
.role li { font-size: .82rem; padding: 2px 0; color: var(--text); border-left: 2px solid transparent; padding-left: 6px; }
.role li .spec { color: var(--muted); font-size: .74rem; }
.role .empty { color: #574f66; font-size: .8rem; }

.secondary { margin-top: 1.1rem; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: .25rem; }
.secondary b { color: var(--text); font-weight: 600; }

.badge { display: inline-block; font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--violet-soft); }

.empty-state { text-align: center; color: var(--muted); padding: 3rem 1rem; }
footer.foot { text-align: center; color: #574f66; font-size: .8rem; margin-top: 2rem; }

/* --- Contenu d'un événement --- */
.fc-daygrid-event { padding: 1px 5px; }
.ev-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.ev-time { font-weight: 700; color: var(--violet-soft); font-size: .72rem; flex: 0 0 auto; }

/* Mois : heure en haut à gauche, titre centré */
.fc-daygrid-event { padding: 0; }
.ev-compact { position: relative; text-align: center; padding: 14px 3px 3px; line-height: 1.2; overflow: hidden; }
.ev-compact .ev-time {
  position: absolute; top: 2px; left: 4px;
  font-size: .68rem; font-weight: 700; color: var(--violet-soft);
}
.ev-mtitle {
  font-size: .82rem; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Liste : titre + compteurs */
.ev-list { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .6rem; }
.ev-list .ev-name { font-weight: 600; }
.ev-counts { font-size: .74rem; opacity: .85; letter-spacing: .3px; }

/* Liste : "Mercredi 15 juillet 2026" (1re lettre en majuscule) */
.fc-list-day-text::first-letter { text-transform: uppercase; }

/* --- Icônes de spec + noms colorés --- */
.role li { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.spec-ico { width: 16px; height: 16px; vertical-align: middle; margin-right: 4px; border-radius: 3px; flex: 0 0 auto; }
.pname { font-weight: 600; }

/* --- Bouton "Voir sur Discord" --- */
.dlink {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-top: 1.3rem; padding: .55rem 1rem;
  background: #5865f2; color: #fff; text-decoration: none;
  border-radius: 10px; font-size: .85rem; font-weight: 600;
  transition: background .15s;
}
.dlink:hover { background: #4752c4; }

/* --- Bouton Gestion (en-tête) --- */
.btn-gestion {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .95rem;
  background: linear-gradient(135deg, var(--violet), #7b2fbf);
  color: #fff; text-decoration: none;
  border-radius: 10px; font-size: .85rem; font-weight: 600;
  box-shadow: 0 4px 14px rgba(163, 53, 238, .35);
  transition: transform .12s, box-shadow .12s;
}
.btn-gestion:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(163, 53, 238, .5); }
.btn-gestion.alt { background: #241b34; box-shadow: none; border: 1px solid var(--line); }
.btn-gestion.alt:hover { background: #322547; transform: none; }

/* --- Page gestion / login --- */
.login-card {
  max-width: 440px; margin: 3rem auto 0;
  background: linear-gradient(180deg, var(--panel), #120d1b);
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .5);
}
.login-card .bar { height: 5px; background: var(--violet); }
.login-body { padding: 2.2rem 2rem 2.4rem; text-align: center; }
.login-body .lock { font-size: 2.4rem; margin-bottom: .6rem; filter: drop-shadow(0 0 12px rgba(163, 53, 238, .5)); }
.login-body h2 { margin: 0 0 .6rem; font-size: 1.4rem; }
.login-body p { color: var(--muted); line-height: 1.6; }
.discord-btn {
  width: 100%; margin: 1.4rem 0 .6rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1rem; border: none; border-radius: 12px;
  background: #5865f2; color: #fff; font-size: .95rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.discord-btn:hover { background: #4752c4; }
.discord-btn[disabled] { cursor: not-allowed; opacity: .6; }
.discord-btn.logout { background: #3a2d55; }
.discord-btn.logout:hover { background: #4a3a6b; }
.login-error {
  background: rgba(237, 66, 69, .12); border: 1px solid rgba(237, 66, 69, .4);
  color: #ff9ba0; padding: .6rem .8rem; border-radius: 10px; font-size: .85rem; margin: .8rem 0 0;
}
.soon-note { color: var(--violet-soft); font-size: .85rem; margin: .4rem 0 0; }

/* --- Panel de gestion (connecté) --- */
.login-card.wide { max-width: 760px; }
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.3rem; font-size: .9rem; }
.logout-link { color: var(--muted); text-decoration: none; font-size: .82rem; }
.logout-link:hover { color: var(--text); }

.raid-form { text-align: left; display: flex; flex-direction: column; gap: .7rem; }
.frow { display: flex; gap: .6rem; }
.frow.two > * { flex: 1; min-width: 0; }
.raid-form input, .raid-form select, .raid-form textarea {
  width: 100%; padding: .6rem .7rem; border-radius: 10px;
  background: #120d1b; border: 1px solid var(--line); color: var(--text);
  font-size: .9rem; font-family: inherit;
}
.raid-form textarea { resize: vertical; }
.raid-form input:focus, .raid-form select:focus, .raid-form textarea:focus { outline: none; border-color: var(--violet); }
.frow.actions { justify-content: flex-start; }
.btn-primary { background: var(--violet); color: #fff; border: none; padding: .6rem 1.2rem; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: .9rem; }
.btn-primary:hover { background: #8f28d6; }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 10px; cursor: pointer; }
.btn-ghost:hover { color: var(--text); }
.form-msg { text-align: left; font-size: .85rem; margin: .7rem 0 0; min-height: 1.1em; }
.form-msg.ok { color: #5ef08a; }
.form-msg.err { color: #ff9ba0; }

.list-title { text-align: left; margin: 1.7rem 0 .7rem; font-size: 1rem; }
.raid-list { text-align: left; display: flex; flex-direction: column; gap: .45rem; }
.raid-row { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; background: #150f20; border: 1px solid var(--line); border-radius: 10px; }
.rr-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rr-when { color: var(--muted); font-size: .78rem; }
.rr-actions { display: flex; gap: .4rem; flex: 0 0 auto; }
.mini { font-size: .75rem; padding: .35rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: #241b34; color: var(--text); cursor: pointer; }
.mini.edit:hover { background: #322547; }
.mini.del { color: #ff9ba0; }
.mini.del:hover { background: rgba(237, 66, 69, .15); }
.raid-list .empty { color: #574f66; text-align: center; padding: 1rem; }

/* Séparateur du titre */
.sep { opacity: .45; margin: 0 .35rem; font-weight: 300; }

/* --- Mobile --- */
@media (max-width: 640px) {
  .wrap { padding: 1rem .7rem 3rem; }
  header.top { flex-wrap: nowrap; }
  header.top h1 { font-size: 1.05rem; flex: 1 1 auto; min-width: 0; }
  .t-full { display: none; }
  .t-short { display: inline; }
  .btn-gestion { padding: .45rem .7rem; font-size: .8rem; }
  #calendar { padding: .5rem; }
  .fc .fc-toolbar.fc-header-toolbar { flex-direction: column; gap: .5rem; margin-bottom: .8rem; }
  .fc .fc-toolbar-title { font-size: 1.05rem; }
  .modal .body { padding: 1.1rem 1.1rem 1.4rem; }
  .roles { gap: .6rem; }
  .login-card { margin-top: 1.5rem; }
}
