/* ── BRAND TOKENS ─────────────────────────── */
:root {
  --violette:   #6347B4;
  --lavande:    #9080E4;
  --renard:     #C76817;
  --eclair:     #ECC228;
  --encre:      #1A1220;
  --texte-2:    #52487A;
  --texte-3:    #8880AA;
  --fond:       #F7F3FF;
  --surface:    #FFFFFF;
  --divider:    rgba(99, 71, 180, 0.12);
  --f-display:  'Baloo 2', system-ui, sans-serif;
  --f-body:     'Nunito', system-ui, sans-serif;
  --sidebar-w:  220px;
}

/* ── SCROLLBAR ────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: rgba(99,71,180,0.35) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,71,180,0.35); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #6347B4; }
::-webkit-scrollbar-button { display: none; }

/* ── BASE ─────────────────────────────────── */
* { box-sizing: border-box; }

body {
  font-family: var(--f-body);
  background: var(--fond);
  color: var(--encre);
  margin: 0;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────── */
.ec-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--encre);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  border-right: 2px solid var(--eclair);
  /* Grand éclair semi-transparent en décoration de fond */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 160'%3E%3Cpath d='M80 0L40 80H65L50 160L100 72H72Z' fill='%23ECC228' opacity='0.05'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center 55%;
  background-size: 130px;
}

/* Zone logo */
.ec-sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  text-decoration: none;
}

.ec-sidebar-logo img {
  width: 140px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 12px rgba(236,194,40,0.25));
  transition: filter 0.2s;
}

.ec-sidebar-logo:hover img {
  filter: drop-shadow(0 4px 20px rgba(236,194,40,0.45));
}

/* Navigation */
.ec-sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

/* Label de section */
.ec-sidebar-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(236,194,40,0.4);
  padding: 8px 12px 4px;
  display: block;
}

/* Lien de nav */
.ec-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 6px;
  position: relative;
  transition: color 0.15s, background 0.15s, font-weight 0s;
  white-space: nowrap;
}

.ec-sidebar-link:hover {
  color: white;
  background: rgba(255,255,255,0.06);
  font-weight: 800;
}

.ec-sidebar-link.active {
  color: white;
  background: rgba(255,255,255,0.06);
  font-weight: 700;
}

/* Barre indicatrice gauche — visible uniquement sur la page active */
.ec-sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--eclair);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.15s, transform 0.2s;
}

.ec-sidebar-link.active::before {
  opacity: 1;
  transform: scaleY(1);
}

/* Icône — conteneur pour la permutation SVG ↔ emoji */
.ec-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
}

.ec-link-icon svg {
  transition: opacity 0.12s;
}

/* Au survol uniquement : ⚡ remplace l'icône SVG */
.ec-sidebar-link:hover .ec-link-icon svg {
  opacity: 0;
}

.ec-link-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s;
}

.ec-sidebar-link:hover .ec-link-icon::after {
  content: '⚡';
  opacity: 1;
}

/* Lien Bureau (admin) — accent éclair */
.ec-sidebar-link--bureau {
  color: rgba(236,194,40,0.65);
}

.ec-sidebar-link--bureau:hover,
.ec-sidebar-link--bureau.active {
  color: var(--eclair);
  background: rgba(236,194,40,0.07);
}

/* Pied de sidebar */
.ec-sidebar-footer {
  padding: 14px 10px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* Bouton connexion */
.ec-sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: var(--violette);
  color: white;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s;
}

.ec-sidebar-btn:hover {
  background: #7A5CC8;
  color: white;
}

/* Bouton déconnexion */
.ec-sidebar-deco {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  color: rgba(255,255,255,0.35);
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ec-sidebar-deco:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.65);
}

/* ── PAGE CONTENT ─────────────────────────── */
.ec-page {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: var(--fond);
}

.ec-page main {
  flex: 1;
}

