:root {
    --bg-dark: #07090f;
    --panel-bg: rgba(20, 24, 34, 0.6);
    --panel-border: rgba(255, 255, 255, 0.05);
    
    --neon-blue: #00f0ff;
    --neon-green: #00ff88;
    --neon-purple: #b026ff;
    --neon-warning: #ffb800;
    --neon-critical: #ff2a2a;
    
    --text-main: #ffffff;
    --text-muted: #8b949e;
    
    --glass-blur: blur(16px);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: #030408;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 240, 255, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(176, 38, 255, 0.04) 0%, transparent 50%),
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px, 30px 30px;
}

/* Premium Thin Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.2);
    border-radius: 10px;
    transition: var(--transition);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.5);
}

.dashboard-container {
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
}

/* Cyberpunk Premium Glassmorphism */
.glass-panel {
    background: rgba(12, 14, 20, 0.6);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.card {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
    border-color: rgba(0, 240, 255, 0.15);
    background: rgba(16, 20, 30, 0.6);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.9), inset 0 1px 0 0 rgba(255, 255, 255, 0.15), 0 0 50px -15px rgba(0, 240, 255, 0.08);
    transform: translateY(-4px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    border-radius: 100px;
    background: rgba(10, 12, 18, 0.7);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--neon-blue);
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.8));
}

.navbar h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, #8b949e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-center {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
    font-size: 0.85rem;
    font-weight: 500;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulsate 2s infinite;
}

.latency {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-gradient {
    background: linear-gradient(135deg, rgba(0,240,255,0.2) 0%, rgba(176,38,255,0.2) 100%);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-gradient:hover {
    background: linear-gradient(135deg, rgba(0,240,255,0.4) 0%, rgba(176,38,255,0.4) 100%);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    transform: translateY(-1px);
}

/* Premium Custom Select */
select.glass-panel {
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px !important;
    cursor: pointer;
    transition: var(--transition);
}
select.glass-panel:hover {
    border-color: rgba(0, 240, 255, 0.4) !important;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}
select.glass-panel option {
    background: #0f1219;
    color: white;
}

/* Layout Grid */
.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.5rem;
    flex: 1;
    min-height: 0; /* lets grid children compute height */
}

/* Sensors */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.sensor-card {
    padding: 1.2rem;
}

.sensor-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-blue);
}

.hum-icon { background: rgba(0, 255, 136, 0.1); color: var(--neon-green); }
.mq-icon { background: rgba(255, 184, 0, 0.1); color: var(--neon-warning); }
.border-purple { background: rgba(176, 38, 255, 0.1); color: var(--neon-purple); }

.icon-wrap svg { width: 20px; height: 20px; }

.sensor-header h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sensor-value {
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.sensor-value .unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Center Analytics */
.center-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.gauge-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.gauge-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(0, 255, 136, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.circular-gauge {
    position: relative;
    width: 120px;
    height: 120px;
}

.circular-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(135deg); /* start from bottom left */
}

.gauge-bg {
    fill: none;
    stroke: rgba(255,255,255,0.05);
    stroke-width: 8;
    stroke-linecap: round;
}

.gauge-progress {
    fill: none;
    stroke: var(--neon-blue);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 188.5; /* Length of semi-circle arc approx */
    stroke-dashoffset: 20; 
    filter: drop-shadow(0 0 6px var(--neon-blue));
    transition: stroke-dashoffset 1s ease-out;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: baseline;
}
.gauge-value span { color: white; }

.chart-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.chart-header h3 { font-size: 1.1rem; }
.chart-legend { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.neon-blue { background: var(--neon-blue); box-shadow: 0 0 8px var(--neon-blue); }
.neon-green { background: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }

.canvas-wrap {
    flex: 1;
    min-height: 250px;
    position: relative;
    width: 100%;
}

/* Right Panel */
.right-panel { display: flex; flex-direction: column;}
.blockchain-card { flex: 1; justify-content: space-between;}
.blockchain-card h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.network-viz {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.05) 0%, transparent 70%);
    border-radius: 12px;
    overflow: hidden;
}

.node {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--text-main);
    border-radius: 50%;
    box-shadow: 0 0 10px white;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.node-link {
    position: absolute;
    height: 1px;
    background: rgba(255,255,255,0.1);
    transform-origin: left center;
}

.crypto-stats {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat label { font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 0.3rem;}
.neon-text { font-size: 1.2rem; font-family: monospace; color: var(--neon-purple); text-shadow: 0 0 8px rgba(176,38,255,0.5); }
.coord-text { font-size: 1rem; color: var(--text-main); font-weight: 500; }

/* Bottom Panel */
.bottom-panel {
    margin-top: 0;
    max-height: 250px;
    overflow-y: hidden;
}

.table-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.btn-outline {
    background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: white; padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; transition: 0.2s;
}
.btn-outline:hover { background: rgba(255,255,255,0.05); }

.table-container {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; padding: 0.8rem 1rem; position: sticky; top: 0; background: rgba(20,24,34,0.9); backdrop-filter: blur(5px); z-index: 2; }
td { padding: 0.8rem 1rem; font-size: 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.hash { font-family: monospace; color: var(--neon-blue); }
.integrity-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neon-green); box-shadow: 0 0 5px var(--neon-green); }

/* Premium Status Badge */
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}
.premium-badge.safe-badge {
    color: var(--neon-blue);
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1), inset 0 0 8px rgba(0, 240, 255, 0.1);
}
.premium-badge.warning-badge {
    color: var(--neon-warning);
    border-color: rgba(255, 184, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.1), inset 0 0 8px rgba(255, 184, 0, 0.1);
}
.premium-badge.critical-badge {
    color: var(--neon-critical);
    border-color: rgba(255, 42, 42, 0.4);
    box-shadow: 0 0 10px rgba(255, 42, 42, 0.1), inset 0 0 8px rgba(255, 42, 42, 0.1);
}

/* Animations */
@keyframes pulsate {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes flashNode {
    0% { background: var(--neon-blue); box-shadow: 0 0 15px var(--neon-blue); transform: translate(-50%, -50%) scale(1.5); }
    100% { background: var(--text-main); box-shadow: 0 0 10px white; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1200px) {
    .main-grid { grid-template-columns: 200px 1fr 250px; }
}

@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .right-panel { display: none; } /* Hide blockchain viz on small screens */
    .dashboard-container { height: auto; }
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition);
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;
}
.modal-body pre {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--neon-blue);
    overflow-x: auto;
    font-size: 0.9rem;
    font-family: monospace;
}

/* Diagnostic Modal & Settings Button Styles */
.btn-icon-only {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    border-color: rgba(255,255,255,0.1);
}

.btn-icon-only:hover {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.05);
}

.diagnostic-modal {
    width: 500px;
}

.diag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.diag-stat {
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.diag-stat label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

.raw-stream-container {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(0, 240, 255, 0.1);
    scrollbar-width: thin;
}

.raw-stream-container pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Fira Code', 'Courier New', monospace;
    line-height: 1.5;
}
