/* ═══════════════════════════════════════════════════════════════════
   attack-paths.css — Graphe de chemins d'attaque
   ═══════════════════════════════════════════════════════════════════ */

/* ── Summary KPIs ── */
.ap-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.ap-kpi {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 16px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ap-kpi--risk {
  border-color: rgba(255,59,92,0.3);
  background: rgba(255,59,92,0.04);
}
.ap-kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  font-family: var(--mono);
}
.ap-kpi-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ── Empty state ── */
.ap-empty {
  text-align: center;
  padding: 40px 20px;
}
.ap-empty-icon {
  font-size: 40px;
  color: var(--accent2);
  margin-bottom: 12px;
}
.ap-empty-text {
  font-size: 14px;
  color: var(--text2);
}

/* ── Path cards ── */
.ap-paths {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-path {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.ap-path-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.ap-path-header:hover {
  background: rgba(255,255,255,0.03);
}

.ap-path-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.ap-path-info {
  flex: 1;
  min-width: 0;
}
.ap-path-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.ap-path-desc {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  line-height: 1.4;
}

.ap-path-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ap-path-sev {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
  letter-spacing: 0.5px;
}
.ap-path-steps {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}

.ap-path-chevron {
  color: var(--text3);
  flex-shrink: 0;
  transition: transform 0.25s;
}
.ap-path--collapsed .ap-path-chevron {
  transform: rotate(-90deg);
}

/* ── Path body / chain ── */
.ap-path-body {
  padding: 20px 24px;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}
.ap-path--collapsed .ap-path-body {
  display: none;
}

.ap-chain {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ap-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* ── Node ── */
.ap-node {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  transition: all 0.15s;
  cursor: default;
}
.ap-node--matched {
  border-color: var(--node-color, var(--border));
  background: color-mix(in srgb, var(--node-color) 5%, transparent);
}
.ap-node--matched[onclick] {
  cursor: pointer;
}
.ap-node--matched[onclick]:hover {
  background: color-mix(in srgb, var(--node-color) 10%, transparent);
}
.ap-node--unmatched {
  opacity: 0.45;
  border-style: dashed;
}

.ap-node-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.ap-node-info {
  flex: 1;
  min-width: 0;
}
.ap-node-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ap-node-role {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text3);
  letter-spacing: 0.5px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ap-node-count {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--node-color, var(--text3));
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.ap-node-check {
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.ap-node-check--miss {
  color: var(--text3);
  opacity: 0.4;
}

/* ── Connector ── */
.ap-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  margin-left: 38px;
  height: 24px;
  position: relative;
}
.ap-connector-line {
  width: 2px;
  height: 16px;
  background: var(--border);
}
.ap-connector-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}

/* ── Node findings detail ── */
.ap-node-findings {
  margin-left: 44px;
  margin-top: 6px;
  margin-bottom: 4px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 500px;
}
.ap-node-findings.hidden {
  display: none;
}

.ap-finding {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
}
.ap-finding-sev {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  width: 55px;
}
.ap-finding-svc {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  flex-shrink: 0;
}
.ap-finding-check {
  color: var(--text2);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── MITRE ATT&CK references ── */
.ap-mitre-ref {
  background: rgba(99,102,241,0.15) !important;
  color: #818cf8 !important;
  border: 1px solid rgba(99,102,241,0.3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.ap-mitre-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 8px;
}
.ap-mitre-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  color: #818cf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-right: 4px;
}
.ap-mitre-sep {
  color: var(--border);
  font-size: 14px;
  margin: 0 2px;
}
.ap-mitre-tactic {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99,102,241,0.10);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.20);
  white-space: nowrap;
}
.ap-mitre-tech {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(239,68,68,0.08);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.18);
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.ap-mitre-tech:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.35);
  color: #fca5a5;
}

/* Node-level MITRE badges */
.ap-node-tactic {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(99,102,241,0.10);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.18);
  letter-spacing: 0.3px;
}
.ap-node-tech {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(239,68,68,0.06);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.15);
  text-decoration: none;
  transition: background 0.15s;
}
.ap-node-tech:hover {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .ap-summary {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .ap-kpi {
    min-width: 80px;
  }
  .ap-node {
    max-width: 100%;
  }
  .ap-node-findings {
    max-width: 100%;
  }
}

/* ── Confiance & Corrélation ── */
.ap-path-confidence {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.ap-path-confidence--high {
  background: #10b98118;
  color: #10b981;
  border: 1px solid #10b98130;
}
.ap-path-confidence--medium {
  background: #f59e0b18;
  color: #f59e0b;
  border: 1px solid #f59e0b30;
}

.ap-resources-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: var(--bg3, #1a1a2e);
  border-radius: 8px;
  flex-wrap: wrap;
}
.ap-resources-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}
.ap-resource-id {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 4px;
  color: var(--accent);
  font-family: monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-resources-more {
  font-size: 10px;
  color: var(--text3);
}

.ap-finding--correlated {
  border-left: 2px solid #10b981;
  padding-left: 6px;
}
.ap-finding-correlated {
  font-size: 11px;
  margin-right: 2px;
}

/* ════════════════════════════════════════════════════════════════════
   THREAT MODEL IA — Styles
   ════════════════════════════════════════════════════════════════════ */

/* Trigger button */
.tm-trigger {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.tm-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.tm-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.25));
  border-color: rgba(99,102,241,0.5); transform: translateY(-1px);
}
.tm-hint { font-size: 11px; color: var(--text4); }

