:root {
    --background: #f8fafc;
    --foreground: #0f172a;
    --card: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 0, 0, 0.1);
    --primary: #6366f1;
    --secondary-text: #64748b;
    --accent-bg: rgba(99, 102, 241, 0.08);
    --button-primary: #6366f1;
    --button-secondary: #f1f5f9;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-placeholder: #94a3b8;
}

[data-theme="dark"] {
    --background: #020617;
    --foreground: #f8fafc;
    --card: rgba(30, 41, 59, 0.8);
    --card-border: rgba(255, 255, 255, 0.05);
    --secondary-text: #94a3b8;
    --accent-bg: rgba(99, 102, 241, 0.2);
    --button-primary: #6366f1;
    --button-secondary: #1e293b;
    --input-bg: #0f172a;
    --input-border: rgba(255, 255, 255, 0.1);
    --input-placeholder: #475569;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Global Contrast Refinement */
.glass-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    color: var(--foreground);
}

/* Fix for ALL slate backgrounds in light mode */
.bg-slate-900, .bg-slate-800, .bg-slate-950, .bg-slate-700 {
    background-color: var(--button-secondary) !important;
    color: var(--foreground) !important;
}

/* Strict input handling */
input, select, textarea {
    background-color: var(--input-bg) !important;
    color: var(--foreground) !important;
    border: 1px solid var(--input-border) !important;
}

input::placeholder {
    color: var(--input-placeholder) !important;
}

/* Ensure primary elements stay vibrant */
.bg-indigo-600, .bg-indigo-500, .bg-blue-600 {
    background-color: var(--button-primary) !important;
    color: #ffffff !important;
}

/* Chart and Analytics Text Fix */
.text-slate-500, .text-slate-400 { color: var(--secondary-text) !important; }

/* Floating Toggle Fix */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.25rem;
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.theme-toggle i {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--foreground);
}
