:root {
    --bg-dark: #06080e;
    --bg-card: rgba(12, 18, 28, 0.7);
    --border-cyber: rgba(0, 240, 255, 0.15);
    
    --neon-cyan: #00f0ff;
    --neon-cyan-glow: rgba(0, 240, 255, 0.4);
    --neon-pink: #ff0055;
    --neon-pink-glow: rgba(255, 0, 85, 0.4);
    --neon-amber: #ffb700;
    --neon-green: #00ff88;
    --neon-green-glow: rgba(0, 255, 136, 0.4);
    --neon-blue: #3a86ff;
    
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --text-bright: #ffffff;

    --font-cyber: 'Orbitron', sans-serif;
    --font-main: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 15px;
}

/* Background Canvas & Ambient Orbs */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
}

.cyber-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.3;
    animation: orbPulse 10s ease-in-out infinite alternate;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--neon-cyan) 0%, transparent 70%);
    top: -150px;
    left: -150px;
}

.glow-2 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, var(--neon-pink) 0%, transparent 70%);
    bottom: -200px;
    right: -150px;
    animation-delay: -5s;
}

.glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--neon-blue) 0%, transparent 70%);
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
}

@keyframes orbPulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(30px, 30px); }
}

/* Layout Wrapper */
.dashboard-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* HUD Header */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
}

.cyber-badge {
    display: inline-block;
    font-family: var(--font-cyber);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--neon-cyan);
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.glitch-title {
    font-family: var(--font-cyber);
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 0%, var(--neon-cyan) 50%, var(--neon-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px var(--neon-cyan-glow);
}

.brand-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 4px;
}

.hud-stats {
    display: flex;
    gap: 16px;
}

.hud-stat-box {
    background: rgba(12, 18, 28, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 18px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    backdrop-filter: blur(15px);
}

.stat-label {
    font-family: var(--font-cyber);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
}

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

.neon-green { color: var(--neon-green); text-shadow: 0 0 8px var(--neon-green-glow); }
.neon-cyan { color: var(--neon-cyan); text-shadow: 0 0 8px var(--neon-cyan-glow); }

/* Main Grid & 3D Tilt Cyber Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 25px;
    perspective: 1000px;
}

.cyber-card {
    background: var(--bg-card);
    border: 1px solid var(--border-cyber);
    border-radius: 20px;
    padding: 26px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, border-color 0.3s ease, box-shadow 0.3s ease;
}

.cyber-card:hover {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 25px 60px rgba(0, 240, 255, 0.15), 0 0 30px var(--neon-cyan-glow);
}

/* Sci-Fi HUD Corner Brackets */
.card-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--neon-cyan);
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cyber-card:hover .card-corner { opacity: 1; box-shadow: 0 0 8px var(--neon-cyan); }
.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; border-top-left-radius: 20px; }
.corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; border-top-right-radius: 20px; }
.corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; border-bottom-left-radius: 20px; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; border-bottom-right-radius: 20px; }

/* Card Header */
.card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 25px;
    transform: translateZ(20px);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-temp { color: var(--neon-pink); border-color: var(--neon-pink-glow); box-shadow: 0 0 15px var(--neon-pink-glow); }
.icon-hum { color: var(--neon-cyan); border-color: var(--neon-cyan-glow); box-shadow: 0 0 15px var(--neon-cyan-glow); }
.icon-motion { color: var(--neon-green); border-color: var(--neon-green-glow); box-shadow: 0 0 15px var(--neon-green-glow); }

.card-title-group h2 {
    font-family: var(--font-cyber);
    font-size: 1.1rem;
    letter-spacing: 1.5px;
    color: var(--text-bright);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Card Body Layout */
.card-body {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateZ(30px);
}

/* Status Pills */
.status-pill {
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--neon-cyan);
    display: inline-block;
    margin-top: 6px;
    text-shadow: 0 0 8px var(--neon-cyan-glow);
}

.main-value {
    font-family: var(--font-cyber);
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--text-bright);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* 1. RADIAL GAUGE (Temperature) */
.gauge-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radial-gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

.gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-progress {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.4s ease;
    filter: drop-shadow(0 0 10px var(--neon-cyan));
}

.gauge-needle {
    stroke: #ffffff;
    stroke-width: 3;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px #ffffff);
}

