body { 
    font-family: 'Inter', sans-serif; 
    background-color: #fcfcfc; 
    transition: background-color 0.3s ease, color 0.3s ease;
    
}

/* Update your existing root variables or add these */
:root {
    /* Slightly deeper cyan for light mode visibility */
    --particle-color: rgba(8, 145, 178, 0.7); 
    --line-color: rgba(8, 145, 178, 0.15);
    /* Subtle background tint to make the white glow visible */
    --bg-tint: radial-gradient(circle, #ffffff 0%, #f0f9ff 100%);
}

.dark {
    /* Neon Cyan for dark mode brilliance */
    --particle-color: rgba(34, 211, 238, 0.9); 
    --line-color: rgba(34, 211, 238, 0.25);
    --bg-tint: radial-gradient(circle, #111827 0%, #080c14 100%);
}

#particle-canvas {
    pointer-events: none; /* Allows you to click buttons 'through' the background */
    background: transparent;
}

/* --- NEW AWESOME CARD STYLES --- */

/* Base Card */
.glass-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Specifics - High Contrast */
body:not(.dark) .glass-card {
    background: #ffffff !important;
    border: 1px solid #f1f5f9 !important;
}

body:not(.dark) .sensor-pill {
    background: #f8fafc !important;
    border: 1px solid #f1f5f9 !important;
}

body:not(.dark) .sensor-pill p:last-child {
    color: #1e293b !important; /* Dark text for sensor values */
}

/* Hover Effect */
.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(59, 130, 246, 0.15);
    border-color: #3b82f6 !important;
}

/* Dark Mode Overrides */
.dark .glass-card {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.dark .sensor-pill {
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.03) !important;
}

