/* ==========================================================================
   EMG SMS GATEWAY - NOC LIVE MONITORING SUITE (SCREENS 1 TO 8)
   High-Density Cockpit Design Tokens & Aesthetics
   ========================================================================== */

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0e131f;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-glass: rgba(18, 24, 38, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-bright: rgba(255, 255, 255, 0.16);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #06b6d4;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  line-height: 1.45;
}

/* Ambient Radial Glows */
.monitoring-ambient-glow {
  position: fixed;
  top: -15%;
  left: 20%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

.monitoring-ambient-glow-2 {
  position: fixed;
  bottom: -20%;
  right: 15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.noc-container {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Top App Header & Cockpit Info Strip */
.noc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.noc-title-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.noc-logo {
  font-size: 1.8rem;
  line-height: 1;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.4));
}

.noc-title-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.noc-node-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
}

.noc-clock {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Top Navigation Bar */
.noc-nav-bar {
  display: flex;
  gap: 0.4rem;
  background: rgba(14, 19, 31, 0.85);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
}

.noc-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.noc-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.noc-nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(6, 182, 212, 0.3));
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
}

.noc-nav-link.admin-link {
  margin-left: auto;
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.noc-nav-link.admin-link:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #fff;
}

/* Status Pill / Live Dot */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34d399;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  animation: pulse-live 1.8s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Glass Card Component */
.noc-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition);
  position: relative;
}

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

.noc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.noc-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Top 4 KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-glass-bright), transparent);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.kpi-val {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1;
}

.kpi-delta {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.kpi-delta.up {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
}

.kpi-delta.down {
  color: #fb7185;
  background: rgba(239, 68, 68, 0.12);
}

.kpi-delta.warn {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  animation: pulse-live 1.5s infinite;
}

/* Dual Column Layout (Latency & Queue Health) */
.dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 900px) {
  .dual-grid {
    grid-template-columns: 1fr;
  }
}

/* Latency Bars Breakdown */
.latency-bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.latency-row {
  display: grid;
  grid-template-columns: 45px 1fr 75px;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.82rem;
}

.latency-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

.latency-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.latency-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.latency-fill.p50 { background: linear-gradient(90deg, #10b981, #34d399); }
.latency-fill.p95 { background: linear-gradient(90deg, #38bdf8, #818cf8); }
.latency-fill.p99 { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.latency-fill.avg { background: linear-gradient(90deg, #6366f1, #06b6d4); }

.latency-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  text-align: right;
}

/* Queue Health Key-Value Matrix */
.queue-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.queue-matrix-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
}

.qm-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.qm-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.qm-val.warning {
  color: #fbbf24;
}

/* SMSC Gateway Binds Interactive Table */
.noc-table-card {
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.noc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.noc-table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-bottom: 1px solid var(--border-glass);
}

.noc-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.noc-table tbody tr {
  transition: var(--transition);
  cursor: pointer;
}

.noc-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.05);
}

/* Gateway Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-badge.trx, .status-badge.online, .status-badge.bound {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.tx, .status-badge.rx {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.status-badge.down, .status-badge.unbound, .status-badge.offline {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

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

/* In-Flight Window Meter */
.inflight-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.inflight-track {
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.inflight-fill {
  height: 100%;
  background: #38bdf8;
  border-radius: 3px;
}

.inflight-fill.saturated {
  background: #ef4444;
}

/* Live Error Breakdown Bars */
.error-bar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.12);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.error-bar-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #fca5a5;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.error-bar-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(239, 68, 68, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Top Users List */
.user-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-rank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.user-rank-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
}

.user-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #38bdf8;
  font-weight: 600;
}

.user-tps {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.86rem;
  color: #fff;
}

/* Action Buttons */
.btn-noc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-noc-primary {
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-noc-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.btn-noc-outline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass-bright);
  color: var(--text-primary);
}

.btn-noc-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-noc-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-noc-danger:hover {
  background: #ef4444;
  color: #fff;
}

.btn-noc-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

/* Timeline Components (Screen 6: CDR Explorer) */
.timeline-container {
  position: relative;
  padding: 1.5rem 0 1.5rem 2.5rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  bottom: 1.5rem;
  left: 1rem;
  width: 2px;
  background: linear-gradient(to bottom, #38bdf8, #6366f1, #10b981);
}

.timeline-node {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-node::before {
  content: '';
  position: absolute;
  left: -1.85rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0e131f;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.timeline-node.success::before {
  border-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.timeline-node.failed::before {
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-event-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-event-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
}

.timeline-delta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}


/* SLA Compliance Table & Badges (Screen 8) */
.sla-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sla-badge.pass {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.sla-badge.fail {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .noc-container {
    padding: 1rem;
  }
  .noc-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .noc-nav-bar {
    padding: 0.3rem;
  }
}
