/* ============================================
   PFT PERRY - NETWORK OPERATIONS CENTER
   Cyberpunk Dashboard Design System
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cyan: #00f0ff;
    --purple: #7b2dff;
    --green: #00ff88;
    --pink: #ff3366;
    --bg-primary: #0a0e17;
    --bg-card: rgba(10, 14, 23, 0.85);
    --bg-card-hover: rgba(15, 20, 35, 0.9);
    --border-glow: rgba(0, 240, 255, 0.3);
    --text-primary: #e0e8ff;
    --text-secondary: rgba(224, 232, 255, 0.6);
    --font-heading: 'Orbitron', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Splash Fallback --- */
#splash-fallback {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#splash-fallback img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#splash-fallback.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* --- Scan Lines Overlay --- */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 240, 255, 0.015) 2px,
        rgba(0, 240, 255, 0.015) 4px
    );
}

/* --- Grid Background --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* --- Dashboard Container --- */
.dashboard {
    position: relative;
    z-index: 2;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.dashboard.visible {
    opacity: 1;
}

/* --- Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 24px;
    border-bottom: 1px solid var(--border-glow);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-family: var(--font-heading);
    font-size: clamp(0.7rem, 2vw, 1.1rem);
    font-weight: 700;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.6), 0 0 40px rgba(0, 240, 255, 0.3);
}

/* Glitch Effect */
.glitch-text {
    position: relative;
    animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.glitch-text::before {
    color: rgba(0, 240, 255, 0.8);
    animation: glitch-1 3s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch-text::after {
    color: rgba(0, 255, 136, 0.6);
    animation: glitch-2 2s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%, 90% { transform: translate(0); }
    91% { transform: translate(-2px, 1px); }
    92% { transform: translate(2px, -1px); }
    93% { transform: translate(0); }
    100% { transform: translate(0); }
}

@keyframes glitch-2 {
    0%, 88% { transform: translate(0); }
    89% { transform: translate(2px, 1px); }
    90% { transform: translate(-1px, -1px); }
    91% { transform: translate(0); }
    100% { transform: translate(0); }
}

@keyframes glitch-skew {
    0%, 95% { transform: skew(0deg); }
    96% { transform: skew(0.5deg); }
    97% { transform: skew(-0.3deg); }
    98% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-family: var(--font-mono);
}

.live-clock {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    transition: background 0.3s;
}

.status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px var(--green), 0 0 16px rgba(0, 255, 136, 0.3);
    animation: pulse-dot 2s infinite;
}

.status-dot.connecting {
    background: #ffaa00;
    box-shadow: 0 0 8px #ffaa00;
    animation: pulse-dot 1s infinite;
}

.status-dot.disconnected {
    background: var(--pink);
    box-shadow: 0 0 8px var(--pink);
}

.status-dot.mock {
    background: var(--purple);
    box-shadow: 0 0 8px var(--purple);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    color: var(--text-secondary);
}

/* --- Row Layout --- */
.row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.row-metrics {
    grid-template-columns: repeat(4, 1fr);
}

.row-charts {
    grid-template-columns: repeat(2, 1fr);
}

.row-engagement {
    grid-template-columns: repeat(2, 1fr);
}

.row-distribution {
    grid-template-columns: repeat(2, 1fr);
}

.row-secondary {
    grid-template-columns: repeat(5, 1fr);
}

/* --- Card Corners (Decorative Brackets) --- */
.card-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.card-corner.tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--cyan);
    border-left: 2px solid var(--cyan);
}

.card-corner.tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--cyan);
    border-right: 2px solid var(--cyan);
}

.card-corner.bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--cyan);
    border-left: 2px solid var(--cyan);
}

.card-corner.br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--cyan);
    border-right: 2px solid var(--cyan);
}

/* --- Section Title --- */
.section-title {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--cyan);
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.5), 0 0 30px rgba(0, 240, 255, 0.2);
}

.section-title-icon {
    color: var(--cyan);
    margin: 0 8px;
    opacity: 0.6;
}

/* --- Metric Cards --- */
.metric-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 4px;
    padding: 20px 24px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.metric-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
    transform: translateY(-2px);
}

.metric-card.small {
    padding: 16px 12px;
}

.metric-label {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    line-height: 1.2;
}

.metric-value.small {
    font-size: 1.3rem;
}

.metric-change {
    font-size: 0.7rem;
    margin-top: 6px;
    color: var(--text-secondary);
}

.metric-change.positive {
    color: var(--green);
}

.metric-change.negative {
    color: var(--pink);
}

/* --- Chart Panels --- */
.chart-panel {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 4px;
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
}

