/* Network status page — Pebble-style node listing, themed for Nexus Cloud */

/* Top controls: search + 7-day average uptime */
.nx-net-controls {
    align-items: stretch;
}

.nx-net-search {
    position: relative;
    height: 100%;
}

.nx-net-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
}

.nx-net-search input {
    width: 100%;
    height: 56px;
    padding: 0 16px 0 44px;
    background: rgba(20, 24, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.nx-net-search input::placeholder { color: #6b7280; }

.nx-net-search input:focus {
    outline: none;
    border-color: var(--tertiary-color);
    background: rgba(20, 24, 38, 0.85);
}

.nx-net-uptime-card {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(20, 24, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0 20px;
    text-align: center;
}

.nx-net-uptime-label {
    font-size: 13px;
    color: #aab3c2;
    font-weight: 500;
}

.nx-net-uptime-value {
    font-size: 18px;
    font-weight: 700;
    color: #2ecc71;
    font-family: var(--bs-font-monospace, monospace);
}

/* Sections */
.nx-net-sections { display: flex; flex-direction: column; gap: 28px; }

.nx-net-section {
    background: transparent;
}

.nx-net-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 14px;
    cursor: pointer;
    user-select: none;
    background: none;
    border: 0;
    color: #fff;
    text-align: left;
    width: 100%;
}

.nx-net-section-caret {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 8px solid #fff;
    transition: transform 0.18s ease;
}

.nx-net-section.is-collapsed .nx-net-section-caret {
    transform: rotate(-90deg);
}

.nx-net-section-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
}

.nx-net-section-count {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nx-net-section-body {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 18, 28, 0.6);
}

.nx-net-section.is-collapsed .nx-net-section-body { display: none; }

/* Column header row */
.nx-net-colhead {
    display: grid;
    grid-template-columns: 56px minmax(0, 2fr) 140px minmax(0, 2fr);
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    color: #aab3c2;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nx-net-colhead > span:nth-child(1) { text-align: center; }
.nx-net-colhead > span:nth-child(2) { text-align: center; }
.nx-net-colhead > span:nth-child(3) { text-align: center; }
.nx-net-colhead > span:nth-child(4) { text-align: center; }

/* Node row */
.nx-net-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 2fr) 140px minmax(0, 2fr);
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease;
}

.nx-net-row:last-child { border-bottom: 0; }

.nx-net-row:hover { background: rgba(255, 255, 255, 0.02); }

/* Status pill (green check) */
.nx-net-status {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    margin: 0 auto;
}

.nx-net-status.is-online      { background: #2ecc71; }
.nx-net-status.is-degraded    { background: #f1c40f; color: #1a1d28; }
.nx-net-status.is-offline     { background: #e74c3c; }
.nx-net-status.is-maintenance { background: #6b7280; }

/* Usage statistics column (node name + bars) */
.nx-net-usage {
    padding-left: 4px;
    min-width: 0;
}

.nx-net-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-net-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 320px;
}

.nx-net-bar-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.nx-net-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

.nx-net-bar-cpu     { background: #3b82f6; }
.nx-net-bar-ram     { background: #2ecc71; }
.nx-net-bar-network { background: #f59e0b; }

/* Uptime % */
.nx-net-uptime {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    font-family: var(--bs-font-monospace, monospace);
}

.nx-net-uptime.is-degraded { color: #f1c40f; }
.nx-net-uptime.is-offline  { color: #e74c3c; }

/* Historical Uptime — 30 daily blocks */
.nx-net-history {
    display: flex;
    gap: 2px;
    align-items: stretch;
    height: 28px;
    justify-content: center;
}

.nx-net-history-bar {
    flex: 1 1 0;
    min-width: 4px;
    max-width: 9px;
    background: #2ecc71;
    border-radius: 1px;
    cursor: help;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.nx-net-history-bar:hover { opacity: 0.75; transform: scaleY(1.05); }

.nx-net-history-bar.is-degraded { background: #f1c40f; }
.nx-net-history-bar.is-outage   { background: #e74c3c; }
.nx-net-history-bar.is-unknown  { background: rgba(255, 255, 255, 0.08); }

/* Service-only rows (Core section) hide the bars */
.nx-net-row.is-service .nx-net-bars { display: none; }
.nx-net-row.is-service .nx-net-name { margin-bottom: 0; font-size: 15px; }

/* Expandable detail */
.nx-net-row.is-expandable { cursor: pointer; }

.nx-net-row.is-expandable::after {
    content: '';
    display: none;
}

.nx-net-row-wrap { /* logical grouping for row + its detail panel */ }

.nx-net-row.is-expanded { background: rgba(255, 255, 255, 0.03); }

.nx-net-detail {
    padding: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(10, 12, 20, 0.55);
}

.nx-net-detail.is-open {
    max-height: 1200px;     /* large enough for content; transition-friendly */
    transition: max-height 0.4s ease;
}

.nx-net-detail-inner {
    padding: 22px 24px 26px;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 28px;
}

.nx-net-charts {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nx-net-chart {
    background: rgba(20, 24, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 14px 16px;
}

.nx-net-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.nx-net-chart-label {
    color: #aab3c2;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.nx-net-chart-value {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--bs-font-monospace, monospace);
}

.nx-net-chart-value.is-cpu     { color: #60a5fa; }
.nx-net-chart-value.is-ram     { color: #4ade80; }
.nx-net-chart-value.is-network { color: #fbbf24; }

.nx-net-chart svg {
    width: 100%;
    height: 56px;
    display: block;
}

.nx-net-chart-area-cpu     { fill: rgba(59, 130, 246, 0.18); }
.nx-net-chart-line-cpu     { stroke: #3b82f6; }
.nx-net-chart-area-ram     { fill: rgba(46, 204, 113, 0.18); }
.nx-net-chart-line-ram     { stroke: #2ecc71; }
.nx-net-chart-area-network { fill: rgba(245, 158, 11, 0.18); }
.nx-net-chart-line-network { stroke: #f59e0b; }

.nx-net-chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* Detail info panel */
.nx-net-info {
    background: rgba(20, 24, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 18px 20px;
    align-self: start;
}

.nx-net-info-title {
    font-size: 12px;
    font-weight: 600;
    color: #aab3c2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nx-net-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

.nx-net-info-row:last-child { border-bottom: 0; }

.nx-net-info-label {
    color: #aab3c2;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nx-net-info-icon {
    width: 14px;
    text-align: center;
    color: var(--tertiary-color);
    font-size: 12px;
}

.nx-net-info-value {
    color: #fff;
    text-align: right;
    font-size: 13px;
    word-break: break-word;
}

.nx-net-info-value code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
}

.nx-net-info-value.is-clients {
    font-weight: 700;
    color: #2ecc71;
    font-family: var(--bs-font-monospace, monospace);
}

@media (max-width: 768px) {
    .nx-net-detail-inner {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }
}

/* Empty state */
.nx-net-empty {
    text-align: center;
    color: #6b7280;
    padding: 40px 0;
    font-size: 14px;
}

/* Hide a section's outer wrapper when it has no visible matches */
.nx-net-section.is-empty { display: none; }

@media (max-width: 768px) {
    .nx-net-colhead { display: none; }

    .nx-net-row {
        grid-template-columns: 44px 1fr;
        grid-template-rows: auto auto;
        row-gap: 10px;
        padding: 14px;
    }

    .nx-net-status { grid-row: 1; grid-column: 1; }
    .nx-net-usage  { grid-row: 1; grid-column: 2; }
    .nx-net-uptime { grid-row: 2; grid-column: 1 / -1; text-align: left; font-size: 13px; }
    .nx-net-history { grid-row: 3; grid-column: 1 / -1; height: 22px; }

    .nx-net-row {
        grid-template-rows: auto auto auto;
    }

    .nx-net-section-title { font-size: 18px; }
}