/* ── BANDEAU INSCRIPTION ─────────────────── */
@keyframes banner-blink {
  0%, 100% { border-color: #E53935; box-shadow: 0 -4px 20px rgba(229,57,53,0.3); }
  50%       { border-color: transparent; box-shadow: 0 -4px 20px rgba(229,57,53,0); }
}

.ec-banner-inscription {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 150;
  background: #FFF8F8;
  border-top: 3px solid #E53935;
  animation: banner-blink 1.2s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}

.ec-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.ec-banner-text {
  font-size: 14px;
  color: #3D1A1A;
  flex: 1;
}

.ec-banner-text strong {
  color: #B71C1C;
}

.ec-banner-btn {
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 18px;
  border-radius: 100px;
  background: #E53935;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ec-banner-btn:hover {
  background: #B71C1C;
  color: white;
}

.ec-banner-close {
  background: none;
  border: none;
  color: rgba(61,26,26,0.4);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
  transition: color 0.12s;
}

.ec-banner-close:hover {
  color: #3D1A1A;
}

/* Décale le contenu quand le bandeau est affiché */
.ec-page.has-banner {
  padding-bottom: 60px;
}

/* ── FOOTER ───────────────────────────────── */
.ec-footer {
  background: var(--encre);
  margin-top: 0;
}

.ec-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.ec-footer-brand {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18px;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ec-footer-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
}

/* ── CONTAINER ────────────────────────────── */
.ec-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── BOUTONS RÉUTILISABLES ─────────────────── */
.ec-btn {
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 22px;
  border-radius: 100px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, box-shadow 0.15s;
  border: none;
  cursor: pointer;
}

.ec-btn:hover { transform: translateY(-1px); }

.ec-btn-primary {
  background: var(--violette);
  color: white;
  box-shadow: 0 3px 12px rgba(99,71,180,0.3);
}

.ec-btn-primary:hover {
  color: white;
  background: #7A5CC8;
  box-shadow: 0 5px 16px rgba(99,71,180,0.4);
}

.ec-btn-outline {
  background: rgba(99,71,180,0.08);
  color: var(--violette);
  border: 1.5px solid rgba(99,71,180,0.2);
}

.ec-btn-outline:hover { color: var(--violette); background: rgba(99,71,180,0.14); }

/* ── LEGACY BOOTSTRAP OVERRIDES ────────────── */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
  font-size: 16px;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ── MOBILE TOPBAR ────────────────────────── */
.ec-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--encre);
  border-bottom: 2px solid var(--eclair);
  z-index: 300;
  align-items: center;
  padding: 0 16px 0 4px;
}

.ec-burger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.ec-burger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.15s;
}

.ec-topbar-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 17px;
  color: white;
  text-decoration: none;
  gap: 7px;
  pointer-events: auto;
}

/* Overlay de fermeture */
.ec-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 249;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 768px) {

  /* Navigation burger */
  .ec-topbar { display: flex; }

  .ec-sidebar {
    top: 56px;
    min-height: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 250;
    overflow-y: auto;
  }

  .ec-sidebar-logo { display: none; }

  /* Permet à la nav de scroller en flex (min-height: auto bloque l'overflow par défaut) */
  .ec-sidebar-nav { min-height: 0; }

  .ec-page {
    margin-left: 0;
    padding-top: 56px;
  }

  .ec-banner-inscription {
    left: 0;
    gap: 8px;
  }

  body.nav-open .ec-sidebar     { transform: translateX(0); }
  body.nav-open .ec-nav-overlay { opacity: 1; pointer-events: auto; }

  body.nav-open .ec-burger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .ec-burger-bar:nth-child(2) { opacity: 0; }
  body.nav-open .ec-burger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ── Conteneur global ── */
  .ec-container { padding: 0 16px; }

  /* ── Espace membres ── */
  .mb-hero {
    padding: 24px 20px;
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .mb-hero-info  { text-align: center; }
  .mb-hero-name  { font-size: 22px; }
  .mb-badge-fondateur { justify-content: center; }

  .mb-sync-bar   { padding: 10px 16px; }
  .mb-sync-msg   { margin: 8px 16px 0; }
  .mb-content    { padding: 24px 16px; }
  .mb-stats      { grid-template-columns: 1fr 1fr; }

  .adherent-card {
    width: min(440px, calc(100vw - 32px));
    height: auto;
    aspect-ratio: 440 / 276;
  }

  .mb-card-adherent-wrap { align-items: center; }
  .theme-picker          { flex-wrap: wrap; }
  .badge-palette-row     { gap: 6px; }
  .mb-dept-form          { flex-direction: column; align-items: stretch; }

  /* ── Cartes événements ── */
  .mb-card-img, .mb-card-img-placeholder { width: 56px; height: 56px; }

  /* ── Carte des membres (map) ── */
  #mb-map { height: 260px; }
}
