/* ========== BASE STYLES ========== */
body {
  font-family: Arial, sans-serif;
  background:
    radial-gradient(
      circle at top,
      #1f1f1f 0%,
      #161616 45%,
      #111111 100%
    );
  color: #fff;
  margin: 0;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body.light {
  background: #dcdcdc;
  color: #222;
}

/* ========== HEADER STYLES ========== */
h1 {
  color: #ff6600;
  margin-bottom: 10px;
}

.subtitle {
  margin-bottom: 25px;
  opacity: 0.8;
}

/* ========== TOP BAR STYLES ========== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

select, button {
  background: #ff6600;
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

select {
  max-width: 360px;
}

button:hover, select:hover {
  opacity: 0.85;
}

/* ========== TOGGLE CONTAINER ========== */
.toggle-container {
  position: fixed;
  top: 15px;
  right: 20px;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
}

body.light .toggle-container {
  background: rgba(255, 255, 255, 0.85);
}

/* ========== NODE CARD STYLES ========== */
.node-card {
  background: #2a2a2a;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 25px;
}

body.light .node-card {
  background: #ececec;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}

.node-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.node-title {
  font-size: 20px;
  font-weight: bold;
  color: #ff9900;
  word-break: break-all;
}

/* ========== COLOR CLASSES ========== */
/* Status Colors */
.status-online,
.status-validated {
  color: #00cc66;
  font-weight: bold;
}

.status-offline,
.status-error,
.status-failed {
  color: #ff4444;
  font-weight: bold;
}

.status-invalid {
  color: #ffaa00;
  font-weight: bold;
}

/* Ping Colors */
.ping-excellent { color: #00cc66; }
.ping-good { color: #4CAF50; }
.ping-fair { color: #FFC107; }
.ping-poor { color: #ff4444; }

/* Lag Colors */
.lag-excellent { color: #00cc66; }
.lag-good { color: #4CAF50; }
.lag-fair { color: #FFC107; }
.lag-poor { color: #ff4444; }

/* Basic Colors */
.green { color: #00cc66; }
.red { color: #ff4444; }
.orange { color: #ffaa33; }

/* ========== TEXT STYLES ========== */
.small {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.5;
}

body.light .small {
  opacity: 0.7;
}

/* ========== BOX STYLES ========== */
.summary-box, .profile-box {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

body.light .summary-box,
body.light .profile-box {
  background: rgba(0, 0, 0, 0.04);
}

/* ========== METHOD GRID ========== */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.method {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

body.light .method {
  background: rgba(0, 0, 0, 0.04);
}

.method-title {
  font-weight: bold;
  margin-bottom: 5px;
}

/* ========== LOADING STATE ========== */
.loading {
  color: #aaa;
  text-align: center;
  padding: 20px;
}

/* ========== FOOTER ========== */
.footer {
  margin-top: 40px;
  padding: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
  opacity: 0.9;
}

body.light .footer {
  background: rgba(0, 0, 0, 0.04);
}

code {
  color: #ff9900;
}

/* ========== CHART STYLES ========== */
.chart-container {
  position: relative;
  height: 380px;
  width: 100%;
  margin-top: 20px;
}

.latency-section {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

body.light .latency-section {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* ========== UPTIME HISTORY STYLES ========== */
.uptime-section {
  margin-top: 40px;
  padding: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light .uptime-section {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.uptime-section h2 {
  margin-top: 0;
  color: #4CAF50;
}

#uptimeTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

#uptimeTable th,
#uptimeTable td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light #uptimeTable th,
body.light #uptimeTable td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#uptimeTable th {
  font-weight: bold;
  background: rgba(255, 255, 255, 0.1);
}

body.light #uptimeTable th {
  background: rgba(0, 0, 0, 0.05);
}

#uptimeTable tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.light #uptimeTable tr:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
  .method-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .top-bar {
    flex-direction: column;
    gap: 10px;
  }

  .node-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #ff8c00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

body.light .spinner {
  border: 3px solid rgba(0,0,0,0.15);
  border-top-color: #ff8c00;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-nav {
  display: flex;
  gap: 12px;
  margin: 18px 0 24px;
  align-items: center;
}

/* =========================
   Navigation Buttons
========================= */

.dashboard-nav {
  display: flex !important;
  gap: 12px !important;
  margin: 20px 0 25px !important;
  align-items: center !important;
}

.dashboard-nav .nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 130px !important;
  padding: 10px 16px !important;
  border-radius: 10px !important;
  background: #ff6600 !important;
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  border: 1px solid #ff6600 !important;
}

.dashboard-nav .nav-btn:hover {
  background: #ff8500 !important;
  border-color: #ff8500 !important;
}

.dashboard-nav .nav-btn.active {
  background: #2b2b2b !important;
  color: #ff9900 !important;
  border-color: #ff6600 !important;
}

/* =========================
   PAGE LAYOUT
========================= */

.page-shell {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {

  body {
    padding: 12px;
  }

  .page-shell {
    padding: 0;
  }

  .top-bar,
  .dashboard-nav,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-nav .nav-btn,
  button,
  select,
  input {
    width: 100%;
    box-sizing: border-box;
  }

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

  .toggle-container {
    position: static;
    margin-bottom: 15px;
    justify-content: center;
  }

  .node-card,
  .card,
  .uptime-section,
  .footer {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
  }
}

/* =========================
   APP LAYOUT
========================= */

.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
  background:
    linear-gradient(
      180deg,
      #111111 0%,
      #0d0d0d 100%
    );
  border-right: 1px solid rgba(255,102,0,0.08);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-icon {
  font-size: 32px;
}

.brand-title {
  color: #ff6600;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.brand-subtitle {
  color: #888;
  font-size: 13px;
  margin-top: 4px;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 200, 100, 0.08);
  border: 1px solid rgba(0, 200, 100, 0.2);
  color: #37d67a;
  padding: 10px 14px;
  border-radius: 999px;
  margin-bottom: 30px;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #37d67a;
  box-shadow: 0 0 10px #37d67a;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  color: #cccccc;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  transition: 0.2s;
  font-weight: 600;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  transform: translateX(4px);
}

.sidebar-link.active {
  background: #ff6600;
  box-shadow: 0 0 14px rgba(255,102,0,0.35);
}

/* =========================
   MAIN CONTENT
========================= */

.page-shell {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  box-sizing: border-box;
}

/* =========================
   MOBILE SIDEBAR
========================= */

@media (max-width: 900px) {

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-link {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  .page-shell {
    padding: 20px 14px;
  }
}

.copyable {
  cursor: pointer;
  transition: opacity 0.2s;
  word-break: break-all;
}

.copyable:hover {
  opacity: 0.8;
}

#currentBlockID {
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-id-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.copy-icon {
  font-size: 16px;
  opacity: 0.85;
}

.block-id-value:hover {
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

#powerDownsTable {
  font-size: 20px;
}

#powerDownsTable th {
  font-size: 18px;
  padding: 12px 10px;
}

#powerDownsTable td {
  padding: 12px;
  vertical-align: middle;
}

#powerDownsTable a {
  color: #42d392;
  text-decoration: none;
  font-weight: 600;
}

#powerDownsTable a:hover {
  color: #5df2aa;
  text-decoration: underline;
}

.table-container {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
}
.rpc-person-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.rpc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ff7b00;
}

.rpc-meta {
  display: flex;
  flex-direction: column;
}

.rpc-name {
  color: #222;
  font-weight: 700;
  font-size: 18px;
}

.rpc-domain {
  color: #6b6b6b;
  font-size: 15px;
}

.rpc-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rpc-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #ff7b00;
}

.rpc-profile-header > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rpc-profile-name {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.rpc-profile-url {
  color: #ff9a3c;
  font-size: 14px;
  margin-top: 4px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg,#f59e0b,#ff7b00);
  border-radius: 999px;
}

#powerDownsTable td {
  vertical-align: middle;
}

.powerdown-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  background: #252525;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.05);
}

.summary-card .label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 1.35rem;
  font-weight: 700;
}

.wallet-scope-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.table-container {
  max-height: 75vh;
  overflow-y: auto;
}

#powerDownsTable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #252525;
}

.progress-bar {
  height: 12px;
}

.account-link {
  color: #36d399;
  font-weight: 700;
  text-decoration: none;
}

.account-link:hover {
  color: #6ee7b7;
}

#powerDownsTable td {
  font-variant-numeric: tabular-nums;
}

.table-container {
  overflow-x: auto;
}

#powerDownsTable {
  min-width: 1100px;
}