.gauge-center-dot {
    fill: var(--neon-cyan);
}

#tempNeedleGroup {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-center-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    top: 55%;
    transform: translateY(-50%);
}

/* 2. LIQUID WAVE SPHERE (Humidity) */
.liquid-container {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.liquid-svg {
    width: 100%;
    height: 100%;
}

.sphere-outer-ring {
    fill: none;
    stroke: rgba(0, 240, 255, 0.2);
    stroke-width: 4;
    filter: drop-shadow(0 0 10px var(--neon-cyan-glow));
}

.liquid-base, .wave-layer {
    transition: y 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wave-1 {
    animation: waveSine1 3s ease-in-out infinite alternate;
}

.wave-2 {
    animation: waveSine2 2.2s ease-in-out infinite alternate;
}

@keyframes waveSine1 {
    0% { transform: translateX(-10px) scaleY(1); }
    100% { transform: translateX(10px) scaleY(1.4); }
}

@keyframes waveSine2 {
    0% { transform: translateX(10px) scaleY(1.3); }
    100% { transform: translateX(-10px) scaleY(0.9); }
}

.liquid-center-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

/* 3. SCI-FI HUD RADAR (Motion) */
.hud-radar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.radar-disc {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 136, 0.2);
    background: radial-gradient(circle, rgba(0, 255, 136, 0.05) 0%, transparent 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.1);
}

.radar-crosshair-v {
    position: absolute;
    width: 1px;
    height: 100%;
    background: rgba(0, 255, 136, 0.2);
}

.radar-crosshair-h {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(0, 255, 136, 0.2);
}

.radar-sweeper-beam {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg 270deg, rgba(0, 255, 136, 0.4) 360deg);
    animation: rotateBeam 3s linear infinite;
}

@keyframes rotateBeam {
    100% { transform: rotate(360deg); }
}

.radar-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--neon-green);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.3);
}

.radar-avatar {
    font-size: 2.5rem;
    z-index: 4;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 10px var(--neon-green-glow));
}

.motion-active .radar-sweeper-beam {
    background: conic-gradient(from 0deg, transparent 0deg 240deg, var(--neon-pink) 360deg);
    animation-duration: 1.2s;
}

.motion-active .radar-disc {
    border-color: var(--neon-pink);
    box-shadow: 0 0 25px var(--neon-pink-glow);
}

.motion-active .radar-pulse-ring {
    border-color: var(--neon-pink);
    animation: radarPulse 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.motion-active .r1 { animation-delay: 0s; }
.motion-active .r2 { animation-delay: 0.7s; }

@keyframes radarPulse {
    0% { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.motion-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Critical Warning Alert Banner */
.cyber-alert {
    display: none;
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.25) 0%, rgba(180, 0, 60, 0.15) 100%);
    border: 1px solid var(--neon-pink);
    border-radius: 16px;
    padding: 16px 24px;
    align-items: center;
    gap: 16px;
    box-shadow: 0 0 30px var(--neon-pink-glow);
    animation: glitchSlide 0.4s ease-out;
}

.alert-glitch-icon {
    font-size: 2rem;
    animation: alertStrobe 0.6s infinite alternate;
}

@keyframes alertStrobe {
    0% { opacity: 0.3; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.15); }
}

@keyframes glitchSlide {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.alert-title {
    font-family: var(--font-cyber);
    font-size: 1rem;
    font-weight: 800;
    color: var(--neon-pink);
    letter-spacing: 1.5px;
    display: block;
}

.alert-desc {
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Live Analytics Chart Section */
.chart-card {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-title h2 {
    font-family: var(--font-cyber);
    font-size: 1.15rem;
    letter-spacing: 1.5px;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-btn {
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.live-pill {
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    color: var(--neon-green);
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid var(--neon-green);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 1px;
}

.blink-dot {
    width: 8px;
    height: 8px;
    background-color: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon-green);
    animation: blink 1s ease infinite alternate;
}

@keyframes blink {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

.chart-canvas-box {
    position: relative;
    height: 340px;
    width: 100%;
}

/* Responsive Rules */
@media (max-width: 768px) {
    .hud-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .hud-stats {
        width: 100%;
        justify-content: space-between;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .glitch-title {
        font-size: 1.8rem;
    }
}