/* ============================================================
   Module Agent — la vue Marexcode s'ouvre en page complète plein
   écran (positionnement du CSS généré marex-agents.css, intact).
   Ce fichier ne gère que l'état du bouton module "Agents".
   ============================================================ */

/* Bouton du module Agent : module réel, pas "dev" */
.dev-module-btn[data-module="agents"]{
  opacity:1;
  border-style:solid;
  color:var(--text);
}
.dev-module-btn[data-module="agents"].active{
  background:var(--accent-light, rgba(94,200,242,.16));
  border-color:var(--accent, #5EC8F2);
  color:var(--text);
}

/* Pastille d'activité : au moins un agent en cours d'exécution.
   Visible même quand la vue Agents est fermée. */
.dev-module-btn[data-module="agents"]{
  position:relative;
}
.dev-module-btn[data-module="agents"] .mod-activity-dot{
  position:absolute;
  top:7px;
  right:9px;
  width:8px;
  height:8px;
  border-radius:50%;
  background:#3ddc84;
  pointer-events:none;
}
.dev-module-btn[data-module="agents"].has-running .mod-activity-dot{
  animation:mod-dot-pulse 1.6s ease-out infinite;
}
@keyframes mod-dot-pulse{
  0%{box-shadow:0 0 0 0 rgba(61,220,132,.55);}
  70%{box-shadow:0 0 0 7px rgba(61,220,132,0);}
  100%{box-shadow:0 0 0 0 rgba(61,220,132,0);}
}

/* Bouton Thinking : allumé = couleur (accent), éteint = noir et blanc. */
#marex-view #mx-think.off{
  filter:grayscale(1);
  opacity:.55;
  color:var(--text-primary);
  background:transparent;
}
#marex-view #mx-think.off:hover{
  filter:grayscale(1);
  opacity:.8;
}

/* Pièces jointes du composer Agents : chips + alerte vision. */
#marex-view .mx-attach-row{
  display:flex; flex-wrap:wrap; gap:6px;
  padding:6px 14px 0;
}
#marex-view .mx-attach-chip{
  display:inline-flex; align-items:center; gap:6px;
  max-width:220px; padding:3px 6px 3px 8px;
  font-size:11px; color:var(--text-primary);
  background:var(--bg-input-btn); border:1px solid var(--border);
  border-radius:20px; white-space:nowrap;
}
#marex-view .mx-attach-chip .n{
  overflow:hidden; text-overflow:ellipsis;
}
#marex-view .mx-attach-chip button{
  border:none; background:transparent; color:var(--text-secondary);
  cursor:pointer; font-size:12px; line-height:1; padding:0 2px;
}
#marex-view .mx-attach-chip button:hover{ color:var(--danger, #e05252); }
#marex-view .mx-vision-warn{
  margin:6px 14px 0; padding:8px 10px;
  font-size:11.5px; line-height:1.5; color:#f0b429;
  background:rgba(240,180,41,.08); border:1px solid rgba(240,180,41,.35);
  border-radius:8px;
}
#marex-view .mx-vision-warn button{
  margin:2px 4px 2px 0; padding:2px 8px; font-size:11px;
  color:var(--text-primary); background:var(--bg-input-btn);
  border:1px solid var(--border); border-radius:12px; cursor:pointer;
}
#marex-view .mx-vision-warn button:hover{ border-color:var(--accent); }
/* Champ de recherche dans le menu projet. */
#marex-view .cdrop-search{
  width:calc(100% - 12px); margin:6px;
  padding:6px 8px; font-size:12px; color:var(--text-primary);
  background:var(--bg-input, rgba(255,255,255,.04));
  border:1px solid var(--border); border-radius:8px; outline:none;
}
#marex-view .cdrop-search:focus{ border-color:var(--accent); }
/* Description sous les actions du menu +. */
#marex-view .cdrop-item-desc{
  font-size:11px; color:var(--text-secondary);
  padding:0 12px 8px; line-height:1.4;
}

/* La modale "Nouveau projet" / lecteur de fichiers doit passer AU-DESSUS
   de la vue Agents plein écran (z-index 400) et de la Configuration (1000).
   (Fichier généré marex-agents.css intact : override dans cette couche.) */
.mx-modal-overlay{
  z-index:1500;
}

/* ---- Modale "Nouveau projet" : suit le thème + la palette ----
   marex-agents.css force des variables sombres en dur sur .mx-modal-overlay
   (fichier généré : on surcharge ici, sans le toucher). */
/* L'accent suit la palette choisie (html[data-palette]), quel que soit le thème. */
.mx-modal-overlay{
  --accent:inherit;
}
/* Thème clair : fond blanc, champs et textes du thème clair. */
html[data-theme="clair"] .mx-modal-overlay{
  --bg-panel:#ffffff;
  --bg-input-btn:#f4f5f7;
  --border:#d7dce3;
  --text-primary:#1a1d21;
  --text-secondary:#5b6470;
  --text-tertiary:#8a93a0;
  --bg-hover:rgba(0,0,0,.05);
  color-scheme:light;
  background:rgba(15,23,42,.45);
}

