/* =========================================================
   1. VARIABLES & BASE
   ========================================================= */
:root {
  /* --accent-color: #c0aa58; */
  --header-height: 70px;
  --dark-bg: #121212;
  --glass-bg: rgba(255, 255, 255, 0.35);
  --base-font-size: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #ebebeb;
  color: #1a1a1a;
  line-height: 1.6;
  transition: background-color 0.3s ease;
  overflow-x: hidden;
  padding-top: calc(var(--header-height) + 40px) !important;
  font-size: var(--base-font-size);
}

body.dark {
  background-color: var(--dark-bg);
  color: #e0e0e0;
}

a {
  text-decoration: none;
  color: #fff;
}

h1,
h2,
h3,
p {
  text-align: center;
}

/* =========================================================
   2. HEADER
   ========================================================= */
header {
  background: linear-gradient(to right, #002855 0%, #ffffff 50%, #e1000f 100%);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 9999;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  /* ÉTAPE A : Le dégradé doit aller vers du transparent pour laisser voir la couleur de fond à la fin */
  background: linear-gradient(90deg, #c0aa58, #0096ff, #bb64ff, #f2416b, #eb7500, #c0aa58);
  background-size: 200% 100%;
  /* ÉTAPE B : La couleur de fond sera celle de votre config */
  background-color: var(--accent-color);
  animation: Flow 5s cubic-bezier(0.68, -0.6, 0.32, 1.6) forwards;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  /* 1. On utilise la couleur PHP comme fond de base */
  background-color: var(--accent-color);
  /* 2. On met le dégradé par-dessus */
  background-image: linear-gradient(90deg, #c0aa58, #0096ff, #bb64ff, #f2416b, #eb7500, #c0aa58);
  background-size: 200% 100%;
  animation: Flow 5s cubic-bezier(0.68, -0.6, 0.32, 1.6) forwards;
}

@keyframes Flow {
  0% {
    transform: scaleX(0);
    background-position: 100% 0%;
  }
  40% {
    transform: scaleX(1.1);
  }
  100% {
    transform: scaleX(1);
    /* 3. IMPORTANT : On enlève le dégradé à la fin pour laisser voir la couleur de fond */
    background-image: none; 
  }
}

.header-container {
  max-width: 1200px;
  margin: auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
  /* Pour rester au-dessus de la bordure animée */
}


/* LOGO */
#logo img {
  height: 58px;
}

/* NAV (header) */
.main-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Bouton mode sombre */
#darkModeToggle {
  background: none;
  border: none;
  cursor: pointer;
}

#darkModeToggle img {
  width: 48px;
}

/* Bouton Adhésion */
.btn-adhesion {
  background-color: #c0aa58;
  padding: 8px 18px;
  border-radius: 15px;
  border: none;
  color: #002855;
  transition: 0.3s;
}

.btn-adhesion a {
  color: #002855;
  font-weight: bold;
}

.btn-adhesion:hover {
  background-color: #a08b45;
  transform: translateY(-2px);
}

.burger-trigger {
  display: none;
}

/* =========================================================
   2.5. GRILLE DE CATEGORIES (ACCUEIL)
   ========================================================= */

body.dark .definition {
  background-color: #363535;
  /* Fond gris de la sidebar */
}

.definition {
  background-color: #f5f5f5;
  /* Fond clair de la sidebar */
  grid-column: span 2;
  /* Prend la place de 2 colonnes */
  padding: 1.5rem;
  border-right: 1px solid #ccc;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin-bottom: 30px;
}

.definition strong {
  font-size: 1.8rem;
  color: #3573B9;
  /* Bleu identique aux engagements */
  display: block;
  margin-bottom: 0.5rem;
}

/* =========================================================
   3. SUB-BANNER & BOUTONS
   ========================================================= */
.sub-banner {
  width: 70%;
  margin: 0 auto 30px auto;
  padding: 12px 26px;
  background: rgba(50, 50, 50, 0.55);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  z-index: 100;
}

