/* ==========================================================================
   SELACV – Événements & Réservations : onglet Analyse (V1.2.0)
   Mêmes couleurs que le reste du site (prune, rose, corail) et couleurs des campus.
   ========================================================================== */

/* Filtres ------------------------------------------------------------------ */
.an-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.an-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #ffffffc9; box-shadow: var(--card-shadow); }
.an-seg button,
.an-campus-filter button {
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  background: transparent;
  color: var(--label);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.an-seg button:hover,
.an-campus-filter button:hover { background: var(--soft); }
.an-seg button.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 14px #a737633d; }
.an-campus-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.an-campus-filter button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; }
.an-campus-filter button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); }
.an-campus-filter button.active { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 16%, #fff); color: var(--ink); transform: translateY(-1px); }

/* Bandeau ------------------------------------------------------------------ */
.an-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 22px 26px;
  border-radius: 18px;
  background: linear-gradient(120deg, #662143 0%, #a73763 48%, #df7956 100%);
  color: #fff;
  box-shadow: 0 18px 40px #7a294b40;
}
.an-hero::before,
.an-hero::after { content: ""; position: absolute; border-radius: 50%; background: #ffffff1a; pointer-events: none; }
.an-hero::before { width: 260px; height: 260px; right: -60px; top: -120px; }
.an-hero::after { width: 160px; height: 160px; right: 180px; bottom: -110px; }
.an-hero-text { position: relative; z-index: 1; max-width: 860px; }
.an-eyebrow { margin: 0 0 6px; color: #ffe2d6; font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.an-hero h3 { margin: 0 0 8px; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.15; }
.an-hero p { margin: 0; color: #fff3ee; font-size: 14px; line-height: 1.55; }
.an-hero b { color: #fff; }
/* V1.2.3 : nombre d’événements annulés, exclus des statistiques */
.an-hero p.an-hero-cancelled { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 999px; background: #ffffff26; font-size: 13px; font-weight: 700; }
.an-hero-badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  flex: none;
  width: 118px;
  height: 118px;
  border: 3px solid #ffffff73;
  border-radius: 50%;
  background: #ffffff21;
  text-align: center;
  backdrop-filter: blur(4px);
}
.an-hero-badge span { display: block; font-size: 30px; font-weight: 900; line-height: 1; }
.an-hero-badge small { display: block; margin-top: 4px; color: #ffe8de; font-size: 11px; font-weight: 800; line-height: 1.2; }

/* Chiffres clés ------------------------------------------------------------ */
.an-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.an-kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px;
  border: 1px solid #ffffffa8;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff, #fff4f7);
  box-shadow: var(--card-shadow);
  transition: transform .2s, box-shadow .2s;
}
.an-kpi:hover { transform: translateY(-3px); box-shadow: 0 16px 34px #772b4b26; }
.an-kpi::after { content: ""; position: absolute; inset: auto 0 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.an-kpi.is-ok::after { background: linear-gradient(90deg, #2f9a60, #7fcf9c); }
.an-kpi.is-wait::after { background: linear-gradient(90deg, #d99000, #ffd166); }
.an-kpi.is-off::after { background: linear-gradient(90deg, #b4233c, #ef8a8a); }
.an-kpi-icon { position: absolute; top: 12px; right: 12px; font-size: 22px; opacity: .9; }
.an-kpi b { display: block; color: var(--accent); font-size: 30px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.an-kpi.is-ok b { color: #2f8a57; }
.an-kpi.is-wait b { color: #b97800; }
.an-kpi.is-off b { color: #b4233c; }
.an-kpi h3 { margin: 6px 0 3px; color: var(--heading); font-size: 13px; }
.an-kpi p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.35; }

/* Grille des cartes -------------------------------------------------------- */
.an-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.an-wide { grid-column: span 2; }
.an-trophies-card,
.an-full { grid-column: 1 / -1; }
.an-h-hint { margin-left: auto; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.an-mini-title { margin: 14px 0 0 !important; color: var(--label) !important; font-size: 11px !important; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.an-mini-title + .an-chips { margin-top: 8px; }
.an-card h3 { display: flex; align-items: center; gap: 8px; }
.an-card h3 span { font-size: 18px; }
.an-sub { margin-top: 18px !important; font-size: 14px !important; }
.an-note { margin: 12px 0 0 !important; padding: 9px 12px; border-radius: 10px; background: var(--soft); color: var(--label) !important; font-size: 12.5px !important; line-height: 1.45 !important; }
.an-note:empty { display: none; }
.an-note b { color: var(--title); }
.an-empty { margin: 8px 0 0; padding: 18px; border: 1px dashed var(--field-border); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* Colonnes mensuelles empilées par campus */
.an-columns { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; align-items: end; height: 230px; padding-top: 8px; }
.an-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-width: 0; text-align: center; }
.an-col-value { min-height: 18px; color: var(--title); font-size: 12px; font-weight: 900; white-space: nowrap; }
.an-col-bar { display: flex; flex-direction: column-reverse; justify-content: flex-start; overflow: hidden; border-radius: 8px 8px 3px 3px; background: #f9e7ee; }
.an-col-bar i { display: block; width: 100%; transform-origin: bottom; }
.an-col-bar i + i { box-shadow: 0 -1px 0 #ffffffb3; }
.an-col.is-record .an-col-bar { outline: 2px solid #e2b500; outline-offset: 2px; }
.an-col-label { padding-top: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.an-col-label small { display: block; color: var(--accent); font-size: 10px; }
.an-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--label); font-size: 12px; font-weight: 700; }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-legend i { width: 11px; height: 11px; border-radius: 3px; }

/* Anneau */
.an-donut-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center; }
.an-donut { width: 150px; height: 150px; }
.an-donut circle { transition: stroke-width .2s; cursor: default; }
.an-donut circle:hover { stroke-width: 26; }
.an-donut-num { fill: var(--title); font-size: 26px; font-weight: 900; }
.an-donut-lbl { fill: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.an-donut-legend { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.an-donut-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 12.5px; }
.an-donut-legend i { width: 12px; height: 12px; border-radius: 4px; }
.an-donut-legend span { overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.an-donut-legend b { color: var(--title); }
.an-donut-legend small { min-width: 24px; color: var(--muted); text-align: right; }

/* Barre empilée et pastilles */
.an-stack { display: flex; overflow: hidden; height: 16px; border-radius: 999px; background: #f5dde5; }
.an-stack i { display: block; min-width: 4px; }
.an-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-top: 12px; }
.an-pill { display: grid; gap: 2px; padding: 10px; border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, #fff); text-align: center; }
.an-pill span { font-size: 20px; }
.an-pill b { color: var(--c); font-size: 20px; }
.an-pill small { color: var(--label); font-size: 11.5px; font-weight: 700; }

/* Barres horizontales */
.an-hbars { display: grid; gap: 9px; }
.an-hbar { display: grid; grid-template-columns: minmax(110px, 42%) minmax(0, 1fr) 30px; gap: 10px; align-items: center; font-size: 12.5px; }
.an-hbar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.an-hbar-label em { flex: none; width: 22px; font-style: normal; text-align: center; }
.an-hbar-label em small { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #f5dde5; color: var(--label); font-size: 10px; font-weight: 900; }
.an-hbar-label > small { margin-left: 4px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.an-hbar-track { height: 12px; overflow: hidden; border-radius: 999px; background: #f7e4eb; }
.an-hbar-track i { display: block; width: var(--w); height: 100%; border-radius: inherit; transform-origin: left; }
.an-hbar b { color: var(--title); text-align: right; font-variant-numeric: tabular-nums; }

/* Carte de chaleur jours × créneaux */
.an-heat { display: grid; grid-template-columns: 44px repeat(3, minmax(0, 1fr)); gap: 5px; }
.an-heat-head { color: var(--label); font-size: 11.5px; font-weight: 900; text-align: center; }
.an-heat-head small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; }
.an-heat-day { align-self: center; color: var(--label); font-size: 12px; font-weight: 800; }
.an-heat-day.is-best { color: var(--accent); }
.an-heat-day.is-best::after { content: " ★"; color: #e2b500; }
.an-heat-cell {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 8px;
  background: color-mix(in srgb, #a73763 calc(var(--a) * 100%), #fbeef2);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 2px #0003;
  transition: transform .15s;
}
.an-heat-cell:hover { transform: scale(1.08); }

/* Entonnoir de validation */
.an-funnel { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.an-funnel li { display: grid; grid-template-columns: minmax(0, 1fr) 34px 42px; gap: 8px; align-items: center; }
.an-funnel-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: var(--w);
  min-height: 34px;
  padding: 0 10px;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(90deg, #a73763, #df7956);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transform-origin: left;
}
.an-funnel li:last-child .an-funnel-bar { background: linear-gradient(90deg, #2f9a60, #7fcf9c); }
.an-funnel-bar em { font-style: normal; }
.an-funnel b { color: var(--title); font-size: 15px; text-align: right; }
.an-funnel small { color: var(--muted); font-size: 11px; font-weight: 800; }
.an-funnel-off { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.an-funnel-off span { padding: 6px 10px; border-radius: 999px; background: #fdecee; color: #9b2335; font-size: 12px; font-weight: 800; }

/* Marches de tailles */
.an-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: end; }
.an-step { display: grid; gap: 3px; justify-items: center; text-align: center; }
.an-step-value { color: var(--title); font-size: 14px; font-weight: 900; }
.an-step-bar { display: flex; align-items: flex-end; width: 100%; height: 110px; overflow: hidden; border-radius: 9px 9px 4px 4px; background: #f9e7ee; }
.an-step-bar i { display: block; width: 100%; height: var(--h); border-radius: inherit; background: linear-gradient(180deg, #df7956, #a73763); transform-origin: bottom; }
.an-step-icon { margin-top: 4px; font-size: 20px; }
.an-step b { color: var(--ink); font-size: 11.5px; }
.an-step small { color: var(--muted); font-size: 10px; }

/* Anneaux de pourcentage */
.an-rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.an-ring { display: grid; justify-items: center; gap: 8px; text-align: center; }
.an-ring > div {
  display: grid;
  place-items: center;
  align-content: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff 72%, transparent 73% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), #f5dde5 0);
}
.an-ring span { font-size: 20px; line-height: 1; }
.an-ring b { color: var(--title); font-size: 16px; }
.an-ring small { color: var(--label); font-size: 11.5px; font-weight: 700; line-height: 1.3; }
.an-ring em { color: var(--muted); font-style: normal; }

/* Délai */
.an-lead-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.an-lead-head b { color: var(--accent); font-size: 36px; font-weight: 900; line-height: 1; }
.an-lead-head span { color: var(--label); font-size: 12px; font-weight: 700; line-height: 1.35; }

/* Tuiles d'équipement */
.an-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.an-tile {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 14px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.an-tile:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 12px 24px #772b4b1f; }
.an-tile span { font-size: 28px; }
.an-tile b { color: var(--accent); font-size: 22px; font-weight: 900; }
.an-tile small { color: var(--label); font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.an-tile.is-top { border-color: #e2b500; background: linear-gradient(160deg, #fffbea, #fff); }
.an-tile.is-top::before { content: "★ N°1"; color: #b28d00; font-size: 10px; font-weight: 900; letter-spacing: .06em; }

/* Pastilles de comptage */
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.an-chips span { padding: 6px 10px; border-radius: 999px; background: var(--soft); color: var(--label); font-size: 12px; font-weight: 700; }
.an-chips b { color: var(--accent); }

/* Palmarès */
.an-trophies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.an-trophy {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 16px 16px 14px 62px;
  border: 1px solid #f3d9a8;
  border-radius: 14px;
  background: linear-gradient(150deg, #fffaf0, #fff4f7);
  transition: transform .2s;
}
.an-trophy:hover { transform: translateY(-3px); }
.an-trophy > span {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 14px #a7376326;
  font-size: 20px;
}
.an-trophy h4 { margin: 0; color: var(--label); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.an-trophy b { overflow: hidden; color: var(--title); font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.an-trophy small { color: var(--muted); font-size: 12px; }

/* Animations d'apparition (rejouées à chaque ouverture de l'onglet) -------- */
@keyframes anRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes anGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes anGrowY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes anDraw { from { stroke-dasharray: 0 400; } }
.an-play .an-kpi,
.an-play .an-card,
.an-play .an-hero { animation: anRise .5s cubic-bezier(.2, .8, .2, 1) both; }
.an-play .an-kpi:nth-child(2) { animation-delay: .05s; }
.an-play .an-kpi:nth-child(3) { animation-delay: .1s; }
.an-play .an-kpi:nth-child(4) { animation-delay: .15s; }
.an-play .an-kpi:nth-child(5) { animation-delay: .2s; }
.an-play .an-kpi:nth-child(6) { animation-delay: .25s; }
.an-play .an-hbar-track i,
.an-play .an-funnel-bar { animation: anGrowX .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.15s + var(--d, 0ms)); }
.an-play .an-col-bar i,
.an-play .an-step-bar i { animation: anGrowY .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.15s + var(--d, 0ms)); }
.an-play .an-tile,
.an-play .an-trophy { animation: anRise .45s ease both; animation-delay: calc(.2s + var(--d, 0ms)); }
.an-play .an-arc { animation: anDraw 1s ease both; animation-delay: calc(.1s + var(--d, 0ms)); }
@media (prefers-reduced-motion: reduce) {
  .an-play * { animation: none !important; }
}

/* Adaptations -------------------------------------------------------------- */
@media (max-width: 1350px) {
  .an-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .an-trophies { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-wide { grid-column: 1 / -1; }
  .an-trophies { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .an-grid, .an-trophies { grid-template-columns: 1fr; }
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-hero { flex-direction: column; align-items: flex-start; padding: 18px; }
  .an-hero-badge { width: 96px; height: 96px; }
  .an-columns { gap: 4px; height: 190px; }
  .an-col-value { font-size: 10px; }
  .an-col-label { font-size: 9.5px; }
  .an-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .an-steps { gap: 4px; }
  .an-step small { display: none; }
}
