/* ============================================================
   UnderHost Terminal IP Section
   Fully namespaced replacement CSS
   ============================================================ */

.ns-ip-section {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
  padding: 90px 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 212, 255, 0.12) 0%, transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.14) 0%, transparent 36%),
    linear-gradient(180deg, #08111f 0%, #050811 100%) !important;
  color: #e5e9f2;
  overflow: hidden;
}

.ns-ip-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.35;
  pointer-events: none;
}

.ns-ip-section::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -220px;
  width: 700px;
  height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 212, 255, 0.12) 0%, transparent 64%);
  pointer-events: none;
}

.ns-ip-container {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
}

/* ---------- Head ---------- */

.ns-ip-head {
  text-align: center;
  margin: 0 auto 42px;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.ns-ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.10) !important;
  border: 1px solid rgba(0, 212, 255, 0.24) !important;
  color: #7ddfff !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ns-ip-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #31e981;
  box-shadow: 0 0 12px rgba(49, 233, 129, 0.85);
  animation: ns-pulse 1.6s ease-in-out infinite;
}

.ns-ip-title {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 20px 0 14px;
  color: #ffffff !important;
  background: none !important;
}

.ns-ip-title span {
  color: #00d4ff !important;
  text-shadow: 0 0 28px rgba(0, 212, 255, 0.28);
}

.ns-ip-sub {
  color: #a9bad5 !important;
  font-size: 16px;
  line-height: 1.7;
  margin: 0 auto;
  max-width: 680px;
}

/* ---------- Terminal Card ---------- */

.ns-term-card {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  border-radius: 18px;
  overflow: hidden;
  background: #08111f !important;
  border: 1px solid rgba(0, 212, 255, 0.22) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 28px 70px rgba(0, 0, 0, 0.48),
    0 0 50px rgba(0, 212, 255, 0.08);
}

/* ---------- Title Bar ---------- */

.ns-term-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #111c30 0%, #0b1425 100%) !important;
  border-bottom: 1px solid rgba(0, 212, 255, 0.16) !important;
}

.ns-term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ns-term-dot.r {
  background: #ff5f57;
}

.ns-term-dot.y {
  background: #ffbd2e;
}

.ns-term-dot.g {
  background: #28c93f;
}

.ns-term-title {
  margin-left: 12px;
  font-size: 11px;
  color: #8ba4c9;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ns-term-status {
  margin-left: auto;
  font-size: 10px;
  color: #31e981;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ns-term-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #31e981;
  box-shadow: 0 0 8px #31e981;
  animation: ns-pulse 1.6s ease-in-out infinite;
}

@keyframes ns-pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

/* ---------- Body ---------- */

.ns-term-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}

/* ---------- Left Pane ---------- */

.ns-term-pane {
  background: #08111f !important;
  padding: 24px 26px;
  font-size: 13px;
  line-height: 1.7;
  border-right: 1px solid rgba(0, 212, 255, 0.14) !important;
}

.ns-term-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6f86ad;
  font-size: 12px;
  flex-wrap: wrap;
}

.ns-term-prompt.foot {
  margin-top: 16px;
  color: #5d7195;
  font-size: 11px;
}

.ns-term-cmd {
  color: #7ddfff;
}

.ns-term-out {
  color: #5d7195;
}

.ns-term-200 {
  color: #31e981;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border: 1px solid rgba(49, 233, 129, 0.32);
  background: rgba(49, 233, 129, 0.08);
  border-radius: 6px;
}

.ns-term-caret {
  color: #31e981;
  animation: ns-caret 1s steps(1) infinite;
}

@keyframes ns-caret {
  50% {
    opacity: 0;
  }
}

/* ---------- Terminal Lines ---------- */