/* Boutons & Dropdowns */
.sub-btn,
.btn-dropdown {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 15px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: 0.25s;
  cursor: pointer;
  color: #fff;
}

.sub-btn:hover,
.btn-dropdown:hover {
  background: rgba(161, 161, 161, 0.7);
  transform: translateY(-2px);
}

/* =========================================================
   DROPDOWN
   ========================================================= */
.dropdown {
  position: relative;
  display: inline-block;
}

/* =========================================================
   4. DROPDOWNS & RS
   ========================================================= */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: rgba(24, 24, 24, 0.5);
  min-width: 180px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  border: 1px solid #cdcdcd;
  z-index: 1000;
}

.dropdown-content a {
  color: #dddddd;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 15px;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.RS img {
  width: 24px;
  height: auto;
  margin: 0 8px;
  vertical-align: middle;
}

.RS img:hover {
  transform: scale(1.5);
}

/* =========================================================
   5. SIDEBAR / SOMMAIRE (IMAGES & HOVER)
   ========================================================= */
.sidebar {
  display: flex;
  z-index: 1000;
}

.sidebar .item {
  display: flex;
  align-items: center;
  background: rgba(158, 157, 157, 0.8);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  /* Pour l'animation fadeInUp */
  transform: translateY(20px);
  animation: fadeInUp 0.8s forwards;
}

.sidebar .item img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar .item span {
  font-weight: 600;
  color: #1d1d1f;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- PC (> 1025px) --- */
@media (min-width: 1025px) {
  .sidebar {
    position: fixed !important;
    left: 30px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    flex-direction: column !important;
  }

  .sidebar-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .sidebar .item {
    width: 45px;
    height: 45px;
    padding: 10px;
    border-radius: 50px;
    overflow: hidden;
    border: #002855 2px solid;
  }

  .sidebar .item:hover {
    width: 190px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }

  .sidebar .item span {
    margin-left: 15px;
    white-space: nowrap;
  }

  .mobile-only {
    display: none;
  }
}


/* =========================================================
   MOBILE : BURGER, SIDEBAR & ACCORDÉONS (max 1024px)
   ========================================================= */
@media (max-width: 1024px) {

  /* 1. HEADER & BURGER */
  .header-container {
    padding: 0 10px;
  }

  .burger-trigger {
    display: block;
    order: 3;
    /* Force le bouton à droite */
    background: none;
    border: none;
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    z-index: 3100;
  }

  /* 2. LA SIDEBAR (Ancienne Sub-Banner) */
  .sub-banner {
    position: fixed !important;
    top: 0;
    left: -110% !important;
    /* Cachée par défaut */
    width: 280px !important;

    /* Correction Chrome Mobile : Hauteur dynamique */
    height: 100dvh !important;

    background: #bdbdbd80 !important;
    display: flex !important;
    /* Important pour le flux vertical */
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;

    /* Padding haut (pour éviter le header) et bas (pour finir le scroll confortablement) */
    padding: 90px 20px 60px 20px !important;

    margin: 0;
    border: none;
    border-radius: 0 25px 25px 0;
    transition: 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    z-index: 5000 !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);

    /* --- GESTION DU SCROLL --- */
    overflow-y: auto !important;
    /* Active le scroll vertical */
    overflow-x: hidden !important;

    /* Débloque Chrome Mobile : empêche le rebond de bloquer le menu */
    overscroll-behavior: contain !important;

    /* Scroll fluide sur iOS/Safari */
    -webkit-overflow-scrolling: touch !important;

    /* Masquer la barre de défilement */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
  }

  /* Masquer la barre Chrome/Safari */
  .sub-banner::-webkit-scrollbar {
    display: none;
  }

  .sub-banner.active {
    left: 0 !important;
  }

  /* 3. CONTENU INTERNE (Boutons & Dropdowns) */
  .sub-btn,
  .btn-dropdown {
    width: 100%;
    text-align: left;
    /* margin-bottom: 12px; */
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    /* Légère visibilité sur fond noir */
  }

  .dropdown-content {
    position: static;
    display: none;
    background: rgba(255, 255, 255, 0.05);
    margin-top: -5px;
    margin-bottom: 10px;
    border-radius: 12px;
    width: 100%;
  }

  .dropdown-content a {
    text-align: left;
    color: black;
  }

  .dropdown.open .dropdown-content {
    display: block;
  }

  .dropdown.open .arrow {
    transform: rotate(180deg);
  }

  /* 4. SOMMAIRE (Sidebar Items) DANS LE MENU */
  .sidebar {
    position: relative !important;
    width: 100% !important;
    margin-top: 25px;
    display: block !important;
  }

  .sidebar-items {
    display: grid;
    grid-template-columns: 1fr;
    /* Une colonne pour que ce soit lisible */
    gap: 10px;
  }

  .sidebar .item {
    width: 100% !important;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    opacity: 1;
    transform: none;
    animation: none;
    /* On coupe l'animation PC qui peut bugger l'ouverture */
  }

  .sidebar .item span {
    color: #fff;
    margin-left: 10px;
    font-size: 0.9rem;
  }

  /* 5. OVERLAY (Le flou) */
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 4500;
    display: none;
  }

  .menu-overlay.active {
    display: block;
  }
}

