@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-bright: rgba(255, 255, 255, 0.15);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ── Top Bar / Header ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.OutOfSync {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-badge.Error {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.btn {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #fff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
}

/* ── Container & Tabs ── */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

.tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 12px;
}

.tab-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* ── Topology Tree Section ── */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-val {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 4px;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.topology-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.service-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s;
}

.service-card:hover {
  border-color: var(--border-glass-bright);
}

.service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.service-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-indigo);
}

.nodes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.node-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
}

.node-box-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-item {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.route-item:last-child {
  margin-bottom: 0;
}

.route-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.route-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Diff Preview Table ── */
.diff-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.diff-table th, .diff-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
}

.diff-table th {
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.op-tag {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.op-create { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }
.op-update { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.op-delete { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); }

/* ── Modal & Terminal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open,
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-glow);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.terminal-box {
  background: #020617;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 16px;
  border-radius: var(--radius-md);
  min-height: 300px;
  max-height: 450px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

.search-input {
  width: 100%;
  padding: 8px 16px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}