/* Loading */
.tm-loading {
  display: flex; align-items: center; gap: 10px;
  color: #a5b4fc; font-size: 13px;
}
.tm-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(99,102,241,0.2);
  border-top-color: #6366f1; border-radius: 50%;
  animation: tm-spin 0.8s linear infinite;
}
@keyframes tm-spin { to { transform: rotate(360deg); } }

.tm-error { color: var(--danger); font-size: 13px; }
.tm-empty { color: var(--text4); font-size: 13px; text-align: center; padding: 20px; }

/* Section */
.tm-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

.tm-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.tm-header-icon { color: #818cf8; }
.tm-header-title { font-size: 15px; font-weight: 700; color: var(--text1); }
.tm-tag--ai {
  background: rgba(99,102,241,0.15); color: #a5b4fc;
  padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
  text-transform: uppercase;
}

/* Executive Summary */
.tm-exec-summary {
  background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.15);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
}
.tm-exec-summary p { color: var(--text2); font-size: 13px; line-height: 1.6; margin: 0; }

/* Threat Matrix KPIs */
.tm-matrix {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.tm-kpi {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; text-align: center;
}
.tm-kpi-value { font-size: 18px; font-weight: 800; color: var(--text1); }
.tm-kpi-label { font-size: 10px; color: var(--text4); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Scenarios */
.tm-scenarios { display: flex; flex-direction: column; gap: 12px; }

.tm-scenario {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.tm-scenario--collapsed .tm-scenario-body { display: none; }

.tm-scenario-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer; transition: background .15s;
}
.tm-scenario-header:hover { background: rgba(255,255,255,0.02); }

.tm-scenario-num {
  font-size: 13px; font-weight: 800; color: #818cf8;
  background: rgba(99,102,241,0.1); border-radius: 6px;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tm-scenario-info { flex: 1; min-width: 0; }
.tm-scenario-title { font-size: 14px; font-weight: 700; color: var(--text1); }
.tm-scenario-actor { display: flex; gap: 6px; margin-top: 4px; }

.tm-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,0.06); color: var(--text3);
  white-space: nowrap;
}
.tm-tag--motive { color: #f59e0b; background: rgba(245,158,11,0.1); }

.tm-scenario-score { text-align: center; flex-shrink: 0; }
.tm-scenario-score-val { font-size: 20px; font-weight: 800; }
.tm-scenario-score-lbl { font-size: 9px; color: var(--text4); text-transform: uppercase; }

.tm-chevron { color: var(--text4); flex-shrink: 0; transition: transform .2s; }
.tm-scenario--collapsed .tm-chevron { transform: rotate(-90deg); }

/* Scenario body */
.tm-scenario-body { padding: 0 16px 16px; }

/* Narrative */
.tm-narrative {
  background: rgba(255,255,255,0.02); border-left: 3px solid #818cf8;
  padding: 12px 14px; border-radius: 0 8px 8px 0; margin-bottom: 16px;
}
.tm-narrative-label { font-size: 10px; color: #818cf8; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.5px; }
.tm-narrative p { color: var(--text2); font-size: 13px; line-height: 1.65; margin: 0; }

/* Section labels */
.tm-section-label {
  font-size: 10px; color: var(--text4); text-transform: uppercase;
  font-weight: 700; letter-spacing: 0.5px; margin-bottom: 10px;
}

/* Kill Chain timeline */
.tm-killchain { margin-bottom: 16px; }
.tm-kc-timeline { display: flex; flex-direction: column; gap: 2px; }

.tm-kc-step {
  background: rgba(255,255,255,0.02); border-radius: 6px;
  padding: 10px 12px;
}
.tm-kc-phase {
  font-size: 9px; color: #818cf8; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.tm-kc-action { font-size: 12px; color: var(--text2); margin-top: 3px; }
.tm-kc-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.tm-kc-finding {
  font-size: 10px; color: var(--text4); background: rgba(255,255,255,0.04);
  padding: 1px 6px; border-radius: 3px; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tm-kc-arrow { color: var(--text4); text-align: center; font-size: 10px; line-height: 1; }

/* CIA Impact */
.tm-impact-grid { margin-bottom: 16px; }
.tm-cia { display: flex; gap: 10px; margin-bottom: 8px; }
.tm-cia-item {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; text-align: center; flex: 1;
}
.tm-cia-item--cost { flex: 2; }
.tm-cia-label { font-size: 10px; color: var(--text4); font-weight: 700; display: block; }
.tm-cia-value { font-size: 13px; font-weight: 700; display: block; margin-top: 2px; }
.tm-impact-desc { font-size: 12px; color: var(--text3); margin: 0; }

/* Exploit detail tags */
.tm-exploit-detail { display: flex; gap: 6px; flex-wrap: wrap; }

/* Recommendations */
.tm-recs { margin-top: 20px; }
.tm-rec {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tm-rec:last-child { border-bottom: none; }
.tm-rec-priority {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(99,102,241,0.1); color: #818cf8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; flex-shrink: 0;
}
.tm-rec-content { flex: 1; min-width: 0; }
.tm-rec-action { font-size: 13px; color: var(--text1); font-weight: 600; }
.tm-rec-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.tm-rec-blocks { font-size: 10px; color: var(--text4); }
.tm-rec-rationale { font-size: 11px; color: var(--text4); margin-top: 4px; font-style: italic; }

/* Footer */
.tm-footer { text-align: right; margin-top: 12px; }
.tm-footer-ts { font-size: 10px; color: var(--text4); }

/* Responsive */
@media (max-width: 768px) {
  .tm-matrix { grid-template-columns: repeat(2, 1fr); }
  .tm-cia { flex-wrap: wrap; }
  .tm-scenario-header { flex-wrap: wrap; }
}
