/* Nexus — app-specific styles only. Base styles in ecosystem-base.css */

/* ── Stat Cards: use ecosystem .eco-stat-grid, .eco-stat-card, .eco-stat-value, .eco-stat-label, .eco-stat-trend ── */

/* ── Quick Navigation Cards ──────────────────────────────────── */
.nexus-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.nexus-nav-card {
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nexus-nav-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    color: var(--text-primary);
}

.nexus-nav-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.nexus-nav-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.nexus-nav-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Graph Explorer ──────────────────────────────────────────── */
.nexus-explorer-wrap {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: calc(100vh - 200px);
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.nexus-explorer-sidebar {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-card);
}

.nexus-explorer-sidebar h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.nexus-explorer-canvas-wrap {
    position: relative;
    overflow: hidden;
}

.nexus-explorer-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.nexus-explorer-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.nexus-explorer-controls button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.nexus-explorer-controls button:hover {
    background: var(--brand-primary);
    color: #000;
}

.nexus-minimap {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 140px;
    height: 100px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

/* ── Time Slider ─────────────────────────────────────────────── */
.nexus-time-slider {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.nexus-time-slider input[type="range"] {
    width: 100%;
    accent-color: var(--brand-primary);
}

.nexus-time-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Entity Profile ──────────────────────────────────────────── */
.nexus-entity-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 1.5rem;
}

.nexus-entity-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.nexus-entity-meta h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.nexus-entity-meta .nexus-entity-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nexus-entity-scores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.nexus-score-card {
    text-align: center;
    padding: 12px;
}

.nexus-score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nexus-score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.nexus-score-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.nexus-score-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.nexus-score-bar-fill.low { background: var(--danger, #ef4444); }
.nexus-score-bar-fill.medium { background: var(--warning, #f59e0b); }
.nexus-score-bar-fill.high { background: var(--success, #22c55e); }

/* ── Edge List ───────────────────────────────────────────────── */
.nexus-edge-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nexus-edge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.nexus-edge-item:last-child {
    border-bottom: none;
}

.nexus-edge-type {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--brand-primary);
    white-space: nowrap;
}

.nexus-edge-target {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.nexus-edge-target:hover {
    color: var(--brand-primary);
}

.nexus-edge-meta {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ── Influence Map ───────────────────────────────────────────── */
.nexus-influence-tree {
    padding-left: 20px;
}

.nexus-influence-node {
    position: relative;
    padding: 8px 0 8px 20px;
    border-left: 2px solid var(--border);
}

.nexus-influence-node::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 16px;
    width: 14px;
    height: 2px;
    background: var(--border);
}

.nexus-influence-node-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.nexus-influence-score {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success, #22c55e);
}

/* ── Cluster Cards ───────────────────────────────────────────── */
.nexus-cluster-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.nexus-cluster-card {
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.nexus-cluster-card:hover {
    border-color: var(--brand-primary);
}

.nexus-cluster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.nexus-cluster-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.nexus-cluster-size {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.nexus-cluster-members {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.nexus-cluster-member {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ── Path Finder ─────────────────────────────────────────────── */
.nexus-path-form {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.nexus-path-arrow {
    font-size: 1.25rem;
    color: var(--brand-primary);
    padding-bottom: 8px;
}

.nexus-path-result {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    padding: 16px;
    margin-bottom: 12px;
}

.nexus-path-node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.2s;
}

.nexus-path-node:hover {
    border-color: var(--brand-primary);
}

.nexus-path-edge {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.nexus-path-edge::before {
    content: '→';
    font-size: 1rem;
    color: var(--brand-primary);
    margin-right: 4px;
}

/* ── Prediction Cards ────────────────────────────────────────── */
.nexus-prediction-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.nexus-prediction-card {
    padding: 16px;
}

.nexus-prediction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.nexus-prediction-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nexus-prediction-confidence {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.nexus-prediction-confidence.high {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success, #22c55e);
}

.nexus-prediction-confidence.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning, #f59e0b);
}

.nexus-prediction-confidence.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger, #ef4444);
}

.nexus-prediction-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.nexus-prediction-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Sankey Diagram ──────────────────────────────────────────── */
.nexus-sankey-wrap {
    position: relative;
    min-height: 300px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.nexus-sankey-wrap svg {
    width: 100%;
    height: 100%;
}

/* ── Node Type Colors ────────────────────────────────────────── */
.nexus-node-wallet      { --nexus-node-color: #a78bfa; }
.nexus-node-token       { --nexus-node-color: #f59e0b; }
.nexus-node-dao         { --nexus-node-color: #22c55e; }
.nexus-node-proposal    { --nexus-node-color: #3b82f6; }
.nexus-node-user        { --nexus-node-color: #ec4899; }
.nexus-node-treasury    { --nexus-node-color: #14b8a6; }
.nexus-node-governance  { --nexus-node-color: #8b5cf6; }
.nexus-node-transaction { --nexus-node-color: #6366f1; }
.nexus-node-post        { --nexus-node-color: #f97316; }
.nexus-node-project     { --nexus-node-color: #06b6d4; }
.nexus-node-decision    { --nexus-node-color: #84cc16; }
.nexus-node-wikipage    { --nexus-node-color: #d946ef; }
.nexus-node-nft         { --nexus-node-color: #f43f5e; }
.nexus-node-activity    { --nexus-node-color: #64748b; }
.nexus-node-tag         { --nexus-node-color: #78716c; }
.nexus-node-validator   { --nexus-node-color: #0ea5e9; }
.nexus-node-stakeaccount { --nexus-node-color: #10b981; }
.nexus-node-program     { --nexus-node-color: #7c3aed; }
.nexus-node-collection  { --nexus-node-color: #e11d48; }

/* ── Node Type Badge ─────────────────────────────────────────── */
.nexus-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--nexus-node-color) 15%, transparent);
    color: var(--nexus-node-color);
}

/* ── Mini Graph (embedded in other apps) ─────────────────────── */
.nexus-mini-graph {
    width: 100%;
    height: 160px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: border-color 0.2s;
}

.nexus-mini-graph:hover {
    border-color: var(--brand-primary);
}

.nexus-mini-graph canvas {
    width: 100%;
    height: 100%;
}

/* ── Score Badge (embedded in other apps) ────────────────────── */
.nexus-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nexus-score-badge:hover {
    opacity: 0.8;
}

.nexus-score-badge.score-high {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success, #22c55e);
}

.nexus-score-badge.score-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning, #f59e0b);
}

.nexus-score-badge.score-low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger, #ef4444);
}

/* ── Graph Health Indicators ─────────────────────────────────── */
.nexus-health-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.nexus-health-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.nexus-health-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nexus-health-indicator.healthy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success, #22c55e);
}

.nexus-health-indicator.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning, #f59e0b);
}

.nexus-health-indicator.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger, #ef4444);
}

.nexus-health-detail h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.nexus-health-detail p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Recent Insights ─────────────────────────────────────────── */
.nexus-insight-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nexus-insight-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.nexus-insight-item:last-child {
    border-bottom: none;
}

.nexus-insight-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: rgba(245, 158, 11, 0.1);
}

.nexus-insight-body h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.nexus-insight-body p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.nexus-insight-time {
    font-size: 0.72rem;
    color: var(--text-muted, #666);
    margin-top: 4px;
}

/* ── Search ──────────────────────────────────────────────────── */
.nexus-search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nexus-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.nexus-search-result:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nexus-search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--nexus-node-color, var(--brand-primary)) 15%, transparent);
    color: var(--nexus-node-color, var(--brand-primary));
}

.nexus-search-result-body h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.nexus-search-result-body p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Filter Pills ────────────────────────────────────────────── */
.nexus-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}

.nexus-filter-pill {
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.nexus-filter-pill:hover,
.nexus-filter-pill.active {
    background: var(--brand-primary);
    color: #000;
    border-color: var(--brand-primary);
}

/* ── Reusable Layout Helpers (responsive) ────────────────────── */
.nexus-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.nexus-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.nexus-flex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.nexus-flex-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nexus-props-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.nexus-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.nexus-search-form > * {
    flex: 1 1 200px;
    min-width: 0;
}

.nexus-search-form > .btn {
    flex: 0 0 auto;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .nexus-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .nexus-entity-scores {
        grid-template-columns: repeat(2, 1fr);
    }
    .nexus-explorer-wrap {
        grid-template-columns: 1fr;
        height: auto;
    }
    .nexus-explorer-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }
    .nexus-explorer-canvas-wrap {
        min-height: 400px;
    }
    .nexus-path-form {
        grid-template-columns: 1fr;
    }
    .nexus-path-arrow {
        text-align: center;
    }
    .nexus-grid-4col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nexus-nav-grid {
        grid-template-columns: 1fr;
    }
    .nexus-cluster-grid,
    .nexus-prediction-grid,
    .nexus-health-grid {
        grid-template-columns: 1fr;
    }
    .nexus-entity-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .nexus-entity-scores {
        grid-template-columns: repeat(2, 1fr);
    }
    .nexus-grid-2col {
        grid-template-columns: 1fr;
    }
    .nexus-grid-4col {
        grid-template-columns: 1fr;
    }
    .nexus-props-grid {
        grid-template-columns: 1fr;
    }
    .nexus-explorer-canvas-wrap {
        min-height: 300px;
    }
    .nexus-minimap {
        display: none;
    }
    .nexus-entity-header > div:last-child {
        margin-left: 0;
        width: 100%;
    }
    .nexus-edge-item {
        flex-wrap: wrap;
    }
    .nexus-edge-meta {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nexus-entity-scores {
        grid-template-columns: 1fr;
    }
    .nexus-explorer-sidebar {
        max-height: 150px;
        padding: 10px;
    }
    .nexus-explorer-canvas-wrap {
        min-height: 250px;
    }
    .nexus-path-result {
        padding: 10px;
    }
    .nexus-path-node {
        font-size: 0.78rem;
        padding: 4px 8px;
    }
    .nexus-prediction-value {
        font-size: 1.2rem;
    }
    .nexus-score-value {
        font-size: 1.2rem;
    }
}