.chart-panel:hover {
    border-color: rgba(0, 240, 255, 0.5);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.panel-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 3px 10px;
    border: 1px solid var(--border-glow);
    border-radius: 2px;
    color: var(--cyan);
    letter-spacing: 1px;
}

.panel-badge.pulse {
    border-color: var(--green);
    color: var(--green);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 12px rgba(0, 255, 136, 0.6); }
}

.chart-container {
    position: relative;
    height: 250px;
}

.chart-container-doughnut {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Live Feed --- */
.live-feed {
    height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
}

.live-feed::-webkit-scrollbar {
    width: 4px;
}

.live-feed::-webkit-scrollbar-track {
    background: transparent;
}

.live-feed::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 2px;
}

.feed-placeholder {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 40px 0;
    letter-spacing: 1px;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
    font-size: 0.72rem;
    animation: feed-slide-in 0.3s ease-out;
    transition: background 0.2s;
}

.feed-item:hover {
    background: rgba(0, 240, 255, 0.05);
}

@keyframes feed-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.feed-type {
    font-family: var(--font-heading);
    font-size: 0.55rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 2px;
    min-width: 75px;
    text-align: center;
    letter-spacing: 1px;
}

.feed-type.payment {
    background: rgba(0, 240, 255, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.feed-type.trustset {
    background: rgba(123, 45, 255, 0.15);
    color: var(--purple);
    border: 1px solid rgba(123, 45, 255, 0.3);
}

.feed-type.offer {
    background: rgba(0, 255, 136, 0.15);
    color: var(--green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.feed-type.other {
    background: rgba(255, 51, 102, 0.15);
    color: var(--pink);
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.feed-account {
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-amount {
    color: var(--cyan);
    font-weight: 600;
    white-space: nowrap;
}

.feed-time {
    color: var(--text-secondary);
    opacity: 0.6;
    white-space: nowrap;
    font-size: 0.65rem;
}

/* --- Node Grid --- */
.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
}

.node-placeholder {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 40px 0;
    letter-spacing: 1px;
    grid-column: 1 / -1;
}

.node-card {
    background: rgba(0, 240, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.12);
    border-radius: 4px;
    padding: 12px;
    font-size: 0.7rem;
    transition: all 0.3s;
}

.node-card:hover {
    border-color: var(--cyan);
    background: rgba(0, 240, 255, 0.08);
}

.node-card .node-status {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.node-card .node-status.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.node-card .node-status.offline {
    background: var(--pink);
    box-shadow: 0 0 6px var(--pink);
}

.node-card .node-name {
    font-family: var(--font-heading);
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.node-card .node-detail {
    color: var(--text-secondary);
    font-size: 0.6rem;
}

.node-card.my-validator {
    border: 1px solid var(--cyan);
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2), inset 0 0 12px rgba(0, 240, 255, 0.05);
    order: -1;
}

.node-card.my-validator .node-name {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* --- Footer --- */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 0;
    border-top: 1px solid var(--border-glow);
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-note {
    width: 100%;
    margin-top: 4px;
    font-size: 0.65rem;
    text-align: center;
    opacity: 0.45;
}

/* --- API Badge --- */
.api-badge {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 8px 24px;
    background: rgba(123, 45, 255, 0.2);
    border: 1px solid var(--purple);
    border-radius: 4px;
    color: var(--purple);
    backdrop-filter: blur(10px);
    animation: badge-pulse-purple 2s infinite;
}

.api-badge.hidden {
    display: none;
}

@keyframes badge-pulse-purple {
    0%, 100% { box-shadow: 0 0 10px rgba(123, 45, 255, 0.2); }
    50% { box-shadow: 0 0 20px rgba(123, 45, 255, 0.5); }
}

/* --- Counter-up animation --- */
.counter-animate {
    transition: all 0.3s ease;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .row-secondary {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 12px 16px 30px;
    }

    .header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .header h1 {
        font-size: 0.65rem;
        letter-spacing: 1px;
    }

    .row-metrics,
    .row-charts,
    .row-engagement,
    .row-distribution,
    .row-secondary {
        grid-template-columns: 1fr;
    }

    .row-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 200px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .row-metrics {
        grid-template-columns: 1fr;
    }

    .header-right {
        flex-direction: column;
        gap: 8px;
    }
}

/* --- Utility: Glow Pulse for cards on data update --- */
@keyframes glow-update {
    0% { box-shadow: 0 0 0 rgba(0, 240, 255, 0); }
    50% { box-shadow: 0 0 25px rgba(0, 240, 255, 0.3); }
    100% { box-shadow: 0 0 0 rgba(0, 240, 255, 0); }
}

.metric-card.updated {
    animation: glow-update 0.8s ease-out;
}
