/* =============================================================================
   TABLEAU DE BORD v2 — 29.07.2026
   Refonte complète du modal admin (profil / groupes / utilisateurs).
   Chargée APRÈS admin.css : elle a le dernier mot sans toucher à l'existant.
   ========================================================================== */

/* ---------- coquille du modal ---------- */
#adminModal .modal-content.admin-modal {
  background: #10101c !important;
  border: 1px solid rgba(139, 122, 246, .18) !important;
  border-radius: 20px !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6) !important;
  max-width: 1080px !important;
  width: min(96vw, 1080px) !important;
  padding: 0 !important;
  overflow: hidden !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

#adminModal .modal-content.admin-modal > h2 {
  margin: 0 !important;
  padding: 18px 24px 14px !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #eceefb !important;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: linear-gradient(180deg, rgba(99, 102, 241, .10), transparent);
  display: flex;
  align-items: center;
  gap: 10px;
}
#adminModal .modal-content.admin-modal > h2::before {
  content: '\f3fd';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 15px;
  color: #a78bfa;
  background: rgba(139, 92, 246, .16);
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: 10px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
}

#adminModal .close {
  position: absolute;
  top: 14px; right: 16px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .3);
  color: #fca5a5 !important;
  font-size: 20px !important;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  transition: background .15s ease;
}
#adminModal .close:hover { background: rgba(239, 68, 68, .28); }

#adminModal .admin-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 24px;
}

/* ---------- onglets ---------- */
#adminModal .admin-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin: 0 0 18px;
  background: #171728;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}
#adminModal .admin-tabs button {
  all: unset;
  cursor: pointer;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #9aa0c3;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .15s ease, background .15s ease;
}
#adminModal .admin-tabs button:hover { color: #d9dcf2; }
#adminModal .admin-tabs button.active-tab {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
}

/* ---------- briques communes ---------- */
.av2-carte {
  background: #171727;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 16px;
  padding: 18px;
}
.av2-titre {
  font-size: 14px;
  font-weight: 800;
  color: #eceefb;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.av2-titre i { color: #a78bfa; }

.av2-champ { margin-bottom: 12px; }
.av2-champ label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8f94b8;
  margin: 0 0 5px 2px;
}
.av2-champ input, .av2-champ select {
  width: 100%;
  box-sizing: border-box;
  background: #0e0e1a;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  color: #eceefb;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.av2-champ input:focus, .av2-champ select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .18);
}

.av2-btn {
  all: unset;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #d9dcf2;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: background .15s ease, transform .1s ease;
}
.av2-btn:hover { background: rgba(255, 255, 255, .11); }
.av2-btn:active { transform: scale(.98); }
.av2-btn.prim {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .3);
}
.av2-btn.prim:hover { filter: brightness(1.08); }
.av2-btn.danger {
  background: rgba(239, 68, 68, .13);
  border-color: rgba(239, 68, 68, .35);
  color: #fca5a5;
}
.av2-btn.danger:hover { background: rgba(239, 68, 68, .24); }
.av2-btn.pleine { width: 100%; }

/* pastilles */
.av2-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
}
.av2-pill.admin { background: rgba(245, 158, 11, .15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, .35); }
.av2-pill.user  { background: rgba(99, 102, 241, .14); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, .3); }
.av2-pill.on    { background: rgba(16, 185, 129, .13); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, .3); }
.av2-pill.off   { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.av2-pill.warn  { background: rgba(245, 158, 11, .13); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .3); }

/* avatar rond à initiale */
.av2-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex: 0 0 auto;
}