/* =========================================================
   FOOTER
   ========================================================= */
footer {
  background-color: #002855;
  color: white;
  text-align: center;
  padding: 1rem;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}


/* =========================================================
   DARK MODE
   ========================================================= */
body.dark {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark .sub-banner {
  background: rgba(20, 20, 20, 0.55);
}

body.dark .sub-btn,
body.dark .btn-dropdown {
  background: rgba(50, 50, 50, 0.55);
  color: #f1f1f1;
}

body.dark .dropdown-content {
  background: rgba(24, 24, 24, 0.95);
}

body.dark .dropdown-content a {
  color: #dddddd;
}

body.dark .dropdown-content a:hover {
  background: rgba(255, 255, 255, 0.12);
}


.custom-button {
  position: relative;
  /* bottom: 60px;              */
  right: 200px;
  z-index: 1000;
  float: right;
  /* margin: 15px;
    align-items: center;      
    display: flex;            
    justify-content: center; */
  padding: 3px 15px 3px 15px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  /* padding: 8px 16px; */
  border-radius: 15px;
  font-weight: 600;
  /* border: 1px solid rgba(255,255,255,1); */
  transition: 0.25s;
  cursor: pointer;
}

.custom-button:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
}


/* ============================================================
   VERSION MOBILE : HEADER, SIDEBAR ET CONTENU
   ============================================================ */

