:root {
    --accent-primary: 245, 75%, 65%;
    --accent-secondary: 265, 85%, 65%;
    --bg-dark: 222, 47%, 11%;
    --glass-bg: hsla(222, 47%, 15%, 0.6);
    --glass-border: hsla(222, 47%, 30%, 0.4);
    --text-primary: 210, 40%, 98%;
    --text-secondary: 215, 20%, 75%;
    --status-online: 142, 70%, 45%;
    --status-offline: 350, 80%, 65%;
}

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

body {
    font-family: 'Inter', 'Lato', sans-serif;
    min-height: 100vh;
    background-color: hsl(var(--bg-dark));
    color: hsl(var(--text-primary));
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background Animation Placeholder */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
    position: relative;
    z-index: 2;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, hsl(var(--accent-primary)), hsl(var(--accent-secondary)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Premium Resource Bar (Analytics) */
.resource-bar {
    display: inline-flex;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.8rem;
    border-radius: 3rem;
    gap: 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.res-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.res-divider {
    width: 1px;
    height: 1.2rem;
    background: var(--glass-border);
}

.res-item span {
    color: hsl(var(--accent-primary));
    font-weight: 700;
}

/* Large Premium Card Design */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    padding: 3rem 2rem;
    border-radius: 2rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: hsla(var(--accent-primary), 0.5);
    background: hsla(222, 47%, 20%, 0.7);
}

.icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 8px hsla(var(--accent-primary), 0.2));
}

.card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Status Indicators */
.service-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    background: rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

body.light .service-status {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a5568;
}

.status-online .status-indicator {
    background: #10B981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

.status-online span { color: #059669; font-weight: 700; }

body:not(.light) .status-online span { color: #34D399; }

.status-offline span { color: #DC2626; font-weight: 700; }

body:not(.light) .status-offline span { color: #F87171; }

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Nav Link */
.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
    width: 100%;
}

#themeToggle {
    position: absolute;
    right: 0;
    top: 0;
}

.nav-link {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.2rem;
    border-radius: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: hsla(var(--accent-primary), 0.2);
    border-color: hsla(var(--accent-primary), 0.5);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    h1 { font-size: 2.8rem; }
    .resource-bar { 
        flex-wrap: wrap; 
        justify-content: center; 
        padding: 0.8rem;
        border-radius: 1.2rem;
    }
    .res-divider { display: none; }
    .grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .card { padding: 2.5rem; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.8s ease-out forwards;
}
/* Theme Toggle Button */
#themeToggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(12px);
    z-index: 1000;
}

#themeToggle:hover {
    transform: rotate(20deg) scale(1.1);
    border-color: hsla(var(--accent-primary), 0.5);
    background: hsla(var(--accent-primary), 0.1);
}

/* --- Amazing Room Styles --- */
.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
}

.room-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.control-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    padding: 1.8rem;
    border-radius: 2rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
}

.power-button {
    width: 100%;
    padding: 1rem;
    border-radius: 1.2rem;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.power-button .power-icon { font-size: 1.5rem; opacity: 0.5; transition: all 0.3s; }
.power-button .power-state { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.6; }

.power-button.active {
    background: linear-gradient(135deg, hsla(var(--accent-primary), 0.2), hsla(var(--accent-secondary), 0.2));
    border-color: hsla(var(--accent-primary), 0.5);
    box-shadow: 0 0 20px hsla(var(--accent-primary), 0.2);
}

.power-button.active .power-icon { 
    opacity: 1; 
    color: hsl(var(--accent-primary)); 
    filter: drop-shadow(0 0 8px hsla(var(--accent-primary), 0.5));
}

.power-button.active .power-state { opacity: 1; color: hsl(var(--accent-primary)); }

.power-button:hover {
    transform: scale(1.03);
    background: rgba(255,255,255,0.08);
}

.power-button.loading { pointer-events: none; opacity: 0.5; filter: grayscale(1); }

/* --- Table Bar Utilities --- */
.tbl-bar-container {
    width: 100%;
    max-width: 120px;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.4rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.tbl-bar-fill {
    height: 100%;
    background: hsl(var(--accent-primary));
    transition: width 0.6s ease;
}

.tbl-val-label {
    font-size: 0.8rem;
    font-family: monospace;
    font-weight: 700;
}

.health-status {
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 1.5rem;
    transition: color 0.3s ease;
}

/* --- Old Area Stuff Restorations --- */
.back-button {
    position: absolute;
    left: 2rem;
    font-size: 2rem;
    text-decoration: none;
    transition: transform 0.3s ease;
    color: hsl(var(--accent-primary));
}
.back-button:hover { transform: translateX(-5px); }

.status-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    border-radius: 1.5rem;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(26, 32, 44, 0.95) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.status-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.status-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    animation: pulse 2s infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.3s ease;
}

.status-dot.active {
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
    animation: pulse 2s infinite;
}

/* WLED Color Controls */
.color-controls {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.color-picker {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.color-preset {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: hsl(var(--accent-primary));
}

.brightness-slider {
    width: 100%;
    margin-top: 1rem;
}

.brightness-slider input {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #1a202c, #fbbf24);
}

.brightness-slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: hsl(var(--accent-primary));
    cursor: pointer;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Light Mode Overrides */
body.light {
    --bg-dark: 210, 20%, 98%;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: 222, 47%, 15%;
    --text-secondary: 222, 10%, 45%;
}

body.light .status-indicator { box-shadow: none; }
body.light .status-online .status-indicator {
    background: #10B981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

body.light #particles-js { opacity: 0.4; }
body.light .card { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); }
body.light .card:hover { background: rgba(255, 255, 255, 0.9); }
body.light h1 { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
body.light .status-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 244, 248, 0.95) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
body.light .color-controls { border-top: 1px solid rgba(0, 0, 0, 0.1); }
