/* SuperAgents — superagents-base.css
 * Module : base
 * Généré depuis index.html
 */

:root {
  --zen-primary: #2DD4A8;
  --zen-primary-dark: #1AB690;
  --zen-primary-light: #8EECD8;
  --zen-gradient-start: #43E8C2;
  --zen-gradient-end: #36B8E0;
  --zen-bg: #f3f6f6;
  --zen-bg-deep: #e8eded;
  --zen-surface: #FFFFFF;
  --zen-surface-hover: #f7f9f9;
  --zen-text: #1A2E35;
  --zen-text-secondary: #5A7A84;
  --zen-text-muted: #8FA8B0;
  --zen-border: #d5dede;
  --zen-shadow: rgba(45, 212, 168, 0.12);
  --zen-shadow-strong: rgba(45, 212, 168, 0.25);
  --zen-danger: #F06565;
  --zen-warning: #F0A500;
  --zen-info: #36B8E0;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Plus Jakarta Sans', 'DM Sans', -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--zen-bg) 0%, var(--zen-bg-deep) 50%, #e2e8e8 100%);
  color: var(--zen-text);
  overflow: hidden;
}

/* ── LAYOUT ─────────────────────────────── */
.app-shell { display: flex; height: 100vh; position: relative; }

/* ── SIDEBAR ────────────────────────────── */
.sidebar {
  width: 290px; min-width: 290px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F0FDF9 100%);
  border-right: 1px solid var(--zen-border);
  display: flex; flex-direction: column; z-index: 20;
  box-shadow: 2px 0 20px rgba(0,0,0,0.04);
}

.sidebar-header { padding: 20px 18px 14px; border-bottom: 1px solid var(--zen-border); }

.sidebar-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.sidebar-logo svg { width: 30px; height: 30px; }
.sidebar-logo h1 {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--zen-primary) 0%, var(--zen-gradient-end) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.sidebar-tagline {
  font-size: 11px; color: var(--zen-text-muted); font-weight: 600;
  letter-spacing: 0.8px; text-transform: uppercase; margin-left: 40px;
}

.sidebar-section-title {
  padding: 14px 18px 6px; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--zen-text-muted);
}

.sidebar-section-title.team-title {
  display: flex; align-items: center; gap: 6px;
}

.sidebar-section-title .team-count {
  background: var(--zen-primary); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 10px; font-weight: 800;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding-bottom: 12px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--zen-border); border-radius: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent; font-size: 14px; font-weight: 500;
  color: var(--zen-text-secondary); position: relative;
}
.nav-item:hover { background: var(--zen-surface-hover); color: var(--zen-text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(45,212,168,0.1), transparent);
  border-left-color: var(--zen-primary); color: var(--zen-primary-dark); font-weight: 600;
}

.nav-item.manager {
  border-left: 3px solid var(--zen-warning);
  background: linear-gradient(90deg, rgba(240,165,0,0.06), transparent);
}
.nav-item.manager.active {
  border-left-color: var(--zen-warning);
  background: linear-gradient(90deg, rgba(240,165,0,0.12), transparent);
}

.nav-avatar {
  width: 36px; height: 36px; border-radius: 12px;
  object-fit: cover; border: 2px solid var(--zen-border); flex-shrink: 0;
}

.nav-avatar-placeholder {
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}

.nav-item-info { flex: 1; min-width: 0; }
.nav-item-name {
  font-size: 14px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; line-height: 1.3;
}
.nav-item-role {
  font-size: 10.5px; color: #3A4A52; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 3px;
}

.nav-badge-manager {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; background: var(--zen-primary);
  color: #fff; padding: 2px 6px; border-radius: 6px;
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
}
.nav-task-indicator {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
}
.nav-task-indicator .spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid var(--zen-border);
  border-top-color: var(--zen-primary);
}

.nav-separator {
  height: 1px; background: var(--zen-border); margin: 6px 18px;
}

