:root {
  --blue: #1f6feb;
  --grey: #6b7280;
  --orange: #f59e0b;
  --violet: #8b5cf6;
  --text: #0f172a;
  --muted: #64748b;
  --bg: #ffffff;
  --dark-bg: #0b0f17;
  --dark-panel: #111827;
  --border: #e5e7eb;
}

/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg); /* blanc par défaut */
  color: var(--text);
}


/* Header */
.header {
  position: fixed; /* pour le garder en haut */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg);

  display: flex; /* garder le flex horizontal */
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--blue);
}

.logo .icon {
  width: 24px;
  height: 24px;
  background: var(--blue);
  border-radius: 6px;
}
.logo a {
  text-decoration: none;
  color: inherit;
}


.auth {
  display: flex;
  gap: 16px;
}

.auth a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.auth a:hover {
  color: var(--text);
}

.nav {
  position: relative;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.6em;
  cursor: pointer;
  display: none; /* caché sur desktop */
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
}

.nav-links li a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.nav-links li a:hover {
  color: var(--blue);
}

/* Responsive mobile nav */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    color: var(--blue);
  }

  .nav-links {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--blue);
    flex-direction: column;
    width: 180px;
    border-radius: 8px;
    padding: 8px;
     z-index: 3000;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li a {
    color: #fff;
    padding: 10px;
    border-radius: 6px;
  }

  .nav-links li a:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Bouton pour afficher/masquer les blocs */
.blocks-toggle {
  background: none;
  border: none;
  font-size: 1.6em;
  cursor: pointer;
  color: var(--blue);
  display: none; /* caché en desktop */
}

/* Blocs principaux (privé) */
.main-blocks {
  position: fixed;
  top: 60px; /* hauteur du header */
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bg);
}

.block {
  background: none;
  border: none;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding-bottom: 8px;
}

.block.active {
  color: var(--blue);
  border-bottom: 3px solid var(--blue);
}

/* Layout privé */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 104px);
  margin-top: 104px;
}
/* Variante pour les tableaux */
.layout-table {
  display: grid;
  grid-template-columns: 280px 1fr;
  margin-top: 104px;
  /* pas de height fixe → laisse grandir */
  height: auto;
}

/* Layout public */
.layout_public {
  background: #f3f4f6;
  min-height: calc(100vh - 110px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
}

.layout-popup {
  display: flex;
  justify-content: center;
  align-items: flex-start; /* ou center si tu veux centrer verticalement */
  min-height: 100vh;
  padding: 20px;
}


.sidebar {
  position: fixed;   /* reste collé à la fenêtre */
  left: 0;
  width: 280px;
  background: var(--bg);
  overflow-y: auto;  /* scroll interne si le menu est long */
  z-index: 2000;     /* au-dessus du contenu */
}

.content {
  grid-column: 2;                  /* occupe la 2e colonne de la grille */
  display: flex;
  flex-direction: column;
  padding: 24px;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: calc(100vh - 104px); /* hauteur totale - header */
  padding-bottom: 64px;            /* réserve l’espace du footer */
}

.content-table {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  padding: 24px;
  width: 100%;
  overflow-x: hidden;
  height: auto;                    /* laisse grandir naturellement */
  padding-bottom: 64px;            /* réserve l’espace du footer */
}

.content_public {
  max-width: 100%;
  overflow-x: hidden;
  padding: 24px;
  min-height: calc(100vh - 110px); /* hauteur totale - header/footer public */
  padding-bottom: 64px;            /* réserve l’espace du footer */
}

.content-popup {
  width: 100%;
  max-width: 600px; /* largeur max sur desktop */
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}


.sidebar.hidden {
  display: none;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
}

/* ============================
   CHEVRON (icône retour)
============================ */

.chevron {
  cursor: pointer;
  color: var(--muted);
}

.chevron::before {
  content: "\2039";
  color: var(--muted);
  font-weight: 700;
  font-size: 1.2em;
}

/* ============================
   MENU PRINCIPAL
============================ */

.menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu li {
  margin-bottom: 1px;
}

/* Lien principal */
.menu li a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  border-radius: 8px;
}

.menu li a:hover {
  background: #eef2ff;
}

.icon {
  width: 18px;
  text-align: center;
  color: var(--muted);
}

/* ============================
   SOUS-MENUS
============================ */

.submenu {
  list-style: none;
  margin: 0 0 0 18px;
  padding: 0;
  display: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.submenu.open {
  display: block;
  opacity: 1;
}

.submenu li {
  margin-bottom: 1px;
}

/* Lien sous-menu */
.submenu li a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  border-radius: 8px;
}

.submenu li a:hover,
.submenu li a:focus {
  background: #f3f4f6;
  outline: 0;
}

/* Bouton d’ouverture/fermeture (chevron) */
.submenu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  margin-left: 4px;
}

.submenu-toggle:hover,
.submenu-toggle:focus {
  background: #f3f4f6;
  outline: 0;
}

/* Sous-niveaux */
.submenu .submenu {
  margin-left: 12px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.submenu .submenu li a {
  font-weight: 400;
  font-size: 0.95rem;
}

/* Icône dans les sous-menus */
.submenu li a .icon {
  width: 1.2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-label-disabled {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text);       /* même couleur que les liens */
  cursor: default;          /* pas de main */
  text-decoration: none;
}



/* ============================
   MOBILE
============================ */

@media (max-width: 768px) {
  .submenu-toggle {
    color: #fff !important;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(0,0,0,0.4);
  }

  .submenu {
    margin-left: 14px;
  }

  .submenu .submenu {
    margin-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.3);
    padding-left: 8px;
  }     
}





