/* stats-agents.css */

/* ── Pagination ── */
.gc-pagination {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text3);
}
.gc-pag-controls { display: flex; gap: 5px; align-items: center; }
.gc-pag-btn {
  padding: 5px 11px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.gc-pag-btn:hover:not(:disabled) { border-color: var(--gc-orange); color: var(--gc-orange); }
.gc-pag-btn.active { background: var(--gc-orange); border-color: var(--gc-orange); color: #fff; }
.gc-pag-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Loading header ── */
.sa-load-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}
.sa-load-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.sa-load-meta {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
}

/* ── Chunks grid ── */
.sa-chunks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  max-width: 480px;
  margin-top: 14px;
}

.sa-chunk-dot {
  min-width: 36px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 500;
  transition: all .3s;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text3);
  cursor: default;
  padding: 0 4px;
}

/* En attente */
.sa-chunk-dot { background: var(--surface2); border-color: var(--border); color: var(--text3); }

/* En cours */
.sa-chunk-loading {
  background: rgba(255,79,31,0.08);
  border-color: var(--gc-orange);
  color: var(--gc-orange);
  animation: chunk-pulse .7s ease-in-out infinite;
}
@keyframes chunk-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Terminé */
.sa-chunk-done {
  background: var(--gc-orange);
  border-color: var(--gc-orange-dark);
  color: #fff;
}

/* Erreur */
.sa-chunk-error {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}

/* ── Info chunking ── */
#chunk-info {
  display: none;
  margin-top: 8px;
  background: rgba(255,79,31,0.06);
  border: 1px solid rgba(255,79,31,0.2);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--gc-orange-dark);
  line-height: 1.6;
}

/* ── Période grid étendue ── */
.gc-period-grid { grid-template-columns: 1fr 1fr 1fr; }

/* ══ Sidebar élargie + sélection agents ══ */
.sa-sidebar {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  gap: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  height: calc(100vh - var(--header-h)) !important;
}

/* Zone supérieure scrollable : période + statuts + filtres */
.sa-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Sections dans la zone scrollable */
.sa-sidebar .gc-sidebar-section {
  flex-shrink: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

/* Section agents dans la zone scrollable :
   s'étend à sa hauteur naturelle → l'ascenseur global la révèle */
.sa-sidebar .sa-agents-section {
  flex-shrink: 0;          /* ne pas comprimer */
  min-height: 200px;
  padding: 10px 16px 8px;
  overflow: visible;       /* pas de clip → la liste s'affiche entièrement */
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: none;
}

/* La liste agents s'étend à sa hauteur naturelle dans la scroll area */
.sa-sidebar .sa-agent-list {
  flex: none !important;
  height: auto !important;
  min-height: 150px;
  max-height: none !important;  /* pas de limite → tout s'affiche */
  overflow: visible !important; /* l'ascenseur global gère le scroll */
}

/* Bouton lancer : fixé en bas, jamais caché */
.sa-btn-area {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 2px solid var(--border);
  background: var(--surface);
}

/* Agents section prend l'espace dispo */
.sa-agents-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px !important;
}
.sa-agents-section h3 {
  display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}
.sa-agent-actions { display: flex; gap: 5px; }
.sa-agent-actions button {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px 8px;
  font-size: 10px; font-weight: 600; color: var(--text3);
  cursor: pointer; font-family: var(--font); transition: all .15s;
}
.sa-agent-actions button:hover { border-color: var(--blue); color: var(--blue); }

.sa-agent-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 8px;
}
.sa-agent-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: var(--radius);
  background: var(--surface2); border: 1.5px solid var(--border);
  cursor: pointer; transition: all .12s; user-select: none;
}
.sa-agent-item:hover   { border-color: var(--blue); background: var(--blue-dim); }
.sa-agent-item.selected{ border-color: var(--blue); background: var(--blue-dim); }
.sa-agent-avatar {
  width: 22px; height: 22px; border-radius: 50%; color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sa-agent-info { flex: 1; min-width: 0; }
.sa-agent-name { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-agent-div  { font-size: 10px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-agent-check {
  width: 14px; height: 14px; border-radius: 3px;
  border: 2px solid var(--border2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all .12s;
}
.sa-agent-item.selected .sa-agent-check { background: var(--blue); border-color: var(--blue); }
.sa-agent-item.selected .sa-agent-check::after {
  content: ''; width: 4px; height: 6px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(40deg) translate(-1px,-1px);
}

/* Divisions */
.sa-div-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 120px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface2); padding: 4px;
}
.sa-div-item {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px; border-radius: 5px;
  cursor: pointer; transition: background .1s; user-select: none;
}
.sa-div-item:hover   { background: var(--surface); }
.sa-div-item.selected{ background: var(--blue-dim); }
.sa-div-check {
  width: 13px; height: 13px; border-radius: 3px;
  border: 2px solid var(--border2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all .12s;
}
.sa-div-check.checked { background: var(--blue); border-color: var(--blue); }
.sa-div-check.checked::after {
  content: ''; width: 3px; height: 6px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(40deg) translate(-1px,-1px);
}
.sa-div-name {
  font-size: 11px; font-weight: 600; color: var(--text2);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sa-div-item.selected .sa-div-name { color: var(--blue); }

/* ── Label de groupe dans la liste statuts ── */
.sa-status-group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text3);
  padding: 4px 2px 2px;
}

/* ── Badges supplémentaires ── */
.gc-badge--purple { background: rgba(101,84,192,.12); color: #6554C0; }
.gc-badge--cyan   { background: rgba(0,184,217,.12);  color: #00B8D9; }
.gc-badge--red    { background: rgba(222,53,11,.12);  color: #DE350B; }

/* ── En-tête de groupe statuts avec boutons ── */
.sa-status-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 2px;
}
.sa-group-btns {
  display: flex;
  gap: 4px;
}
.sa-group-btns button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}
.sa-group-btns button:hover {
  border-color: var(--gc-orange);
  color: var(--gc-orange);
}