.ns-term-lines {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ns-term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #e5e9f2;
  font: inherit;
  opacity: 0;
  transform: translateX(-6px);
  animation: ns-line-in 0.3s ease forwards;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.ns-term-line:nth-child(1) {
  animation-delay: 0.05s;
}

.ns-term-line:nth-child(2) {
  animation-delay: 0.12s;
}

.ns-term-line:nth-child(3) {
  animation-delay: 0.19s;
}

.ns-term-line:nth-child(4) {
  animation-delay: 0.26s;
}

.ns-term-line:nth-child(5) {
  animation-delay: 0.33s;
}

.ns-term-line:nth-child(6) {
  animation-delay: 0.40s;
}

.ns-term-line:nth-child(7) {
  animation-delay: 0.47s;
}

.ns-term-line:nth-child(8) {
  animation-delay: 0.54s;
}

@keyframes ns-line-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ns-term-line:hover {
  background: rgba(0, 212, 255, 0.07);
}

.ns-term-line.hl .ns-term-val {
  color: #7ddfff;
  font-weight: 700;
  font-size: 14px;
}

.ns-term-line.copied {
  background: rgba(49, 233, 129, 0.10);
}

.ns-term-line.copied .ns-term-copy::before {
  content: 'copied ok';
  color: #31e981;
}

.ns-term-arrow {
  color: #486081;
  font-size: 11px;
}

.ns-term-key {
  color: #8ba4c9;
  white-space: pre;
}

.ns-term-eq {
  color: #486081;
}

.ns-term-val {
  color: #eef6ff;
  word-break: break-all;
  flex: 1;
}

.ns-term-val em {
  font-style: normal;
  color: #7ddfff;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

.ns-term-copy {
  color: #486081;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-left: auto;
}

.ns-term-line:hover .ns-term-copy {
  opacity: 1;
  color: #7ddfff;
}

/* ---------- Right Pane / Map ---------- */

.ns-term-mappane {
  position: relative;
  min-height: 380px;
  background: #050811 !important;
}

.ns-term-map {
  position: absolute;
  inset: 0;
}

.ns-term-map .leaflet-container {
  width: 100%;
  height: 100%;
  background: #050811;
}

.ns-term-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ns-term-crosshair span {
  position: absolute;
  background: rgba(0, 212, 255, 0.35);
}

.ns-term-crosshair span:nth-child(1) {
  left: 50%;
  top: 0;
  bottom: 50%;
  width: 1px;
  margin-left: -0.5px;
}

.ns-term-crosshair span:nth-child(2) {
  left: 50%;
  top: 50%;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
}

.ns-term-crosshair span:nth-child(3) {
  top: 50%;
  left: 0;
  right: 50%;
  height: 1px;
  margin-top: -0.5px;
}

.ns-term-crosshair span:nth-child(4) {
  top: 50%;
  left: 50%;
  right: 0;
  height: 1px;
  margin-top: -0.5px;
}

.ns-term-crosshair::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(0, 212, 255, 0.36);
  border-radius: 50%;
  margin: -24px 0 0 -24px;
  animation: ns-ring 2.2s ease-out infinite;
}

@keyframes ns-ring {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* ---------- Map Pin ---------- */

.ns-map-pin {
  position: relative;
}

.ns-map-pin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #7ddfff;
  border: 2px solid #08111f;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.85);
}

.ns-map-pin-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.28);
  animation: ns-pinring 2s ease-out infinite;
}

@keyframes ns-pinring {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }

  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.ns-term-mapfoot {
  position: absolute;
  right: 14px;
  top: 14px;
  background: rgba(8, 17, 31, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  z-index: 400;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.ns-term-mapfoot-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 3px 0;
}

.ns-term-mapfoot-row .k {
  color: #8ba4c9;
}

.ns-term-mapfoot-row .v {
  color: #7ddfff;
}

.ns-term-no-coords {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 380px;
  color: #6f86ad;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
}

/* ---------- Actions ---------- */

.ns-term-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 24px;
  border-top: 1px solid rgba(0, 212, 255, 0.14) !important;
  background: #071020 !important;
  flex-wrap: wrap;
}

.ns-term-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid rgba(0, 212, 255, 0.22) !important;
  background: rgba(0, 212, 255, 0.06) !important;
  color: #e5f8ff !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.ns-term-btn:hover {
  border-color: rgba(0, 212, 255, 0.65) !important;
  background: rgba(0, 212, 255, 0.12) !important;
  color: #00d4ff !important;
  transform: translateY(-1px);
}

.ns-term-btn.ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: #8ba4c9 !important;
}

.ns-term-btn.ghost:hover {
  color: #00d4ff !important;
  background: rgba(0, 212, 255, 0.06) !important;
}

.ns-term-spacer {
  flex: 1;
}

.ns-term-meta {
  color: #5d7195;
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- Upper Network Stats Contrast Fix ---------- */

.network-hero-stats,
.status-hero-stats,
.ns-network-stats {
  color: #ffffff !important;
}

.network-hero-stats strong,
.status-hero-stats strong,
.ns-network-stats strong,
.network-hero-stats .stat-number,
.status-hero-stats .stat-number,
.ns-network-stats .stat-number {
  color: #00d4ff !important;
  text-shadow: 0 0 24px rgba(0, 212, 255, 0.35);
}

.network-hero-stats span,
.status-hero-stats span,
.ns-network-stats span,
.network-hero-stats .stat-label,
.status-hero-stats .stat-label,
.ns-network-stats .stat-label {
  color: #c7d8f2 !important;
  opacity: 1 !important;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .ns-term-body {
    grid-template-columns: 1fr;
  }

  .ns-term-pane {
    border-right: 0 !important;
    border-bottom: 1px solid rgba(0, 212, 255, 0.14) !important;
  }

  .ns-term-mappane {
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  .ns-ip-section {
    padding: 56px 16px;
  }

  .ns-ip-title {
    font-size: 32px;
  }

  .ns-ip-sub {
    font-size: 15px;
  }

  .ns-term-pane {
    padding: 20px 16px;
  }

  .ns-term-titlebar {
    padding: 11px 13px;
  }

  .ns-term-title {
    margin-left: 6px;
    font-size: 10px;
  }

  .ns-term-status {
    font-size: 9px;
  }

  .ns-term-mappane {
    min-height: 280px;
  }

  .ns-term-val {
    font-size: 11px;
  }

  .ns-term-line.hl .ns-term-val {
    font-size: 13px;
  }

  .ns-term-actions {
    padding: 14px 16px;
  }

  .ns-term-btn {
    font-size: 11px;
    padding: 8px 12px;
  }

  .ns-term-meta {
    display: none;
  }
}

@media (max-width: 520px) {
  .ns-term-line {
    gap: 6px;
    padding: 6px 4px;
  }

  .ns-term-key {
    min-width: 92px;
  }

  .ns-term-arrow,
  .ns-term-eq {
    display: none;
  }

  .ns-term-mapfoot {
    right: 10px;
    top: 10px;
    font-size: 10px;
  }
}
