/* =========================
   STYLE GLOBAL
   ========================= */
body {
  font-family: 'Roboto', sans-serif;
  background-color: #cacaca; /* gris clair pour toute la page */
}


/* =========================
   MODALES ADMIN
   ========================= */

.toggle-button {
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.admin-info {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.admin-info .role-badge {
    background: #007acc;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 0; /* Supprimé la marge gauche */
}
.deconnexion {
    background: #FF0000;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 0; /* Supprimé la marge gauche */
}

.admin-info a {
  color: white;
  text-decoration: none;
  margin-left: 0; /* Supprimé la marge gauche */
}
/* Overlay modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

/* Contenu modal */
.modal-content {
    background: #cacaca;
    border-radius: 8px;
    padding: 0px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Header modal */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
    background: #cacaca;
}

.modal-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

/* Bouton fermer */
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Formulaire modal */
.modal-form {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin: 0;
}

/* Ligne de champ (label + input sur même ligne) */
.modal-form-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

/* Labels alignés à droite */
.modal-form-row label {
    font-weight: bold;
    color: #333;
    width: 140px;
    flex-shrink: 0;
    text-align: right;
    margin: 0;
}

/* Champs de saisie */
.modal-form-row .admin-input {
    flex: 1;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

/* Texte d'aide */
.modal-form small {
    margin-left: 155px;
    margin-top: -3px;
    display: block;
    color: #666;
    font-size: 12px;
}

/* Actions (boutons) */
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    background: #cacaca;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: -20px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .modal-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .modal-form-row label {
        width: auto;
        text-align: left;
    }
    
    .modal-form small {
        margin-left: 0;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .admin-button {
        width: 100%;
    }
}


/* =========================
   FOOTER
   ========================= */
#customFooter {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #f0f0f0;
  color: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border-top: 1px solid #000;  
  z-index: 2000;
  box-sizing: border-box;
  padding: 0px 20px 0px 2px; /* unifié */
}

#customFooter .footer-left {
  font-weight: bold;
  text-align: left;
}

#customFooter .footer-right {
  text-align: right;
}

#customFooter a {
  color: inherit;
  text-decoration: none;
}

#customFooter a:hover {
  text-decoration: underline;
}

/* =========================
   HEADERS
   ========================= */

/* Base pour tous les headers */
.block-header {
  font-weight: bold;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}

/* Header de projet */
.project-header {
  background-color: #aaaaaa; /* ou #f6c4cb */
  color: #000;
  text-align: left;
  font-size: 1.2em;
  border: 2px solid #000;
  margin: 15px 0;
}

/* =========================
   HEADERS - MODIFICATIONS UNIQUEMENT
   ========================= */

/* EntÃªte principale - améliorations */
.entete-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px; /* augmenté de 15px à 20px */
  font-size: 1.2em;
  background: #aaaaaa;
  border-bottom: 2px solid #ccc;
  margin-bottom: 20px;
  padding: 15px 20px; /* augmenté le padding vertical */
  min-height: 80px; /* ajouté pour cohérence */
}

.entete-header img.main-logo {
  width: 100px;
  height: auto; /* ajouté */
  flex-shrink: 0;
  order: 1; /* ajouté - force le logo en premier */
}

/* Conteneur pour les titres empilés - améliorations */
.entete-titles {
  display: flex;
  flex-direction: column;
  justify-content: center; /* ajouté - centre verticalement */
  gap: 0;
  order: 2; /* ajouté - force les titres en second */
  flex: 1; /* ajouté - prend l'espace restant */
}

.entete-titles h1,
.entete-titles h2 {
  margin: 0;
  line-height: 1.3; /* augmenté de 1.2 à 1.3 */
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); /* ajouté */
}

/* Ajouté - styles spécifiques pour h1 et h2 */
.entete-titles h1 {
  font-size: 1.4em;
  font-weight: bold;
  margin-bottom: 2px;
}

.entete-titles h2 {
  font-size: 1.1em;
  font-weight: normal;
  opacity: 0.9;
}


.entete-header .dynamic-logo {
  order: 3;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  justify-content: flex-start;
}

.entete-header .dynamic-logo img {
  width: 40px;
  height: 40px;
  display: block;
  margin: 0 1px 0 0; /* 1px de marge à droite de chaque image */
  flex-shrink: 0;
}

.entete-header .dynamic-logo img:last-child {
  margin-right: 0; /* Supprime la marge de la dernière image */
}
/* Responsive mobile - ajouté */
@media (max-width: 768px) {
  .entete-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 15px;
  }
  
  .entete-header img.main-logo {
    width: 100px;
    order: 1;
  }
  
  .entete-titles {
    order: 2;
    text-align: center;
  }
  
  .entete-titles h1 {
    font-size: 1.2em;
  }
  
  .entete-titles h2 {
    font-size: 1em;
  }
  
