:root {
    --bg-dark: #050508;
    --bg-panel: rgba(10, 15, 30, 0.6);
    --primary-cyan: #00f3ff;
    --primary-purple: #bc13fe;
    --accent-green: #0aff0a;
    --accent-red: #ff2a2a;
    --text-main: #e0e0e0;
    --text-dim: #8899a6;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --font-head: 'Orbitron', sans-serif;
    --font-body: 'Roboto Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    /* Prevent scroll for dashboard feel */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Effects */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 15% 50%, rgba(188, 19, 254, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 243, 255, 0.05), transparent 25%);
    z-index: -1;
    pointer-events: none;
}

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Header */
.cyber-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid rgba(0, 243, 255, 0.2);
    background: rgba(5, 5, 8, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 243, 255, 0.1);
}

.logo {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    color: var(--primary-cyan);
    text-shadow: 0 0 10px var(--primary-cyan);
}

.highlight {
    color: var(--primary-cyan);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text-dim);
    font-family: var(--font-head);
    font-size: 0.9rem;
    transition: all 0.3s;
    position: relative;
}

nav a:hover,
nav li.active a {
    color: var(--primary-cyan);
    text-shadow: 0 0 8px var(--primary-cyan);
}

nav li.active a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan);
}

.header-status {
    font-size: 0.8rem;
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Dashboard Layout */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto 2fr 1.5fr;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

.glass-panel {
    background: var(--bg-panel);
    border: var(--glass-border);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

/* Panel Header Style */
.panel-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem 1rem;
    font-family: var(--font-head);
    font-size: 0.9rem;
    color: var(--primary-cyan);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Hero Section */
.hero-panel {
    grid-column: 1 / -1;
    /* Span random full width */
    grid-row: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 4px solid var(--primary-purple);
}

.hero-panel h1 {
    font-family: var(--font-head);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #fff, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-row {
    display: flex;
    gap: 4rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-head);
}

.text-green {
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(10, 255, 10, 0.3);
}

/* Map Section */
.map-panel {
    grid-column: 1 / 2;
    grid-row: 2 / -1;
    display: flex;
    flex-direction: column;
}

.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#spatialTwinCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.live-indicator {
    font-size: 0.6rem;
    background: rgba(255, 42, 42, 0.2);
    color: var(--accent-red);
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid var(--accent-red);
    animation: flash 1s infinite alternate;
}

/* Agent Console */
.agent-console {
    grid-column: 2 / 3;
    grid-row: 2;
    display: flex;
    flex-direction: column;
}

.terminal-window {
    flex: 1;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: #ccc;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

/* Scanline effect */
.terminal-window::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.terminal-line {
    margin-bottom: 6px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    line-height: 1.4;
}

.cmd {
    color: var(--accent-green);
    margin-right: 8px;
}

.log-info {
    color: var(--primary-cyan);
}

.log-warn {
    color: #ffd700;
}

.log-action {
    color: var(--primary-purple);
    font-weight: bold;
}

/* Sensor Grid */
.sensor-grid {
    grid-column: 2 / 3;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.5rem;
}

.sensor-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.sensor-card:first-child {
    grid-column: 1 / -1;
}

/* HVAC spans full width */
.sensor-card:nth-child(2) {
    grid-column: 1 / 2;
}

.sensor-card:nth-child(3) {
    grid-column: 2 / 3;
}

.metric-overlay {
    position: absolute;
    top: 10px;
    right: 15px;
    font-family: var(--font-head);
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    z-index: 10;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    padding: 0 10px 10px 10px;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(10, 255, 10, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(10, 255, 10, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(10, 255, 10, 0);
    }
}

@keyframes flash {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.3;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}


/* Landing Page Styles */
.landing-body {
    overflow-y: auto;
    /* Allow scrolling on landing */
    height: auto;
    min-height: 100vh;
}

.landing-main {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6rem;
    align-items: center;
    text-align: center;
}

.hero-section {
    margin-top: 4rem;
    animation: fadeIn 1s ease-out;
}

.glitch-title {
    font-family: var(--font-head);
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 1rem;
    letter-spacing: 4px;
    position: relative;
    color: white;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px var(--primary-purple), -2px -2px 0px var(--primary-cyan);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 3rem;
    font-family: var(--font-body);
    letter-spacing: 2px;
}

.highlight-text {
    color: var(--primary-cyan);
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary-cyan);
}

/* CTA Button */
.cta-button {
    position: relative;
    display: inline-block;
    padding: 1.2rem 3rem;
    background: transparent;
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;
    overflow: hidden;
    transition: all 0.3s;
    letter-spacing: 2px;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.cta-button:hover {
    background: var(--primary-cyan);
    color: black;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
}

.feature-card {
    padding: 2rem;
    text-align: left;
    transition: transform 0.3s, border-color 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-purple);
    box-shadow: 0 5px 20px rgba(188, 19, 254, 0.2);
}

.card-icon {
    font-size: 2.5rem;
    color: var(--primary-purple);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: white;
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.loading-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background: var(--primary-cyan);
    animation: loadingScan 2s infinite linear;
}

@keyframes loadingScan {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}

.cyber-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}