/* ---------- MON PROFIL ---------- */
.av2-profil-tete {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.av2-profil-tete .av2-avatar { width: 56px; height: 56px; font-size: 22px; }
.av2-profil-nom { font-size: 19px; font-weight: 800; color: #eceefb; }
.av2-profil-mail { font-size: 13px; color: #9aa0c3; margin-top: 2px; }
.av2-profil-grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.av2-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- UTILISATEURS ---------- */
.av2-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.av2-stat {
  background: #171727;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  padding: 12px 14px;
}
.av2-stat b { display: block; font-size: 21px; color: #eceefb; }
.av2-stat span { font-size: 11.5px; font-weight: 700; color: #8f94b8; }
.av2-stat.vert b { color: #6ee7b7; }
.av2-stat.ambre b { color: #fbbf24; }
.av2-stat.rouge b { color: #fca5a5; }

.av2-outils {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.av2-outils .av2-recherche {
  flex: 1 1 220px;
  position: relative;
}
.av2-outils .av2-recherche i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: #6d7295; font-size: 12.5px;
}
.av2-outils .av2-recherche input {
  width: 100%;
  box-sizing: border-box;
  background: #0e0e1a;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  color: #eceefb;
  font-size: 13.5px;
  padding: 9px 12px 9px 32px;
  outline: none;
}
.av2-outils .av2-recherche input:focus { border-color: #8b5cf6; }
.av2-outils select {
  background: #0e0e1a;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  color: #d9dcf2;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 10px;
  outline: none;
  cursor: pointer;
}

/* table */
.av2-table { border: 1px solid rgba(255, 255, 255, .07); border-radius: 14px; overflow: hidden; }
.av2-ligne, .av2-entete {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(170px, 1.6fr) 92px 84px 110px 118px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
}
.av2-entete {
  background: #171728;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #8f94b8;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.av2-ligne {
  background: #121220;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  cursor: pointer;
  transition: background .12s ease;
}
.av2-ligne:last-child { border-bottom: none; }
.av2-ligne:hover { background: #191932; }
.av2-ligne.moi { box-shadow: inset 3px 0 0 #8b5cf6; }
.av2-qui { display: flex; align-items: center; gap: 10px; min-width: 0; }
.av2-qui b {
  color: #eceefb; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.av2-mail { color: #9aa0c3; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av2-date { color: #8f94b8; font-size: 12px; white-space: nowrap; }
.av2-date b { color: #c7cbe8; font-weight: 700; }
.av2-actes { display: flex; gap: 6px; justify-content: flex-end; }
.av2-acte {
  all: unset;
  cursor: pointer;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  color: #9aa0c3;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px;
  transition: background .12s ease, color .12s ease;
}
.av2-acte:hover { background: rgba(139, 92, 246, .22); color: #d9dcf2; }
.av2-acte.danger:hover { background: rgba(239, 68, 68, .25); color: #fca5a5; }

.av2-vide {
  padding: 34px;
  text-align: center;
  color: #8f94b8;
  font-size: 13.5px;
  background: #121220;
}

/* pagination */
.av2-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.av2-pied .compte { font-size: 12.5px; color: #8f94b8; font-weight: 600; }
.av2-pages { display: flex; gap: 6px; }

/* ---------- fiche utilisateur (éditeur) ---------- */
#av2Editeur {
  position: fixed;
  inset: 0;
  z-index: 10090;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 15, .66);
  backdrop-filter: blur(4px);
}
#av2Editeur .av2-fiche {
  width: min(94vw, 440px);
  max-height: 90vh;
  overflow-y: auto;
  background: #14142a;
  border: 1px solid rgba(139, 122, 246, .25);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
#av2Editeur .av2-fiche-tete {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
#av2Editeur .av2-fiche-tete .av2-avatar { width: 44px; height: 44px; font-size: 18px; }
#av2Editeur .av2-fiche-tete b { font-size: 16px; color: #eceefb; display: block; }
#av2Editeur .av2-fiche-tete span { font-size: 12px; color: #8f94b8; }
#av2Editeur .av2-fiche-actions { display: flex; gap: 8px; margin-top: 16px; }
#av2Editeur .av2-fiche-actions .av2-btn { flex: 1; }
.av2-oeil { position: relative; }
.av2-oeil input { padding-right: 38px !important; }
.av2-oeil button {
  all: unset;
  cursor: pointer;
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  color: #6d7295; font-size: 13px; padding: 4px;
}
.av2-oeil button:hover { color: #d9dcf2; }

/* ---------- GROUPES & RÉPERTOIRES (habillage) ---------- */
.av2-outils + .admin-hierarchy { margin-top: 2px; }
#adminModal .admin-hierarchy .directory-list { padding: 0; margin: 0; }
#adminModal .directory-item {
  background: #171727;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: hidden;
  list-style: none;
}
#adminModal .directory-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
}
#adminModal .directory-header:hover { background: rgba(139, 92, 246, .07); }
#adminModal .dir-name { font-weight: 800; color: #eceefb; font-size: 14px; flex: 1; }
#adminModal .dir-icon i { color: #a78bfa; }
#adminModal .dir-arrow::before {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10.5px;
  color: #8f94b8;
  display: inline-block;
  transition: transform .18s ease;
}
#adminModal .directory-item.collapsed .dir-arrow::before { transform: rotate(-90deg); }
#adminModal .group-list { list-style: none; margin: 0; padding: 4px 10px 10px; }
#adminModal .group-item {
  border-radius: 10px;
  margin: 2px 0;
}
#adminModal .group-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
}
#adminModal .group-row:hover { background: rgba(255, 255, 255, .045); }
#adminModal .group-row .group-name {
  flex: 1;
  color: #d9dcf2;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#adminModal .group-row .badge {
  background: rgba(99, 102, 241, .16);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, .3);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  min-width: 26px;
  text-align: center;
  padding: 2px 7px;
}
#adminModal .group-row .badge.zero { opacity: .5; }
#adminModal .group-row .badge.many { background: rgba(16, 185, 129, .14); color: #6ee7b7; border-color: rgba(16, 185, 129, .3); }
#adminModal .dir-actions, #adminModal .group-actions { display: flex; gap: 5px; }
#adminModal .dir-actions .buttons, #adminModal .group-actions .buttons {
  all: unset;
  cursor: pointer;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: #8f94b8;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  font-size: 11.5px;
  transition: background .12s ease, color .12s ease;
}
#adminModal .dir-actions .buttons:hover, #adminModal .group-actions .buttons:hover {
  background: rgba(139, 92, 246, .22);
  color: #eceefb;
}
#adminModal .visibility-icon, #adminModal .lock-icon, #adminModal .shared-icon {
  color: #8f94b8; font-size: 11.5px;
}
#adminModal .visibility-icon.public { color: #6ee7b7; }
#adminModal .drop-line { height: 4px; border-radius: 2px; margin: 1px 6px; }
#adminModal .drop-line.active { background: #8b5cf6; box-shadow: 0 0 8px rgba(139, 92, 246, .8); }

/* ---------- connexion ---------- */
#adminModal .admin-login { max-width: 360px; margin: 30px auto; display: flex; flex-direction: column; gap: 12px; }

/* ---------- historique utilisateur ---------- */
#userLogsModal .modal-content {
  background: #14142a !important;
  border: 1px solid rgba(139, 122, 246, .25) !important;
  border-radius: 16px !important;
  color: #d9dcf2;
}
#userLogsModal .user-logs-list { list-style: none; margin: 10px 0 0; padding: 0; }
#userLogsModal .user-log-item {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: 13px;
  color: #c7cbe8;
}
#userLogsModal .log-icon { color: #a78bfa; margin-right: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .av2-entete { display: none; }
  .av2-ligne {
    grid-template-columns: 1fr auto;
    grid-auto-flow: row dense;
    row-gap: 6px;
    padding: 12px 14px;
  }
  .av2-ligne .av2-qui { grid-column: 1; }
  .av2-ligne .av2-actes { grid-column: 2; grid-row: 1; }
  .av2-ligne .av2-mail { grid-column: 1 / -1; }
  .av2-ligne .av2-pills-mobiles { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }
  .av2-ligne .av2-date { display: none; }
  .av2-profil-grille { grid-template-columns: 1fr; }
}
@media (min-width: 861px) {
  .av2-ligne .av2-pills-mobiles { display: contents; }
}

/* =============================================================================
   BLINDAGE — les feuilles historiques (base_1, admin.css…) posent des styles
   généreux sur button/select/div ; on force ici les points de structure qui
   ont perdu l'arbitrage au banc du 29.07.
   ========================================================================== */
#adminModal .av2-stats {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
  gap: 10px !important;
}
#adminModal .av2-stat { width: auto !important; margin: 0 !important; }
#adminModal .av2-outils { display: flex !important; flex-wrap: wrap !important; }
#adminModal .av2-outils select {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}
#adminModal .av2-outils .av2-recherche { flex: 1 1 220px !important; }
#adminModal .av2-outils .av2-recherche input { width: 100% !important; margin: 0 !important; }
#adminModal .av2-btn {
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
}
#adminModal .av2-btn.pleine { width: 100% !important; }
#adminModal .av2-oeil button,
#av2Editeur .av2-oeil button {
  position: absolute !important;
  right: 9px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 4px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #8f94b8 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}
#adminModal .av2-acte { width: 30px !important; height: 30px !important; min-width: 30px !important; padding: 0 !important; }
@media (max-width: 860px) {
  #adminModal .admin-tabs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box;
  }
  #adminModal .admin-tabs button {
    display: inline-flex !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }
}
