:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    
    --color-blue: #3b82f6;
    --color-orange: #f59e0b;
    --color-red: #ef4444;
    --color-green: #10b981;
    --color-yellow: #eab308;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated Background Shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}
.shape1 { width: 300px; height: 300px; background: var(--color-blue); top: -100px; left: -100px; }
.shape2 { width: 400px; height: 400px; background: var(--color-green); bottom: -100px; right: -100px; animation-delay: -5s; }
.shape3 { width: 250px; height: 250px; background: var(--color-orange); top: 50%; left: 50%; transform: translate(-50%, -50%); animation: pulse 8s infinite alternate; }

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(50px) scale(1.1); }
}
@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.6; }
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.text-accent { color: var(--accent); }
.hidden { display: none !important; }

/* Login Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: opacity 0.4s ease;
}
.login-box {
    width: 90%;
    max-width: 400px;
    padding: 40px 30px;
    text-align: center;
}
.login-header i { font-size: 3rem; margin-bottom: 15px; }
.login-header h2 { font-size: 1.8rem; margin-bottom: 5px; }
.login-header p { color: var(--text-muted); margin-bottom: 30px; font-size: 0.9rem; }

.input-group {
    position: relative;
    margin-bottom: 20px;
}
.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}
.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--color-blue), var(--accent));
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}
.error-msg { color: var(--color-red); margin-bottom: 15px; font-size: 0.9rem; min-height: 20px; }

/* Dashboard Layout */
.dashboard-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.logo { display: flex; align-items: center; gap: 15px; }
.logo i { font-size: 2rem; }
.logo h1 { font-size: 1.5rem; font-weight: 600; }

.user-info { display: flex; align-items: center; gap: 15px; color: var(--text-muted); font-weight: 500;}
.status-indicator { width: 10px; height: 10px; border-radius: 50%; background: var(--color-green); box-shadow: 0 0 8px var(--color-green); }
.btn-icon { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; transition: color 0.2s; }
.btn-icon:hover { color: white; }

/* Alert Banner */
.alert-banner {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--color-red);
    color: #fca5a5;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* Cards */
.metric-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s;
}
.metric-card:hover { transform: translateY(-5px); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-header h3 { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }
.icon-box {
    width: 45px; height: 45px;
    border-radius: 12px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem;
}
.icon-box.blue { background: rgba(59, 130, 246, 0.2); color: var(--color-blue); }
.icon-box.orange { background: rgba(245, 158, 11, 0.2); color: var(--color-orange); }
.icon-box.red { background: rgba(239, 68, 68, 0.2); color: var(--color-red); }
.icon-box.green { background: rgba(16, 185, 129, 0.2); color: var(--color-green); }

.card-body .value { font-size: 2.5rem; font-weight: 700; margin-bottom: 15px; display: flex; align-items: baseline; gap: 5px; }
.card-body .unit { font-size: 1rem; color: var(--text-muted); font-weight: 400; }

.progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.progress { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress.blue { background: var(--color-blue); }
.progress.orange { background: var(--color-orange); }
.progress.red { background: var(--color-red); }

/* Battery Visualizer */
.battery-visual { display: flex; align-items: center; }
.battery-body {
    width: 100%; height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    padding: 2px;
    position: relative;
}
.battery-tip {
    width: 6px; height: 10px;
    background: var(--text-muted);
    border-radius: 0 3px 3px 0;
}
.battery-level {
    height: 100%;
    background: var(--color-green);
    border-radius: 2px;
    transition: width 0.5s ease, background 0.3s ease;
}

/* Status Panel */
.status-panel {
    grid-column: 1 / -1;
    padding: 25px;
}
.status-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}
.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 15px;
    min-width: 120px;
}
.status-item span { color: var(--text-muted); font-size: 0.9rem; }

.led-indicator {
    width: 25px; height: 25px;
    border-radius: 50%;
    background: #333; /* default off */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}
.led-indicator.on-green { background: var(--color-green); box-shadow: 0 0 15px var(--color-green); }
.led-indicator.on-yellow { background: var(--color-yellow); box-shadow: 0 0 15px var(--color-yellow); }
.led-indicator.on-red { background: var(--color-red); box-shadow: 0 0 15px var(--color-red); }

.fan-status i {
    font-size: 2rem;
    color: #333;
    transition: color 0.3s;
}
.fan-status i.spinning {
    color: var(--accent);
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .glass-header { flex-direction: column; gap: 15px; }
    .status-grid { flex-direction: column; width: 100%; }
    .status-item { width: 100%; flex-direction: row; justify-content: flex-start; padding: 15px 30px;}
    .card-body .value { font-size: 2rem; }
}
