/* styles.css */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #060610;
  color: #fff;
}

header, footer {
  text-align: center;
  padding: 20px;
  background-color: #2a2d35;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

header h1, footer p { margin: 0; }
header p { margin: 10px 0; }

.btn {
  padding: 10px 20px;
  margin: 0 10px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}
.btn.primary { background-color: #ffc52a; color: #1c1e24; }
.btn.primary:hover { background-color: #e0a600; }

/* =========================
   NAVBAR / SIDEBAR — Desktop
   ========================= */
.sidebar {
  width: 160px;
  background-color: #13131b;
  padding: 20px 20px 0px 20px;
  height: 99vh;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;             /* nouveau */
  flex-direction: column;    /* nouveau */
  overflow: visible;
  --sb-pad: 20px;   /* padding horizontal actuel */
  --sb-gap: 16px;
}

.sidebar-header {
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 8px 12px;
}

/* Logo */
.logo-container { text-align:left; padding: 0.2rem 0 0.6rem; }
.nav-logo { max-width: 50px; height: auto; display: inline-block; }

/* Bouton croix */
.sidebar-close{
  appearance:none; border:0; background:transparent; color:#e5e5e5;
  font-size:20px; line-height:1; cursor:pointer;
  width:32px; height:32px; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
}
.sidebar-close:hover{ background: rgba(255,255,255,0.06); }

/* Menu */
.sidebar-main { list-style: none; padding: 0; margin: 0;   overflow-y: auto;          /* nouveau: scroll ici */
}
.sidebar-section > a {
  display: block; color: #fff; font-weight: bold;
  text-decoration: none; padding: 10px 0;
}
.sidebar-section > a { padding: 10px 16px; color: #fff; }
.sidebar-section.active > a { background-color: #060610; border-radius: 6px; }

.sidebar-sub {
  display: none; list-style: none;
  margin-left: 20px; position: relative; padding-left: 12px;
}
.sidebar-section.active .sidebar-sub { display: block; }
.sidebar-section.active .sidebar-sub::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 0;
  width: 2px; background-color: #fff; opacity: .3; border-radius: 1px;
}
.sidebar-sub li a {
  display: block; color: #ccc; text-decoration: none; padding: 6px 12px;
}
.sidebar-sub li a.active {
  background-color: #4b0346; color: #fff; font-weight: bold; border-radius: 6px;
}

/* Bouton d’ouverture (caché desktop) */
.sidebar-toggle {
  display: none;
  position: fixed; top: 15px; left: 15px;
  z-index: 110;
  background-color: #4b0346; color: #fff;
  font-size: 20px; border: none;
  padding: 10px 14px; border-radius: 6px; cursor: pointer;
}

/* Bloc profil (collé en bas en desktop) */
.sidebar-footer {
  position: absolute; bottom: 20px; left: 20px; right: 20px;
}

/* Séparateur au-dessus du profil */
.sidebar-sep {
  height: 1px; background: rgba(255,255,255,0.08);
  margin: 10px 0 6px;
}

/* Profile summary (bouton) */
.profile-summary {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  position: relative; /* pour la flèche */
  background: transparent; border: 0; color: #fff;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; text-align: left;
}
.profile-summary:focus-visible { outline: 2px solid #7a1e5e; outline-offset: 2px; }

/* Avatar + textes */
.profile-summary img { width: 40px; height: 40px; border-radius: 25%; }
.profile-details { display: flex; flex-direction: column; margin-left: 12px; }
#sidebar-user-name { font-size: .9rem; font-weight: bold; color: #fff; }
#sidebar-user-type { font-size: .75rem; color: #aaa; margin-top: 4px; }

/* Flèche à droite */
.profile-caret {
  position: absolute; right: 12px; top: 44%;
  transform: translateY(-50%); margin-left: 0;
  display: inline-flex; opacity: .7;
}

/* Mini-menu profil */
.profile-menu {
  position: absolute; left: calc(95% + var(--sb-pad) + var(--sb-gap)); /* dehors, à droite */
  right: auto; bottom: -5px; min-width: 180px; background: #0f0f15;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
  padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  display: none; z-index: 200;
}
.profile-menu a, .profile-menu button {
  display: block; width: 85%; padding: 10px 12px;
  background: transparent; border: 0; color: #eaeaea;
  text-decoration: none; text-align: left; border-radius: 8px; cursor: pointer; font: inherit;
}
.profile-menu a:hover, .profile-menu button:hover { background: rgba(255,255,255,0.06); }
.profile-menu.show { display: block; }

/* =======================
   MOBILE — max-width 768px
   ======================= */
@media (max-width: 768px) {
  .container { flex-direction: column; }

  /* Off-canvas animé + safe-area + footer collé bas */
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 50%; max-width: 300px; height: 100dvh;
    background: #13131b; z-index: 120;
    transform: translateX(-100%); transition: transform 280ms ease;
    display: flex; flex-direction: column;

    padding: 10px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-top: calc(20px + constant(safe-area-inset-top));
    padding-bottom: calc(20px + constant(safe-area-inset-bottom));
  }
  .sidebar.show { transform: translateX(0); }

  .sidebar-main { flex: 1 1 auto; overflow-y: auto; margin-bottom: 8px; }

  .sidebar-footer {
    position: static; margin-top: auto; left: auto; right: auto; bottom: auto;
    background: #13131b; padding-top: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-bottom: max(10px, constant(safe-area-inset-bottom));
  }

  /* Bouton Menu visible, mais derrière la sidebar ouverte */
  .sidebar-toggle {
    display: block; background-color: #1c1e24; color: #fff;
    padding: 10px; text-align: center; cursor: pointer; z-index: 90;
  }

  .main-content { margin-left: 0; }
  .page-content { margin-left: 0 !important; padding-left: 20px; padding-right: 20px; }
  .sidebar.active ul { display: block; }

  /* Ajustements visuels */
  .profile-summary { padding: 10px 16px 29px; }
  .logo-container { padding: 5.2rem 0 0.6rem; }

  /* Backdrop */
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none; transition: opacity 200ms ease; z-index: 110;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

  /* Motion préférences */
  @media (prefers-reduced-motion: reduce) {
    .sidebar, .sidebar-backdrop { transition: none; }
  }

  /* Menu profil au-dessus de la safe-area */
  .profile-menu {
    right: 7px; left: 7px;
    bottom: calc(101px + env(safe-area-inset-bottom));
    bottom: calc(101px + constant(safe-area-inset-bottom));
  }
}

/* ===== Autres éléments (hors navbar) ===== */
.header-bar {
  display: flex; justify-content: space-between; align-items: center;
  background-color: #2a2d35; padding: 10px;
}
.header-profile-photo { display: flex; align-items: center; }
.header-profile-photo img { width: 50px; height: 50px; border-radius: 50%; margin-right: 10px; }

.legal {
  text-decoration: none; font-size: 0.6rem; color: #5b5d60;
  text-align: center; padding: 0.3rem;
}
.legal-block {
  display: flex; justify-content: center; align-items: center; margin: 0.3rem auto;
}


/* Header de la sidebar: logo gauche, croix droite */
.sidebar-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 8px 12px;
}

/* Logo déjà existant: on force l'alignement gauche sans casser la classe */
.logo-container{ text-align:left; padding: 0.2rem 0 0.6rem; }
.nav-logo{ max-width:50px; height:auto; display:inline-block; }

/* Bouton croix */
.sidebar-close{
  display: none; }

/* En mobile: la sidebar doit passer DEVANT le bouton Menu */
@media (max-width:768px){
  .sidebar-toggle{ z-index: 90; } /* sidebar est à 120, donc le Menu passe derrière */

  /* Bouton croix */
.sidebar-close{
  appearance:none; border:0; background:transparent; color:#e5e5e5;
  font-size:20px; line-height:1; cursor:pointer;
  width:32px; height:32px; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
}
.sidebar-close:hover{ background: rgba(255,255,255,0.06); }
}


/* Icônes dans les liens de sections */
.sidebar-section > a {
  display: flex;                  /* texte + icône alignés */
  align-items: center;
  gap: 10px;
}

/* conteneur d’icône */
.sidebar-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;                 /* largeur fixe */
}

/* le SVG s’adapte, hérite de la couleur du lien */
.sidebar-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* couleurs d’état */
.sidebar-section > a { color: #fff; }
.sidebar-section.active > a { color: #fff; }
.sidebar-sub li a { color: #ccc; }
.sidebar-sub li a.active { color: #fff; }

/* flèche des sections */
.section-caret {
  margin-left: auto;
  transition: transform 0.2s ease;
}
.sidebar-section.active > a .section-caret {
  transform: rotate(180deg);
}









/* Backdrop plein écran (invisible par défaut) */
#domain-modal-placeholder::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 999; /* sous la modal */
}

/* Afficher le backdrop quand la modale est ouverte */
#domain-modal.show ~ #domain-modal-placeholder::before,
#domain-modal.show::backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Conteneur modal */
#domain-modal.modal {
  position: fixed;
  inset: 0;
  display: none;            /* cachée par défaut */
  align-items: center;      /* centre vertical */
  justify-content: center;  /* centre horizontal */
  padding: 16px;            /* respirations et safe-area */
  z-index: 1000;
}
#domain-modal.modal.show {
  display: flex;            /* devient visible */
}

/* Boîte de contenu */
#domain-modal .modal-content {
  width: 100%;
  max-width: 520px;         /* limite desktop/tablette */
  max-height: 90vh;         /* pas plus haut que viewport */
  overflow: auto;           /* scroll interne si nécessaire */
  border-radius: 12px;
  background-color: #1c1e24;
  color: #fff;
  border: 1px solid #3a3f47;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  padding: 16px;
}

/* Bouton close en haut à droite */
#domain-modal #domain-modal-close {
  position: sticky;    /* reste visible lors du scroll interne */
  top: 0;
  margin-left: auto;
  background: transparent;
  border: 0;
  color: #e5e5e5;
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
}
#domain-modal #domain-modal-close:hover { background: rgba(255,255,255,0.06); }

/* Grilles d’instructions: éviter l’horizontal scroll */
#domain-modal .utm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
#domain-modal .utm-grid input {
  min-width: 0;             /* évite overflow inline */
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
#domain-modal [data-copy].btn {
  white-space: nowrap;
}

/* Mobile: plein écran avec marges internes et typographie compacte */
@media (max-width: 640px) {
  #domain-modal .modal-content {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 92vh;       /* un peu plus compact */
    padding: 14px;
    border-radius: 10px;
  }
  #domain-modal .utm-grid {
    grid-template-columns: 1fr; /* colonne unique */
  }
}

/* État hidden générique */
.hidden { display: none !important; }
