/* ==========================================================================
   VORTEX-SDN AI Root-Cause Analysis (RCA) Stylesheet
   Enterprise dark-mode NOC styling with cyan/blue accents and light-mode support
   ========================================================================== */

.rca-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.rca-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(17, 28, 51, 0.95));
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.rca-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.rca-status-badge.analyzing {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.rca-status-badge.resolved {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.rca-status-badge.stable {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.35);
}

.rca-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: rca-pulse 1.8s infinite;
}

@keyframes rca-pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Primary Diagnostics Hero Card */
.rca-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.rca-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
}

.rca-summary-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

@media (max-width: 992px) {
  .rca-summary-grid {
    grid-template-columns: 1fr;
  }
}

.rca-diagnosis-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.rca-diagnosis-incident {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rca-root-cause-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid var(--accent-cyan);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Confidence Gauge Card */
.rca-kpi-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rca-conf-score {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.rca-conf-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.rca-conf-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 999px;
  transition: width 0.6s ease;
}

/* Evidence & Impact 2-Column Grid */
.rca-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 840px) {
  .rca-detail-grid {
    grid-template-columns: 1fr;
  }
}

.rca-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rca-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.rca-panel-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rca-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rca-evidence-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.rca-evidence-bullet {
  color: var(--accent-cyan);
  font-size: 14px;
  line-height: 1.2;
}

.rca-impact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rca-impact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #fca5a5;
}

.rca-action-card {
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rca-action-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34d399;
  font-weight: 700;
}

.rca-action-desc {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2px;
}

/* Event Chain Timeline */
.rca-timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.rca-timeline-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 20px 0;
  gap: 8px;
  overflow-x: auto;
}

.rca-timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 130px;
  position: relative;
  z-index: 2;
}

.rca-step-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  margin-bottom: 6px;
  background: rgba(0, 242, 254, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.rca-step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  margin-bottom: 8px;
}

.rca-step-text {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.3;
}

.rca-step-arrow {
  color: var(--border-strong);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Visual Relationship Graph */
.rca-graph-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rca-graph-container {
  width: 100%;
  min-height: 180px;
  background: rgba(6, 9, 19, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px 12px;
  overflow-x: auto;
  gap: 12px;
}

.rca-node {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 110px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.rca-node:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.rca-node-stage {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.rca-node-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.rca-node.critical {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.08);
}
.rca-node.critical .rca-node-label { color: #f87171; }

.rca-node.warning {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.08);
}
.rca-node.warning .rca-node-label { color: #fbbf24; }

.rca-node.success {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.08);
}
.rca-node.success .rca-node-label { color: #34d399; }

.rca-graph-arrow {
  color: var(--accent-cyan);
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Light Mode Overrides for AI Root Cause Analysis
   ========================================================================== */
[data-theme="light"] .rca-header-banner {
  background: #ffffff;
  border-color: #d8e1ec;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .rca-hero-card,
[data-theme="light"] .rca-panel,
[data-theme="light"] .rca-timeline-card,
[data-theme="light"] .rca-graph-card {
  background: #ffffff;
  border-color: #d8e1ec;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .rca-diagnosis-title {
  color: #64748b;
}

[data-theme="light"] .rca-diagnosis-incident {
  color: #0f172a;
}

[data-theme="light"] .rca-root-cause-text {
  color: #0f172a;
  background: #f1f5f9;
  border-left-color: #0284c7;
}

[data-theme="light"] .rca-kpi-card {
  background: #f8fafd;
  border-color: #d8e1ec;
}

[data-theme="light"] .rca-conf-score {
  color: #0284c7;
}

[data-theme="light"] .rca-conf-bar-bg {
  background: #e2e8f0;
}

[data-theme="light"] .rca-panel-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .rca-panel-title {
  color: #0f172a;
}

[data-theme="light"] .rca-evidence-item {
  background: #f8fafd;
  border-color: #d8e1ec;
  color: #334155;
}

[data-theme="light"] .rca-evidence-bullet {
  color: #0284c7;
}

[data-theme="light"] .rca-impact-item {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

[data-theme="light"] .rca-action-card {
  background: #dcfce7;
  border-color: #86efac;
}

[data-theme="light"] .rca-action-title {
  color: #15803d;
}

[data-theme="light"] .rca-action-desc {
  color: #0f172a;
}

[data-theme="light"] .rca-step-time {
  background: #e0f2fe;
  color: #0284c7;
}

[data-theme="light"] .rca-step-dot {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.4);
}

[data-theme="light"] .rca-step-text {
  color: #475569;
}

[data-theme="light"] .rca-step-arrow {
  color: #cbd5e1;
}

[data-theme="light"] .rca-graph-container {
  background: #f8fafd;
  border-color: #d8e1ec;
}

[data-theme="light"] .rca-node {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .rca-node:hover {
  border-color: #0284c7;
}

[data-theme="light"] .rca-node-stage {
  color: #64748b;
}

[data-theme="light"] .rca-node-label {
  color: #0f172a;
}

[data-theme="light"] .rca-node.critical {
  border-color: #fca5a5;
  background: #fee2e2;
}
[data-theme="light"] .rca-node.critical .rca-node-label { color: #b91c1c; }

[data-theme="light"] .rca-node.warning {
  border-color: #fde68a;
  background: #fef3c7;
}
[data-theme="light"] .rca-node.warning .rca-node-label { color: #b45309; }

[data-theme="light"] .rca-node.success {
  border-color: #bbf7d0;
  background: #dcfce7;
}
[data-theme="light"] .rca-node.success .rca-node-label { color: #15803d; }

[data-theme="light"] .rca-graph-arrow {
  color: #0284c7;
}