.btn-new-agent {
  margin: 10px 14px; padding: 11px 14px; border-radius: var(--radius-md);
  border: 2px dashed var(--zen-primary); background: rgba(45,212,168,0.06);
  color: var(--zen-primary-dark); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.btn-new-agent:hover {
  background: rgba(45,212,168,0.15); border-color: var(--zen-primary-dark);
  transform: translateY(-1px);
}

/* ── BATCH SIDEBAR ───────────────────────── */
.batch-sidebar-section {
  border-top: 1px solid var(--zen-border);
  padding: 10px 0 4px;
  display: none; /* affiché seulement si batchs actifs */
}
.batch-sidebar-header {
  padding: 0 18px 6px;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--zen-text-muted);
  display: flex; align-items: center; gap: 6px;
}
.batch-sidebar-header .batch-active-count {
  background: var(--zen-warning); color: #fff;
  font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 800;
}
.batch-card {
  margin: 3px 10px; padding: 9px 12px;
  background: #fff; border: 1px solid var(--zen-border);
  border-radius: var(--radius-md); cursor: default;
  transition: var(--transition);
}
.batch-card:hover { background: var(--zen-surface-hover); }
.batch-card-header {
  display: flex; align-items: center; gap: 7px; margin-bottom: 5px;
}
.batch-card-icon { font-size: 15px; flex-shrink: 0; }
.batch-card-label {
  flex: 1; font-size: 12px; font-weight: 600;
  color: var(--zen-text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.batch-card-status {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 8px; flex-shrink: 0;
}
.batch-card-status.running {
  background: rgba(45,212,168,0.15); color: var(--zen-primary-dark);
}
.batch-card-status.completed {
  background: rgba(45,212,168,0.2); color: #1a8a6a;
}
.batch-card-status.failed {
  background: rgba(240,101,101,0.15); color: var(--zen-danger);
}
.batch-card-status.pending {
  background: rgba(240,165,0,0.15); color: #b07800;
}
.batch-card-status.cancelling {
  background: rgba(240,101,101,0.1); color: var(--zen-danger);
  animation: pulse-danger 1s infinite;
}
@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.batch-progress-bar {
  height: 5px; background: var(--zen-bg-deep);
  border-radius: 10px; overflow: hidden; margin-bottom: 4px;
}
.batch-progress-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--zen-primary), var(--zen-gradient-end));
  transition: width 0.5s ease;
}
.batch-card-meta {
  font-size: 10.5px; color: var(--zen-text-muted);
  display: flex; justify-content: space-between; align-items: center;
}
.batch-card-tokens {
  font-size: 10px; color: var(--zen-text-muted);
  margin-top: 3px; display: flex; justify-content: space-between;
}
.batch-cancel-btn {
  background: none; border: 1px solid var(--zen-danger);
  color: var(--zen-danger); border-radius: 6px;
  font-size: 10px; padding: 2px 7px; cursor: pointer;
  font-weight: 600; line-height: 1.4;
  transition: all 0.2s;
}
.batch-cancel-btn:hover { background: rgba(240,101,101,0.1); }
.conv-token-badge {
  font-size: 10.5px; color: var(--zen-primary-dark);
  background: rgba(45,212,168,0.1);
  border: 1px solid rgba(45,212,168,0.3);
  padding: 3px 8px;
  border-radius: 8px; font-weight: 700;
  cursor: help;
}

/* ── BATCH TOAST ─────────────────────────── */
#batch-toast-container {
  position: fixed; top: 18px; right: 22px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.batch-toast {
  background: #fff; border: 1px solid var(--zen-border);
  border-radius: var(--radius-md); padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 340px;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.batch-toast.toast-out {
  animation: toastOut 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}
.batch-toast-icon { font-size: 20px; flex-shrink: 0; }
.batch-toast-body { flex: 1; }
.batch-toast-title { font-size: 13px; font-weight: 700; color: var(--zen-text); }
.batch-toast-sub   { font-size: 11px; color: var(--zen-text-muted); margin-top: 1px; }
.batch-toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--zen-text-muted); font-size: 16px; flex-shrink: 0;
  padding: 0 2px; line-height: 1;
}
.batch-toast-close:hover { color: var(--zen-text); }

.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid var(--zen-border);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar-small {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-gradient-end));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.user-info-small { flex: 1; }
.user-info-small .name { font-size: 12.5px; font-weight: 600; }
.user-info-small .status {
  font-size: 10.5px; color: var(--zen-primary);
  display: flex; align-items: center; gap: 4px;
}
.user-info-small .status::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--zen-primary);
}

/* ── MAIN ───────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.view { display: none; flex-direction: column; height: 100%; min-height: 0; }
.view.active { display: flex; }
#view-analytics {
  overflow-y: auto;
  padding: 24px 32px;
}
/* Masquer les indicateurs non pertinents dans analytics — géré via JS */
/* Override CSS analytics : icônes et cellules du tableau */
.zb_app_cell { display: flex !important; align-items: center !important; gap: 10px !important; padding-left: 4px !important; }
.zb_app_icon { flex-shrink: 0 !important; }
.zb_app_name { font-weight: 500 !important; }
#zb_sessionsTableBody tr { border-bottom: 1px solid var(--zen-border); }
#zb_sessionsTableBody tr:last-child { border-bottom: none; }
#zb_sessionsTableBody td { padding: 10px 14px !important; vertical-align: middle !important; }
#view-analytics #zb_analytics_container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding-left: 8px;
}


/* ── Bouton ✕ suppression agent dans la sidebar ── */
.nav-item-remove {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,0.95); border: 1px solid rgba(239,68,68,0.4);
  color: #EF4444; font-size: 9px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: all 0.15s ease; z-index: 10; padding: 0; line-height: 1; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12); font-weight: 700;
}
.nav-item:hover .nav-item-remove { display: flex; }
.nav-item-remove:hover {
  background: #EF4444; color: #fff; border-color: #EF4444;
  transform: translateY(-50%) scale(1.15);
}
