/* ==========================================================================
   VORTEX-SDN Network Digital Twin & What-If Simulation Engine Styles
   Cisco NOC-inspired aesthetic: dark navy, deep blue, cyan, amber, and red.
   ========================================================================== */

/* Safety & Mode Banner */
.twin-mode-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  animation: fadeIn 0.2s ease-in;
}

.twin-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.twin-banner-icon {
  width: 22px;
  height: 22px;
  color: #fbbf24;
  flex-shrink: 0;
}

.twin-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.3px;
}

.twin-banner-subtitle {
  font-size: 12px;
  color: #cbd5e1;
}

.twin-mode-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.twin-mode-pill.live {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.twin-mode-pill.sim {
  background: rgba(0, 242, 254, 0.15);
  color: #00f2fe;
  border: 1px solid rgba(0, 242, 254, 0.35);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

/* Digital Twin Controls & Toolbar */
.twin-control-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.twin-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

.twin-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twin-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.twin-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Digital Twin Grid Layout */
.twin-main-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) {
  .twin-main-grid {
    grid-template-columns: 1fr;
  }
}

/* Interactive Digital Twin Topology Canvas */
.twin-canvas-card {
  background: radial-gradient(circle at center, #0a1124 0%, #060913 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.twin-canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  z-index: 2;
}

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

.twin-svg-container {
  flex: 1;
  width: 100%;
  height: 420px;
  position: relative;
}

.twin-svg-canvas {
  width: 100%;
  height: 100%;
}

/* SVG Topology Elements */
.twin-link {
  stroke: rgba(56, 189, 248, 0.4);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: all 0.3s ease;
}

.twin-link.control {
  stroke: rgba(0, 242, 254, 0.2);
  stroke-dasharray: 4, 4;
  stroke-width: 1.5;
}

.twin-link.failed {
  stroke: #ef4444 !important;
  stroke-dasharray: 6, 6;
  stroke-width: 3;
  animation: pulseFailed 1.2s infinite;
}

.twin-link.rerouted {
  stroke: #00f5a0 !important;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(0, 245, 160, 0.7));
}

@keyframes pulseFailed {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.twin-node-group {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.twin-node-group:hover {
  transform: scale(1.06);
}

.twin-node-circle {
  transition: fill 0.3s ease, stroke 0.3s ease;
}

.twin-node-failed .twin-node-circle {
  fill: #450a0a !important;
  stroke: #ef4444 !important;
}

/* Side Inspection Cards */
.twin-side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Resilience Score Gauge Card */
.twin-resilience-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
}

.twin-resilience-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.twin-resilience-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.twin-score-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.twin-score-val {
  font-size: 36px;
  font-weight: 800;
  color: #00f2fe;
  font-family: var(--font-mono);
  line-height: 1;
}

.twin-score-delta {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.twin-score-delta.negative { color: #ef4444; }
.twin-score-delta.neutral { color: #10b981; }

.twin-score-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.twin-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #fbbf24 50%, #00f2fe 100%);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Before vs After Comparison Card */
.twin-comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
}

.twin-comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}

.twin-comp-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.twin-comp-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.twin-comp-table tr:last-child td {
  border-bottom: none;
}

.twin-val-live {
  color: #94a3b8;
  font-family: var(--font-mono);
  font-weight: 600;
}

.twin-val-sim {
  color: #00f2fe;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Critical Node & SPOF Card */
.twin-spof-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
}

.twin-critical-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.twin-critical-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.twin-crit-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
}

.twin-crit-badge.high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.twin-crit-badge.medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.twin-crit-badge.low {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

/* Simulation Timeline */
.twin-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.twin-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 11.5px;
}

.twin-timeline-step-tag {
  background: rgba(0, 242, 254, 0.12);
  color: #00f2fe;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  flex-shrink: 0;
}

.twin-timeline-desc {
  color: #cbd5e1;
  line-height: 1.4;
}

/* Session Simulation History Table */
.twin-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
}

/* ==========================================================================
   Light Mode Overrides for Digital Twin
   ========================================================================== */
[data-theme="light"] .twin-mode-banner {
  background: #fef3c7;
  border-color: #fde68a;
}

[data-theme="light"] .twin-banner-title {
  color: #b45309;
}

[data-theme="light"] .twin-banner-subtitle {
  color: #334155;
}

[data-theme="light"] .twin-control-card,
[data-theme="light"] .twin-resilience-card,
[data-theme="light"] .twin-comp-card,
[data-theme="light"] .twin-spof-card,
[data-theme="light"] .twin-history-card {
  background: #ffffff;
  border-color: #d8e1ec;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .twin-field-label {
  color: #64748b;
}

[data-theme="light"] .twin-canvas-card {
  background: radial-gradient(circle at center, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
}

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

[data-theme="light"] .twin-link {
  stroke: rgba(2, 132, 199, 0.45);
}

[data-theme="light"] .twin-link.control {
  stroke: rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .twin-val-live {
  color: #475569;
}

[data-theme="light"] .twin-val-sim {
  color: #0284c7;
}

[data-theme="light"] .twin-critical-item {
  background: #f8fafd;
  border-color: #d8e1ec;
  color: #0f172a;
}

[data-theme="light"] .twin-timeline-desc {
  color: #334155;
}

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

[data-theme="light"] .twin-comp-table th {
  color: #475569;
  border-bottom-color: #d8e1ec;
}

[data-theme="light"] .twin-comp-table td {
  border-bottom-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .twin-score-val {
  color: #0f172a;
}

[data-theme="light"] .twin-score-unit {
  color: #64748b;
}

[data-theme="light"] .twin-score-sublabel {
  color: #475569;
}