.entete-header {
  display: flex;
  align-items: center; /* Alignement vertical */
}

}







/* =========================
   SIDEBAR
   ========================= */
#customSidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: #f5f5f5;
  border-left: 1px solid #ccc;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  z-index: 1003;
  transition: right 0.3s ease-in-out;
  overflow-y: auto;
}

#customSidebar .header {
  font-weight: bold;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ccc;
}

body.sidebar-hidden #customSidebar {
  right: -300px;
}

/* =========================
   TOGGLE SIDEBAR
   ========================= */
#customSidebarToggle {
  position: fixed;
  top: 10px;
  right: 300px;
  background: #eee;
  padding: 6px;
  border-radius: 6px 0 0 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  z-index: 1004;
  transition: right 0.3s ease-in-out, transform 0.3s ease-in-out;
}

body.sidebar-hidden #customSidebarToggle {
  right: 0;
  transform: translateX(0);
}


/* =========================
   ADMINISTRATION
   ========================= */
.admin-body {
  font-family: 'Arial', sans-serif;
  background: #cacaca;
  color: #333;
  text-align: center;
}

.admin-header {
  background: #aaaaaa;
  color: white;
  padding: 10px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}

.admin-header img.admin-main-logo {
  max-width: 100px;
  flex-shrink: 0; /* Empêche le logo de rétrécir */
}

.admin-header-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-header h1, .admin-header h2 {
  color: white;
  margin: 5px 0;
  text-align: left;
}

.admin-header h1 {
  font-size: 1.8em;
  margin-bottom: 2px;
}

.admin-header h2 {
  font-size: 1.2em;
  margin-top: 2px;
}

.admin-info {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
}

.admin-info a {
  color: white;
  text-decoration: none;
  margin-left: 10px;
}

.admin-info a:hover {
  text-decoration: underline;
}

.admin-main {
  padding: 10px 20px;
  max-width: 1200px;
  margin: auto;
}

.admin-form-container {
  margin: 40px auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  max-width: 400px;
}

.admin-input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

.admin-button {
  background: #888;
  color: white;
  padding: 10px 16px;
  font-size: 12px;
 border: 1px solid black;
  border-radius: 4px;
  cursor: pointer;
  margin: 8px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s ease;
}
.admin-button-clair {
  background: white; 
  color: #333; 
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #888;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  margin: 5px 0;
}

.admin-button:hover {
  background: #0066cc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.admin-section {
  background: white;
  padding: 10px;
  margin: 10px auto;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  max-width: 1200px;
  text-align: left;
}
.admin-section p {
  margin-top: 0;      /* supprime l'espace au-dessus du paragraphe */
  margin-bottom: 5px; /* optionnel, ajuste l'espace dessous */
}