@media (max-width: 768px) {

  /* 1. EMPECHER LE DEBORDEMENT GLOBAL (BUG FIREFOX) */
  html,
  body {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
  }

  /* 2. HEADER : LOGO ET BOUTONS */
  header {
    padding: 5px 10px !important;
    /* height: auto !important;
    display: flex; */
    /* align-items: center; */
    justify-content: space-between;
  }

  .logo img {
    height: 35px !important;
    /* Réduit le logo pour laisser de la place */
    width: auto;
  }

  #darkModeToggle img {
    width: 25px;
  }

  .btn-adhesion {
    font-size: 10px !important;
    padding: 6px 8px !important;
    margin: 0 5px !important;
    white-space: nowrap;
    /* Empêche le bouton de s'étaler sur 2 lignes */
  }

  /* 3. SIDEBAR / SOMMAIRE (FIXE ET CACHÉE) */
  #sideMenu {
    position: fixed !important;
    top: 0;
    left: -100% !important;
    /* Sortie totale du champ */
    width: 80% !important;
    /* Prend 80% de l'écran une fois ouvert */
    max-width: 280px;
    height: 100vh;
    z-index: 9999 !important;
    transition: left 0.3s ease-in-out;
    visibility: hidden;
    overflow-y: auto;
    /* background: #121212; */
    /* Fond sombre pour lisibilité */
  }

  #sideMenu.active {
    left: 0 !important;
    visibility: visible;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.8);
  }

  /* 4. SUB-BANNER / BANDEAU DE TITRE */
  .sub-banner {
    padding: 20px 15px !important;
    text-align: center;
  }

  /* 5. TITRES ET TEXTES (ADAPTATIFS) */
  h1,
  h2 {
    font-size: clamp(1.4rem, 7vw, 2rem) !important;
    /* S'adapte au zoom Firefox */
    line-height: 1.2 !important;
    margin-bottom: 15px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto;
  }

  p,
  .text-content {
    font-size: 15px !important;
    line-height: 1.5 !important;
  }

  /* 6. GRILLE DE CATEGORIES (Capture 2) */
  .category-grid,
  .grid-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    /* 2 colonnes max sur mobile */
    gap: 10px !important;
    padding: 10px !important;
  }
}


/* --- Carte Tweet --- */

/* Aligne le tweet à droite et laisse le texte couler autour */
.tweet-sidebar {
  position: fixed ;
  right: 30px;
    /* float: right; */
    width: 350px;
    margin-left: 30px;
    margin-bottom: 20px;
    padding-right: 30px; 
}

/* Tablette et Mobile : on annule le float pour que le tweet reprenne toute la largeur */
@media (max-width: 900px) {
    .tweet-sidebar {
        float: none;
        width: 80%;
        margin: 0 auto;
        position: static;
        padding: 0 0 30px 0;
    }

    /* On cache le contenu par défaut uniquement sur mobile */
    .tweet-content.mobile-hidden {
        display: none !important;
    }

    /* Rend le titre plus facile à cliquer (zone de contact large) */
    #toggleTweet {
        padding: 15px;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        display: block;
        cursor: pointer;
        user-select: none;
        touch-action: manipulation; /* Optimise le tactile */
    }

    /* Optionnel : un indicateur visuel sur le H2 mobile */
    #toggleTweet::after {
        content: " ▼";
        font-size: 0.8rem;
        vertical-align: middle;
    }

    .twitter-tweet {
        margin: 0 auto !important;
    }
}

/* On nettoie le float après la section pour éviter des bugs sur le footer */
.chapter::after {
    content: "";
    display: table;
    clear: both;
}

/* Style général de la carte tweet */
.twitter-tweet {
    max-width: 550px;
    margin: 2rem 0 2rem auto;
    padding: 25px;
    background: var(--bg-card, #ffffff);
    border-left: 5px solid #ff0000; /* La couleur dynamique de ta page par exemple */
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
}

/* Style du texte du tweet */
.twitter-tweet p {
    font-size: 1.15rem;
    color: var(--text-main, #2c3e50);
    margin-bottom: 15px;
}

/* Hashtags et Liens */
.twitter-tweet a {
    color: #1da1f2;
    text-decoration: none;
    font-weight: 500;
}

.twitter-tweet a:hover {
    text-decoration: underline;
}

/* Signature de l'auteur (&mdash;) */
.twitter-tweet {
    color: #657786;
    font-style: normal;
    display: block;
    margin-top: 15px;
    font-weight: 600;
}

/* Style de la date */
.twitter-tweet a[href*="status"] {
    display: block;
    font-size: 0.85rem;
    color: #aab8c2;
    margin-top: 5px;
    font-weight: normal;
}

/* --- Adaptabilité Mode Sombre --- */
body.dark .twitter-tweet {
    --bg-card: #1e272e;
    --text-main: #ecf0f1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: #ff2600; /* Garde la couleur de la thématique */
}