/* Battery Circle */
.battery-bg { color: #e5e7eb; }
.dark .battery-bg { color: #334155; }

#splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

main {
    min-height: calc(100vh - 160px);
}

.slider { 
    -webkit-appearance: none; 
    height: 4px; 
    background: #f1f5f9; 
    border-radius: 5px; 
    outline: none; 
}

.slider::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    width: 18px; 
    height: 18px; 
    background: #3b82f6; 
    border-radius: 50%; 
    cursor: pointer; 
    border: 3px solid white; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

body.dark {
    background-color: #0f172a !important; 
    color: #f8fafc !important;
}

.dark nav {
    background-color: rgba(15, 23, 42, 0.9) !important;
    border-bottom: 1px solid #1e293b !important;
}

.dark #login-screen, 
.dark #splash-screen {
    background-color: #0f172a !important; 
    color: #f8fafc !important;
}

.dark .glass-card, 
.dark .bg-white,
.dark #action-modal > div,
.dark #alert-modal > div {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.dark .bg-gray-50, 
.dark .bg-gray-50\/50, 
.dark .bg-blue-50, 
.dark .bg-emerald-50, 
.dark .bg-sky-50 {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

.dark .text-gray-400, 
.dark .text-gray-500, 
.dark .text-gray-800 {
    color: #94a3b8 !important;
}

.dark .text-emerald-900, 
.dark .text-sky-900, 
.dark .text-gray-900 {
    color: #f1f5f9 !important;
}

.dark input {
    background-color: rgba(15, 23, 42, 0.5) !important;
    border-color: #334155 !important;
    color: white !important;
}

.dark input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.dark .modal-bg {
    background: rgba(15, 23, 42, 0.8) !important;
}

.dark footer {
    background-color: #020617 !important;
}

.battery-charging { 
    animation: charge-pulse 2s infinite; 
    color: #fbbf24; 
}

@keyframes charge-pulse { 
    0%, 100% { opacity: 1; transform: scale(1.1); } 
    50% { opacity: 0.7; transform: scale(1); } 
}

.error-pulse { 
    animation: error-blink 1.5s infinite; 
    color: white !important; 
}

@keyframes error-blink { 
    0%, 100% { background-color: #ef4444; } 
    50% { background-color: #991b1b; } 
}

button:disabled {
    opacity: 0.4;
    pointer-events: auto !important; 
    cursor: not-allowed !important;
    filter: grayscale(1);
}

.glass-toggle {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

.dark .glass-toggle {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

#theme-icon {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark #theme-icon {
    color: #fbbf24;
}

.dark .slider {
    background: #334155 !important;
    border: 1px solid #475569;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.dark .slider::-webkit-slider-thumb {
    background: #60a5fa !important;
    border: 3px solid #1e293b;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.dark .bg-blue-600 {
    background-color: #2563eb !important; 
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3) !important;
}

.dark .error-pulse {
    background-color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.6) !important;
    color: #ffffff !important;
    animation: error-blink-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
}

@keyframes error-blink-glow { 
    0%, 100% { 
        background-color: #ef4444; 
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); 
        transform: scale(1);
    } 
    50% { 
        background-color: #7f1d1d;
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.1); 
        transform: scale(0.98);
    } 
}

.dark .bg-gray-200 {
    background-color: #475569 !important; 
    color: #f1f5f9 !important; 
    border: 1px solid #64748b !important;
}

.dark .bg-green-50.border-green-100 {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}
.dark .bg-green-50 .text-green-600 {
    color: #34d399 !important;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}
.dark .bg-red-50.border-red-100 {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
    animation: pulse-red-border 2s infinite;
}
.dark .bg-red-50 .text-red-600 {
    color: #f87171 !important;
}

@keyframes pulse-red-border {
    0%, 100% { border-color: rgba(239, 68, 68, 0.5); }
    50% { border-color: rgba(239, 68, 68, 0.8); }
}

body:not(.dark) .bg-green-50.border-green-100 {
    background-color: #f0fdf4 !important;
    border-color: #86efac !important;
}
body:not(.dark) .bg-green-50 .text-green-600 {
    color: #059669 !important;
    font-weight: 800;
}
body:not(.dark) .bg-red-50.border-red-100 {
    background-color: #fef2f2 !important;
    border-color: #fca5a5 !important;
}
body:not(.dark) .bg-red-50 .text-red-600 {
    color: #dc2626 !important;
    font-weight: 800;
}

nav button[onclick="showLogin(true)"] {
    border: 1.5px solid #dbeafe !important;
    background-color: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease !important;
}

nav button[onclick="showLogin(true)"]:hover {
    background-color: #eff6ff !important;
    border-color: #3b82f6 !important;
    transform: translateY(-1px);
}

.dark nav button[onclick="showLogin(true)"] {
    background-color: rgba(30, 41, 59, 0.5) !important;
    border: 1.5px solid rgba(59, 130, 246, 0.4) !important;
    color: #60a5fa !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.dark nav button[onclick="showLogin(true)"]:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3) !important;
    color: #93c5fd !important;
}

.dark .bg-blue-50.text-blue-600 {
    background-color: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    color: #60a5fa !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.dark .border-b, 
.dark .border-gray-50, 
.dark .border-gray-100 {
    border-color: rgba(51, 65, 85, 0.5) !important;
}

.dark h3.border-b {
    border-color: rgba(59, 130, 246, 0.2) !important;
    padding-bottom: 0.75rem;
}

.dark .border-gray-50 {
    border-color: rgba(30, 41, 59, 0.8) !important;
}

.dark .border-b.border-gray-50.pb-8 {
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 2rem;
}

.dark .border-b.border-gray-50.pb-6 {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body:not(.dark) .border-b, 
body:not(.dark) .border-gray-50, 
body:not(.dark) .border-gray-100 {
    border-color: #e5e7eb !important;
    opacity: 1 !important;
}

body:not(.dark) #current-explorer-cycle-label {
    color: #111827; 
}

.relative.h-\[200px\] canvas, 
.relative.h-\[250px\] canvas {
    max-width: 100% !important;
    display: block !important;
}

#co2Chart, #o2Chart {
    width: 100% !important;
}

#device-container.grid {
    width: 100%;
}

body:not(.dark) .border-b {
    border-color: #e5e7eb !important;
    opacity: 1 !important;
}

.dark .border-b {
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 1.5rem;
}

/* Global Modal Background (Blur effect for both modes) */
.modal-bg {
    background: rgba(255, 255, 255, 0.4); /* Light translucent white */
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    transition: all 0.3s ease;
}



/* Ensure the modal box itself pops in Light Mode */
#action-modal > div, #alert-modal > div {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid #f1f5f9;
}


.dark .bg-emerald-50.text-emerald-600 {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.5) !important;
    color: #34d399 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Hover effect for both action buttons */
button[onclick*="promptPassAction"]:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Custom Dosing Grid Styles */
.dosing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.motor-card {
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.dark .motor-card {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.05);
}

.motor-card:focus-within {
    border-color: #10b981;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.1);
}

.stepper-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-weight: bold;
    color: #64748b;
    transition: all 0.2s;
}

.stepper-btn:hover {
    background: #f1f5f9;
    color: #10b981;
}

.motor-input {
    width: 50px;
    text-align: center;
    font-weight: 800;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.1rem;
}