/* ---- Sidebar Agents : sections Projets / Discussions restructurées ----
   Les intitulés de groupe (PROJETS, DISCUSSIONS) sont eux-mêmes les toggles :
   plus de sous-sections « Projet actif » / « Mes projets » /
   « Toutes les discussions » redondantes. */
#marex-view .sb-group-toggle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  padding:12px 10px 2px;
  background:transparent;
  border:none;
  cursor:pointer;
  font-family:inherit;
  border-radius:6px;
}
#marex-view .sb-group-toggle:hover{ background:var(--bg-hover); }
#marex-view .sb-group-toggle .sb-group-label{ padding:0; }
#marex-view .sb-group-toggle svg{
  color:var(--text-tertiary);
  transition:transform .15s ease;
  flex-shrink:0;
}
#marex-view .sb-group-toggle svg.collapsed{ transform:rotate(-90deg); }

/* Badge « Actif » sur le projet courant. */
#marex-view .sb-active-badge{
  font-size:10px;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--accent);
  background:var(--bg-hover);
  border:1px solid var(--border);
  padding:1px 7px;
  border-radius:999px;
  margin-left:auto;
  flex-shrink:0;
}
#marex-view #mx-active-icon{ display:inline-flex; flex-shrink:0; }

/* Détail du projet actif (Projet local / user@host:path), sous le nom. */
#marex-view .sb-active-sub{
  font-size:11px;
  color:var(--text-tertiary);
  padding:0 10px 4px 32px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Mini-intitulé « Tous les projets » au-dessus de la liste. */
#marex-view .sb-mini-label{
  font-size:10.5px;
  letter-spacing:.07em;
  text-transform:uppercase;
  color:var(--text-tertiary);
  font-weight:700;
  padding:10px 10px 2px;
}

/* ============================================================
   Vue Agents : compléments au thème clair
   (Fait suite au bloc #marex-view.light du CSS généré, laissé
   intact : les surcharges vivent dans cette couche.)
   But : en thème « clair », aucune couleur sombre en dur ne doit
   subsister — tout reste lisible sur fond clair, et l'accent suit
   la palette de l'app (synchro JS : .light + data-accent).
   ============================================================ */

/* Contrôles natifs (scrollbars, cases à cocher…) en mode clair. */
#marex-view.light{ color-scheme:light; }

/* Titres de groupes (PROJETS, DISCUSSIONS…) : le bleu clair du thème
   sombre (#6EA8FE) serait illisible sur fond blanc → bleu soutenu. */
#marex-view.light .sb-group-label{ color:#1a56db; }

/* Blocs de code : fond clair en thème clair (la feuille hljs claire
   est activée par theme-init quand le thème est « clair »). */
#marex-view.light{ --bg-code:#eef1f5; }
#marex-view.light .msg.assistant .md pre{ background:var(--bg-code); }
#marex-view.light .md pre code{ color:#1a1c21; }

/* Bouton stop : pastille rouge lisible sur fond clair. */
#marex-view.light .stop-btn{ background:#f7dede; border-color:#eeb9b9; color:#c0392b; }
#marex-view.light .stop-btn:hover{ background:#f3d2d2; }

/* Erreurs du journal : même traitement que .msg.error en clair. */
#marex-view.light .mx-chat-log .message-error{ background:#fdecec; color:#a12626; border-color:#f3c2c2; }

/* Checklist TodoWrite : le jaune pur est illisible sur blanc. */
#marex-view.light .chat-todo-header,
#marex-view.light .chat-todo-item,
#marex-view.light .chat-todo-item .todo-icon,
#marex-view.light .chat-todo-item .todo-content,
#marex-view.light .chat-todo-item.todo-completed .todo-content,
#marex-view.light .chat-todo-item.todo-completed .todo-icon{ color:#8a6d00 !important; }

/* Diff +/- : verts/rouges lisibles sur fond clair. */
#marex-view.light .diff-add{ background:rgba(46,160,67,.12); color:#1a7f37; border-left-color:#1a7f37; }
#marex-view.light .diff-del{ background:rgba(248,81,73,.10); color:#d1242f; border-left-color:#d1242f; }

/* Élément sélectionné des menus déroulants. */
#marex-view.light .cdrop-item.selected{ background:#e8ebf0; }

/* Zone de saisie des instructions (modale interne à la vue). */
#marex-view.light .modal-instructions-textarea{ background:#f4f5f7; }

/* Icônes ambre (favoris, toggle agent, historique) : assombries sur fond clair. */
#marex-view.light .agent-toggle-btn.active{ color:#b8860b; filter:none; }
#marex-view.light .mx-fav-btn.active{ color:#c9930a; }
#marex-view.light .mx-fav-btn.active svg{ fill:#c9930a; }
#marex-view.light .sb-hist-favorite.active{ color:#c9930a; }