.placeholder {
  border: 2px dashed var(--border);
  padding: 24px 32px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* Responsive mobile privé */
@media (max-width: 768px) {
  body {
    background: var(--bg);
    color: var(--text);
  }

  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg);
  }

  .auth a {
    color: var(--muted);
  }

  .blocks-toggle {
    display: block; /* visible uniquement en mobile */
  }

  /* Blocs cachés par défaut */  
   .main-blocks {
    position: fixed;   /* fixé à la fenêtre */
    top: 56px;         /* sous le header */
    left: 0;
    right: 0;
    display: none;
    background: var(--bg);
    padding: 12px 16px;
    flex-direction: column;
    z-index: 2000;
  }

  .main-blocks.open {
    display: flex;
  }
  .block {
    display: block;
    width: 100%;
    text-align: center;
    background: #e0f0ff;
    color: var(--text);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid #bcdfff;
    font-weight: 700;
  }

  .block.active {
    border-color: var(--blue);
    color: var(--blue);
  }

.layout {
  display: flex;
  flex-direction: column;
  margin-top: 70px;              /* réduit l’espace blanc (header + un peu de marge) */
  height: calc(100vh - 70px);    /* ajuste la hauteur en conséquence */
  z-index: 10;
}
.layout-table {
  display: flex;
  flex-direction: column;
  margin-top: 70px;              /* réduit l’espace réservé */
  z-index: 10;
  height: auto;                  /* laisse grandir naturellement */
}
  .layout_public {
    background: var(--bg);
    padding: 16px;
  }


  .content,
  .content-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    max-width: 100%;
    margin-top: 0;
    height: auto;                   /* pas de hauteur fixe */
    min-height: calc(100vh - 70px); /* header seulement */
    padding-bottom: 64px;           /* espace réservé pour le footer */
    overflow-y: visible;            /* pas de scroll interne qui masque le bouton */
  }

  .content_public {
    max-width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 16px;
    height: auto;
    min-height: calc(100vh - 70px); /* header seulement */
    padding-bottom: 64px;           /* espace réservé pour le footer */
  }
  
    .content-popup {
    max-width: 95%;
    padding: 15px;
  }

  .sidebar {
    position: relative;     /* reste dans le flux */
    width: 100%;
    background: var(--blue);
    margin: 8px 0;
    padding: 12px;
    border-radius: 12px;
    display: none;
    max-height: 60vh;       /* limite la hauteur */
    overflow-y: auto;       /* scroll interne */
  }      

  .sidebar.open { display: block; }  
  .sidebar.hidden { display: none; }

  

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

.sidebar-title { color: #fff; font-weight: 700; text-decoration: underline; margin-bottom: 12px; }
  .content { flex: 1; padding: 16px; }

  .menu li a { background: rgba(255,255,255,0.1); border-radius: 12px; color: #fff; }
  .menu li a:hover { background: rgba(255,255,255,0.25); }
  .submenu li a { background: rgba(255,255,255,0.15); border-radius: 8px; color: #fff; }
}

.footer {
  position: fixed;       /* toujours collé en bas de la fenêtre */
  bottom: 0;
  left: 0;
  right: 0;              /* occupe toute la largeur */
  height: 48px;          /* hauteur fixe */
  display: flex;
  justify-content: center; /* centre horizontalement le contenu */
  align-items: center;     /* centre verticalement le texte */
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 1000;         /* au-dessus du contenu */
}

// Input Photo
.photo-upload {
  display: flex;
  flex-direction: column; /* bouton au-dessus, preview en dessous */
  align-items: flex-start;
  margin-bottom: 15px;
}

.photo-preview {
  margin-top: 8px;
}

.photo-container {
  position: relative;
  display: inline-block;
}

.photo-container img {
  max-width: 80px;
  max-height: 80px;
  border: 1px solid #ccc;
  display: block;
}

.delete-photo {
  position: absolute;
  bottom: 0px;   /* décalage de quelques px vers le haut */
  right: -30px;    /* décalage de quelques px vers la droite */
  background: rgba(255,255,255,0.7);
  border: none;
  color: red;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;   /* petit espace autour de la croix */
  border-radius: 3px;
}
.delete-photo:hover {
  background: rgba(255,255,255,1);
}
.photo-upload input[type="file"] {
  display: none; /* on cache le champ natif */
}

.photo-upload label.upload-btn {
  display: inline-block;
  padding: 8px 12px;
  background: #f5f5f5;       /* gris très clair */
  color: #333;               /* texte sombre */
  border: 1px solid #ccc;    /* fine bordure */
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.photo-upload label.upload-btn:hover {
  background: #e0e0e0;       /* léger gris au survol */
}

.file-name {
  display: inline-block;
  max-width: 250px;        /* largeur max du nom */
  white-space: nowrap;     /* pas de retour à la ligne */
  overflow: hidden;        /* cache le surplus */
  text-overflow: ellipsis; /* ajoute "..." */
  vertical-align: middle;
  font-size: 14px;
  color: #333;
}



