/*
 * Layer 3 P2P flow dashboard — direction-only.
 *
 * Five sections from top to bottom: NOW (rate + sparkline),
 * IN FLIGHT (downloads with progress + ETA), SERVING (upload
 * aggregates), RECENT (event log), CONNECTIVITY (one line),
 * BUNDLES (collapsed inventory).
 *
 * No per-peer rendering: the previous PEERS table is replaced by
 * a 1-line CONNECTIVITY summary; bundles drop the "peer:XXX"
 * attribution in favour of "(me)" / "swarm". Matches the
 * direction-only design driven by the privacy conversation.
 */

.p2p-status-view {
  font-family: monospace;
  font-size: 12px;
  color: #d8e7d9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px;
}

/* ----- NOW card (rate + sparkline) ----- */

.p2p-now {
  background: rgba(10, 22, 40, 0.4);
  border: 1px solid rgba(111, 227, 163, 0.15);
  border-radius: 4px;
  padding: 6px 8px;
  gap: 4px;
}

.p2p-now-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: 13px;
}

.p2p-now-recv  { color: #6fe3a3; }
.p2p-now-sent  { color: #ffe069; }
.p2p-now-active { color: #7f8b99; margin-left: auto; }

.p2p-spark {
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.2);
}

.p2p-spark-legend {
  font-size: 10px;
  color: #7f8b99;
}

/* ----- IN FLIGHT / SERVING rows ----- */

.p2p-flow-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 6px;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
  background: rgba(10, 22, 40, 0.2);
  font-size: 11px;
}

.p2p-flow-recv { border-left-color: #6fe3a3; }
.p2p-flow-send { border-left-color: #ffe069; }

.p2p-flow-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.p2p-flow-dir { font-size: 13px; }
.p2p-flow-kind { color: #7f8b99; min-width: 28px; }
.p2p-flow-hash { color: #d8e7d9; font-family: monospace; }
.p2p-flow-progress { color: #d4d8e0; margin-left: auto; }

.p2p-flow-meta {
  color: #7f8b99;
  font-size: 10px;
  padding-left: 22px;
}

/* ----- RECENT log ----- */

.p2p-recent-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.p2p-recent-row {
  display: grid;
  grid-template-columns: 60px 14px 14px 28px 1fr 50px 64px;
  gap: 6px;
  font-size: 10px;
  font-family: monospace;
  padding: 1px 4px;
  align-items: baseline;
}

.p2p-recent-time { color: #7f8b99; }
.p2p-recent-status { text-align: center; }
.p2p-recent-dir { text-align: center; }
.p2p-recent-kind { color: #7f8b99; }
.p2p-recent-hash { color: #d8e7d9; overflow: hidden; text-overflow: ellipsis; }
.p2p-recent-dur { color: #d4d8e0; text-align: right; }
.p2p-recent-size { color: #d4d8e0; text-align: right; }

.p2p-recent-ok .p2p-recent-status { color: #6fe3a3; }
.p2p-recent-fail .p2p-recent-status { color: #ff9090; }
.p2p-recent-fail .p2p-recent-hash { color: #ff9090; }

/* ----- CONNECTIVITY single line ----- */

.p2p-connectivity-line {
  color: #d8e7d9;
  font-size: 11px;
  padding: 2px 0;
}

/* ----- BUNDLES collapsed inventory ----- */

.p2p-bundles {
  margin-top: 4px;
}

.p2p-bundles summary {
  cursor: pointer;
}

.p2p-bundles[open] summary {
  margin-bottom: 4px;
}

/* ----- SECTION blocks ----- */

.p2p-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p2p-section-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #7f8b99;
  text-transform: uppercase;
}

.p2p-section-hint {
  letter-spacing: 0;
  text-transform: none;
  font-size: 10px;
  color: #57606b;
  font-style: italic;
  margin-left: 6px;
}

/* ----- TABLES (shared) ----- */

.p2p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.p2p-table th {
  text-align: left;
  font-weight: normal;
  color: #7f8b99;
  border-bottom: 1px solid #1a261a;
  padding: 2px 6px;
}

.p2p-table td {
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #d8e7d9;
}

.p2p-table tr:hover {
  background: rgba(110, 227, 163, 0.05);
}

/* ----- BUNDLE row colouring ----- */

.p2p-mine    { color: #ffe069; font-weight: 600; }
.p2p-safe    { color: #6fe3a3; }
.p2p-rare    { color: #ffaa66; }
.p2p-partial { color: #d4d8e0; }

/* Score column right-aligned per convention with other tables. */
.p2p-bundle-table td:nth-child(4),
.p2p-bundle-table th:nth-child(4) { text-align: right; color: #ffe069; }

/* Replicas + status keep their inner colour from the spans. */
.p2p-bundle-table td:nth-child(5),
.p2p-bundle-table td:nth-child(6) { text-align: right; }

.p2p-bundle-footer {
  font-size: 10px;
  color: #7f8b99;
  padding-top: 4px;
}

.p2p-empty {
  color: #7f8b99;
  font-style: italic;
  text-align: center;
  padding: 6px 0;
}

/* ----- LEGEND (collapsible) ----- */

.p2p-legend {
  margin-top: 4px;
  font-size: 11px;
  color: #7f8b99;
}

.p2p-legend summary {
  cursor: pointer;
  padding: 4px 0;
  color: #6fe3a3;
}

.p2p-legend-list {
  list-style: none;
  padding: 6px 0 6px 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p2p-legend-list li {
  line-height: 1.4;
}

.p2p-legend-list b {
  color: #d8e7d9;
}