.admin-section h3 {
  text-align: center;
  margin-top: 0;
  font-size: 1.5em;
  margin-bottom: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.admin-success {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 8px;
  margin: 20px auto;
  max-width: 800px;
  text-align: center;
  border: 1px solid #c3e6cb;
}

.admin-error {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 8px;
  margin: 20px auto;
  max-width: 800px;
  text-align: center;
  border: 1px solid #f5c6cb;
}

.admin-code {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 15px;
  font-family: monospace;
  border-radius: 4px;
  margin: 15px 0;
  word-break: break-all;
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0px;
  table-layout: auto;
  font-size: 14px; /* Ajouté - taille de police plus petite */
}

/* Réduire uniquement le texte des lignes de données */
.admin-table td {
  border: 1px solid #ddd;
  padding: 5px; /* Padding réduit */
  text-align: left;
  white-space: nowrap;
  font-size: 13px; /* Texte plus petit pour les données */
  line-height: 1.2; /* Hauteur de ligne réduite */
}
.admin-table tr:nth-child(even) {
  background: #ebebeb;
}

.admin-table small {
  color: #666;
  font-size: 0.85em; /* Réduit de 0.9em à 0.85em */
}

.admin-section p small {
  color: #aaaaaa;
  font-size: 0.85em;
    font-style: italic;
}

.admin-table th.col-narrow,
.admin-table td.col-narrow {
  width: 80px; /* Largeur fixe suffisante pour "Dans DB" */
  text-align: center;
  white-space: nowrap;
}


.button-group {
  margin-top: 20px;
}

  .admin-table th {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  background-color: #a2a2a2;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}


/* PLIER DEPLIER - VERSION AMÉLIORÉE */
/* =========================
   SECTIONS PLIABLES/DÉPLIABLES - CORRIGÉ
   ========================= */

.admin-section h3 {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* MODIFIÉ : était center */
  gap: 0; /* MODIFIÉ : était 10px */
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  transition: background-color 0.2s ease;
  /* AJOUTÉ pour mobile */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.admin-section h3:hover {
  background: #e9ecef;
}

/* Bouton toggle - MODIFIÉ */
.section-toggle {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 3px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease, background-color 0.2s ease;
  margin-right: 5px; /* AJOUTÉ : petit espace après la flèche */
  flex-shrink: 0; /* AJOUTÉ : empêche la flèche de rétrécir */
  /* AJOUTÉ pour mobile */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.section-toggle:hover {
  background: rgba(0, 122, 204, 0.1);
}

/* Animation de rotation pour l'icône */
.admin-section.collapsed .section-toggle {

}

.admin-section.collapsed .section-toggle:hover {

}

/* Titre de section - AJOUTÉ */
.admin-section h3 span:not(.section-status) {
  flex: 1; /* Prend l'espace restant */
  text-align: center; /* Centre le titre dans l'espace restant */
}

/* Indicateur d'état dans le titre - MODIFIÉ */
.section-status {
  font-size: 0.7em;
  color: #666;
  font-weight: normal;
  margin-left: auto; /* MODIFIÉ : pousse vers la droite */
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-shrink: 0; /* AJOUTÉ */
}

.admin-section.collapsed .section-status {
  opacity: 1;
}

/* Contenu pliable - amélioré pour mobile */
.section-content {
  overflow: hidden;
  transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease; /* MODIFIÉ : transition plus rapide */
  max-height: none;
  opacity: 1;
}

/* État plié */
.admin-section.collapsed .section-content {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.admin-section.collapsed {
  padding-bottom: 10px;
}

/* AJOUTÉ : Améliorations spécifiques pour mobile */
@media (max-width: 768px) {
  .admin-section h3 {
    padding: 15px 10px; /* Plus de padding vertical pour faciliter le tap */
    font-size: 1.3em; /* Légèrement plus petit */
  }
  
  .section-toggle {
    width: 35px; /* Légèrement plus large */
    height: 35px;
    font-size: 1.3em; /* Plus gros sur mobile */
    margin-right: 8px; /* Plus d'espace sur mobile */
  }
  
  /* Transitions plus rapides sur mobile */
  .section-content {
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
  }
  
  /* Zone de tap plus large */
  .admin-section h3::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    z-index: -1;
  }
  
  .admin-section {
    position: relative; /* Nécessaire pour le ::before */
  }
}

/* =========================
   TABLEAUX RESPONSIVE
   ========================= */

/* Container pour le scroll horizontal */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
  margin-bottom: 15px;
}

/* Améliorer l'affichage du tableau sur mobile */
@media (max-width: 768px) {
  .admin-table {
    font-size: 12px; /* Texte plus petit sur mobile */
  }
  .admin-table th
  .admin-table td {
    padding: 6px 4px; /* Padding réduit sur mobile */
  }

 
  .admin-table .admin-button {
    font-size: 10px;
    padding: 4px 8px;
    margin: 2px;
  }
  
  /* UNIQUEMENT la PREMIÈRE colonne fixe */
  .admin-table th:first-child,
  .admin-table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 3px rgba(0,0,0,0.1);
    z-index: 10;
  }
  
  /* Pour les en-têtes, un background légèrement différent */
  .admin-table th:first-child {
    background: #f8f9fa;
    font-weight: bold;
  }
  
  /* S'assurer que les lignes paires gardent leur couleur de fond */
  .admin-table tr:nth-child(even) td:first-child {
    background: #f9f9f9;
  }
}


#entreprise-folder-select {
    background-color: white !important;
    color: black !important;
    border: 1px solid #ccc !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    appearance: menulist !important;
    background-image: none !important;
    /* SUPPRIMÉ : text-indent: 0.01px !important; */
    /* SUPPRIMÉ : text-overflow: '' !important; */
    padding: 8px 12px !important;
    font-size: 14px !important;
    line-height: normal !important;
    height: auto !important;
    min-height: 34px !important;
}

#entreprise-folder-select option {
    background-color: white !important;
    color: black !important;
    padding: 4px 8px !important;
}

#entreprise-folder-select option.dossier-assigne {
    color: green !important;
}

#entreprise-folder-select option.dossier-non-assigne {
    color: red !important;
}


#entreprise-folder-select option:checked,
#entreprise-folder-select option[selected] {
    background-color: #007cba !important;
    color: white !important;
    font-weight: bold !important;
}

/* Force l'affichage de la valeur sélectionnée */
#entreprise-folder-select:focus {
    outline: 2px solid #007cba !important;
}

/* Reset complet pour éviter les conflits */
#entreprise-folder-select {
    text-align: left !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    overflow: visible !important;
}