:root { --bg:#0b1020; --card:#131a2a; --muted:#96a0b5; --text:#e7ecf6; --accent:#4da3ff; }
* { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial; background: var(--bg); color: var(--text); }

/* Largeur pages (élargi) */
.wrap { max-width: 1360px; margin: 24px auto; padding: 0 16px; }
@media (min-width:1600px){ .wrap{ max-width: 1440px; } }

.card { background: var(--card); border: 1px solid #1d2744; border-radius: 14px; padding: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.muted { color: var(--muted); }
.pill { padding: 4px 8px; border-radius: 999px; background: #0d1528; border: 1px solid #1f2c4f; font-size: 12px; }
.subtle { font-size: 12px; color: var(--muted); margin-top: 4px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mb16 { margin-bottom: 16px; }
.mt10 { margin-top: 10px; }
.title-lg { font-size: 18px; font-weight: 700; }

/* Header + Nav */
.site-header { background: linear-gradient(180deg, #121a2f, #0f1628); border-bottom:1px solid #1d2744; }
.site-header .inner { max-width: 1360px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
@media (min-width:1600px){ .site-header .inner{ max-width: 1440px; } }
.brand { font-weight: 700; letter-spacing:.2px; }
.main-nav { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.nav-link { padding: 8px 12px; border-radius: 10px; background:#0e1629; border:1px solid #24345f; color: var(--text); text-decoration: none; }
.nav-link.active { background: linear-gradient(180deg,#1b2540,#141b2d); border-color:#2b3a69; }

/* Tabs (dans la page usergroups) */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { padding: 10px 14px; border-radius: 10px; background: var(--card); color: var(--muted); text-decoration: none; border: 1px solid #1d2744; }
.tab.active { background: linear-gradient(180deg, #1b2540, #141b2d); color: var(--text); border-color: #233059; }

/* Tableau */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
thead th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid #223055; position: sticky; top: 0; background: var(--card); }
tbody td { padding: 10px 8px; border-bottom: 1px solid #1b274a; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1b2540; }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pagination.center { justify-content: center; }
.pagination.mini { gap: 4px; margin-top: 8px; }
.pagination.mini .page { padding: 4px 8px; font-size: 12px; }
.page { padding: 6px 10px; border-radius: 8px; background: #10182a; border: 1px solid #1b274a; color: var(--text); text-decoration: none; }
.page.active { background: #1b2540; border-color: #2b3a69; font-weight: 600; }

/* Toolbar (titre + filtres + export 1re ligne, pagination 2e) */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-start; }
.filters { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:8px; }
.filters input[type="text"], .filters select { background:#0e1629; border:1px solid #24345f; color:var(--text); padding:8px 10px; border-radius:10px; }
.filters .btn { background:#0e1629; border:1px solid #24345f; color:var(--text); padding:6px 12px; border-radius:10px; text-decoration:none; font-size:14px }
/* Pagination haute : seule sur sa ligne à droite (rien à côté) */
.toolbar > .pagination {
  order: 99;
  width: 100%;
  justify-content: flex-end;
  margin-left: 0;
  white-space: nowrap;
  display: flex;
}

/* Bloc détails (agrandi) */
.details { position: relative; max-height: 420px; overflow: hidden; }
.details.expanded { max-height: 90vh; }
.fade { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(180deg, rgba(19,26,42,0), rgba(19,26,42,1)); pointer-events: none; display: none; }
.details.has-overflow .fade { display: block; }
.aliases, .list { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
/* zone scroll interne (agrandie) */
.scroll-area { max-height: 340px; overflow: auto; border: 1px dashed #24345f; border-radius: 10px; padding: 8px; }

/* Bouton “Afficher plus” */
.show-more {
  position: absolute; right: 12px; bottom: 12px;
  display: none; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: linear-gradient(180deg, #1e2a4a, #16213a);
  border: 1px solid #2b3a69; color: var(--text);
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4);
  font-weight: 600;
}
.show-more .caret { font-size: 12px; opacity: .9; }
.details.has-overflow .show-more { display: inline-flex; }
.show-more:hover { filter: brightness(1.08); }

/* Pastilles Oui=rouge / Non=vert */
.bool { display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid; }
.bool .dot { width:8px; height:8px; border-radius:50%; background:currentColor; display:inline-block; }
.bool.yes { background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.45); color: #ffb3b3; }
.bool.no  { background: rgba(139,212,80,.12); border-color: rgba(139,212,80,.45); color: #bff3a1; }

/* Tri */
.th-sort { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.th-sort .caret { font-size: 10px; opacity: 0.85; }
.th-sort:not(.active) .caret { opacity: 0.25; }

/* Overlay recherche live */
#liveOverlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(11,16,32,0.4); backdrop-filter: blur(1.5px); z-index: 1000;
}
#liveOverlay.show { display: flex; }
#liveOverlay .box {
  background: var(--card); border: 1px solid #1d2744; padding: 10px 14px; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); font-weight: 600;
}
/* Permet au header de passer à la ligne */
.site-header .inner { flex-wrap: wrap; }

/* Barre d'actions centrée dans le header (form select + bouton) */
.header-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 10px;   /* décolle du bas du header */
}
.header-actions .filters { margin: 0; } /* supprime le petit offset par défaut */

/* Boutons d'export : base */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .04s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

/* Variante encadrée (outline) */
.btn-outline {
  border: 1px solid rgba(0,0,0,.15);
  background: transparent;
  color: inherit;
}
.btn-outline:hover { background: rgba(0,0,0,.04); }
.btn-outline:active { transform: translateY(1px); }
.btn-outline:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .25);
}

/* Icône intégrée */
.btn-export .ico {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
}
.btn-export .ico svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Placement à droite dans les barres d'outils */
.toolbar .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* En-tête du bloc détails : bouton export en haut à droite */
.card.details .header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

/* Variante compacte si besoin */
.btn-export--sm {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

/* Dark mode (optionnel) */
@media (prefers-color-scheme: dark) {
  .btn-outline { border-color: rgba(255,255,255,.25); }
  .btn-outline:hover { background: rgba(255,255,255,.06); }
}
/* Version ciblée page doublons */
#list .toolbar .right { margin-left: auto; }
html {
  scrollbar-gutter: stable;            /* ou: stable both-edges pour layouts centrés */
}

/* Si ton conteneur principal scrolle à la place du body, applique-le dessus aussi */
.wrap, .scroll-area {
  scrollbar-gutter: stable;
}
/* style générique pour les <select> */
select {
  appearance: none;          /* enlève le style natif (Chrome, Safari) */
  -webkit-appearance: none;  /* idem WebKit */
  -moz-appearance: none;     /* idem Firefox */

  /* flèche lisible dans le thème sombre */
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23e7ecf6' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

/* supprime le caret de IE */
select::-ms-expand {
  display: none;
}
/* Harmonisation des champs <select> dans les filtres */
.header-actions .filters select {
  display: inline-block;
  width: 380px;              /* largeur fixe et stable */
  height: 42px;              /* même hauteur que les anciens boutons */
  padding: 0 40px 0 12px;    /* espace interne + réserve pour la flèche */
  font-size: 14px;           /* taille de police uniforme */
  line-height: 1.4;
  font-family: inherit;      /* hérite de la police globale */
  color: var(--text);
  background: #0e1629;
  border: 1px solid #24345f;
  border-radius: 10px;
  box-sizing: border-box;
  cursor: pointer;

  /* flèche personnalisée */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23e7ecf6' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;

  /* gestion des textes longs */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hover / focus pour feedback visuel */
.header-actions .filters select:hover {
  border-color: #2b3a69;
  background: #141b2d;
}
.header-actions .filters select:focus {
  outline: none;
  border-color: #4da3ff;
  box-shadow: 0 0 0 3px rgba(77,163,255,.25);
}
/* === Modales & popovers — thème sombre unifié === */

/* Ta popover de droits */
.perms-popover {
  background: var(--card) !important;
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.45) !important;
  border-radius: 12px !important;
}
.perms-popover .title { color: var(--text) !important; }
.perms-popover .muted { color: var(--muted) !important; }
.perms-popover a { color: var(--accent); }
.perms-popover hr {
  border: 0; height: 1px; background: #223055; margin: 8px 0;
}

/* Inputs / selects à l’intérieur de la modale/popover */
.perms-popover input[type="text"],
.perms-popover input[type="email"],
.perms-popover input[type="search"],
.perms-popover select,
.perms-popover textarea {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: #0e1629; border: 1px solid #24345f; color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px;
  width: 100%;
}
.perms-popover input::placeholder, .perms-popover textarea::placeholder { color: var(--muted); }
.perms-popover select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23a9b4cc' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.perms-popover select::-ms-expand { display: none; }

/* Boutons dans la popover */
.perms-popover .btn {
  background: #0e1629; border: 1px solid #24345f; color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-weight: 600; text-decoration: none;
}
.perms-popover .btn:hover { background: #122041; }

/* ===== Modales "classiques" type Bootstrap-like ===== */
.modal, .modal-dialog, .modal-content {
  background: transparent !important;
}
.modal-backdrop,
.modal-backdrop.show {
  background: rgba(11,16,32,0.60) !important;       /* assombrir l’arrière-plan */
  backdrop-filter: blur(1.5px);
}
.modal-content {
  background: var(--card) !important;
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(0,0,0,.45);
}
.modal-header, .modal-footer {
  background: linear-gradient(180deg, rgba(29,39,68,.35), rgba(29,39,68,0)) !important;
  border-color: #223055 !important;
  color: var(--text) !important;
}
.modal-title { color: var(--text) !important; }
.modal-body { color: var(--text) !important; }
.modal .close, .modal .btn-close {
  filter: invert(85%) saturate(0%) !important;
  opacity: .9;
}
.modal .close:hover, .modal .btn-close:hover { opacity: 1; }

/* Champs dans .modal (mêmes tokens que le reste du thème) */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"],
.modal input[type="search"],
.modal select,
.modal textarea {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: #0e1629; border: 1px solid #24345f; color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; width: 100%;
}
.modal input::placeholder, .modal textarea::placeholder { color: var(--muted); }
.modal select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23a9b4cc' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.modal select::-ms-expand { display: none; }

/* Boutons dans .modal */
.modal .btn {
  background: #0e1629; border: 1px solid #24345f; color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-weight: 600;
}
.modal .btn:hover { background: #122041; }

/* Liens et séparateurs */
.modal a { color: var(--accent); }
.modal hr { border: 0; height: 1px; background: #223055; }

/* ===== Modales <dialog> natives ===== */
dialog[open] {
  background: var(--card) !important;
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,.45);
}
dialog::backdrop {
  background: rgba(11,16,32,0.60);
  backdrop-filter: blur(1.5px);
}
dialog .title, dialog h1, dialog h2, dialog h3 { color: var(--text); }
dialog .muted { color: var(--muted); }
dialog input, dialog select, dialog textarea { 
  background: #0e1629; border: 1px solid #24345f; color: var(--text);
  padding: 8px 12px; border-radius: 10px; width: 100%;
}
/* ===== Patch thème sombre pour usergroups.php (UI uniquement) ===== */

/* Cartes & zones scroll */
.card {
  background: var(--card);
  border: 1px solid #1d2744;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  border-radius: 14px;
}
.scroll-area {
  background: transparent;
  border: 1px dashed #24345f;
  border-radius: 10px;
  padding: 8px;
}

/* En-tête détails */
.title-lg { color: var(--text); }
.subtle   { color: var(--muted); }

/* Pills génériques (alias, compteurs) */
.pill {
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  background:#0d1528; border:1px solid #1f2c4f;
  color: var(--text); font-size:12px; line-height:1;
  text-decoration:none;
}

/* Badges Oui/Non déjà utilisés ailleurs */
.bool { display:inline-flex; align-items:center; gap:6px; padding:2px 8px;
        border-radius:999px; font-size:12px; border:1px solid; }
.bool .dot { width:8px; height:8px; border-radius:50%; background:currentColor; display:inline-block; }
.bool.yes { background: rgba(139,212,80,.12); border-color: rgba(139,212,80,.45); color: #bff3a1; }
.bool.no  { background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.45); color: #ffb3b3; }

/* Tableau principal */
table { width:100%; border-collapse:collapse; }
thead th {
  background: var(--card);
  color: var(--muted);
  font-weight:600; font-size:13px;
  padding:10px 8px;
  border-bottom:1px solid #223055;
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding:10px 8px; border-bottom:1px solid #1b274a; color: var(--text); }
tbody tr { cursor:pointer; }
tbody tr:hover { background:#1b2540; }
.th-sort { color: var(--text); text-decoration:none; display:inline-flex; align-items:center; gap:6px; }
.th-sort .caret { font-size:10px; opacity:.85; }
.th-sort:not(.active) .caret { opacity:.25; }

/* Toolbar & filtres */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.filters { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.filters input[type="text"],
.filters select {
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  background:#0e1629; border:1px solid #24345f; color:var(--text);
  padding:8px 36px 8px 12px; border-radius:10px;
  font-size:14px; line-height:1.2; min-width: 210px;
}
/* flèche des <select> harmonisée */
.filters select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23a9b4cc' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat:no-repeat; background-position:right 10px center; background-size:16px;
}
.filters select::-ms-expand { display:none; }

/* Bouton de réinitialisation */
.filters .btn, .btn {
  display:inline-flex; align-items:center; gap:8px;
  background:#0e1629; border:1px solid #24345f; color:var(--text);
  padding:8px 12px; border-radius:10px; text-decoration:none;
  font-weight:600; line-height:1; cursor:pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.filters .btn:hover, .btn:hover { background:#122041; }
.filters .btn:focus-visible, .btn:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(77,163,255,.25); }

/* Cartes détails : gestion “Afficher plus” */
.details { position:relative; max-height:420px; overflow:hidden; }
.details.expanded { max-height:90vh; }
.fade { position:absolute; left:0; right:0; bottom:0; height:56px;
        background: linear-gradient(180deg, rgba(19,26,42,0), rgba(19,26,42,1));
        pointer-events:none; display:none; }
.details.has-overflow .fade { display:block; }
.show-more {
  position:absolute; right:12px; bottom:12px;
  display:none; align-items:center; gap:8px;
  padding:8px 14px; border-radius:999px;
  background: linear-gradient(180deg, #1e2a4a, #16213a);
  border:1px solid #2b3a69; color:var(--text);
  cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.4); font-weight:600;
}
.details.has-overflow .show-more { display:inline-flex; }

/* Pagination */
.pagination { display:flex; gap:6px; flex-wrap:wrap; margin-top:12px; }
.pagination.center { justify-content:center; }
.page { padding:6px 10px; border-radius:8px; background:#10182a; border:1px solid #1b274a; color:var(--text); text-decoration:none; }
.page.active { background:#1b2540; border-color:#2b3a69; font-weight:600; }

/* Chercheur live overlay */
#liveOverlay { position:fixed; inset:0; display:none; align-items:center; justify-content:center;
               background: rgba(11,16,32,0.4); backdrop-filter: blur(1.5px); z-index:1000; }
#liveOverlay.show .box { background: var(--card); border:1px solid #1d2744; padding:10px 14px; border-radius:12px; }

/* Stabilise la mise en page au changement de page (scrollbar) */
html, .wrap { scrollbar-gutter: stable; }

/* === Modales & popovers — thème sombre plein (pas de transparence) === */

/* Popover droits */
.perms-popover {
  background: var(--card) !important;   /* fond plein du thème */
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.55) !important;
  border-radius: 12px !important;
}

/* Modales Bootstrap-like */
.modal-content {
  background: var(--card) !important;   /* pas transparent */
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(0,0,0,.55);
}
.modal-header, .modal-footer {
  background: var(--card) !important;   /* uniforme avec le contenu */
  border-color: #223055 !important;
}
.modal-body { background: var(--card) !important; }

/* Overlay derrière la modale */
.modal-backdrop,
.modal-backdrop.show {
  background: rgba(11,16,32,0.85) !important;  /* plus sombre, opaque */
}

/* Modales <dialog> */
dialog[open] {
  background: var(--card) !important;
  border: 1px solid #1d2744 !important;
  color: var(--text) !important;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,.55);
}
dialog::backdrop {
  background: rgba(11,16,32,0.85);  /* sombre et opaque */
}

/* SweetAlert2 (si utilisé) */
.swal2-popup {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1px solid #1d2744 !important;
  box-shadow: 0 16px 36px rgba(0,0,0,.55) !important;
}
