:root {
    --bg-main: #f1f5f9;
    --bg-panel: rgba(255, 255, 255, 0.25);
    --bg-input: rgba(255, 255, 255, 0.4);
    --bg-topbar: rgba(255, 255, 255, 0.3);
    --bg-card: rgba(255, 255, 255, 0.35);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: rgba(255, 255, 255, 0.6);
    --border-highlight: rgba(255, 255, 255, 0.8);
    --gradient-primary: rgba(59, 130, 246, 0.2);
    --gradient-accent: rgba(16, 185, 129, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

[data-theme="dark"] {
    --bg-main: #020617;
    --bg-panel: rgba(15, 23, 42, 0.4);
    --bg-input: rgba(15, 23, 42, 0.6);
    --bg-topbar: rgba(15, 23, 42, 0.4);
    --bg-card: rgba(30, 41, 59, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.2);
    --gradient-primary: rgba(59, 130, 246, 0.2);
    --gradient-accent: rgba(16, 185, 129, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 20%, var(--gradient-primary) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, var(--gradient-accent) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.active { display: flex !important; }

/* Premium Glassmorphism Utility */
.glass-panel, .topbar, .query-btn, .node, .data-card, .dash-footer {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.glass-panel { border-radius: 16px; }

.screen { min-height: 100vh; width: 100%; flex-direction: column; }
#login-screen { justify-content: center; align-items: center; }

.login-box { padding: 3rem; width: 100%; max-width: 400px; text-align: center; animation: fadeIn 0.5s ease-out; }

.logo { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; letter-spacing: -0.5px; }
.logo span { color: var(--primary); font-weight: 400; }

.login-box h2 { margin-bottom: 0.5rem; }
.login-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.input-group { position: relative; margin-bottom: 1.5rem; }
.input-group input {
    width: 100%; padding: 12px 16px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-muted); font-family: 'Inter', sans-serif;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); outline: none;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.lock-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: 0.5; font-size: 0.9rem; }

.primary-btn {
    width: 100%; padding: 12px; background: var(--primary); color: white; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.primary-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4); }

/* Topbar */
.topbar {
    display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem;
    position: sticky; top: 0; z-index: 10; border-top: none; border-left: none; border-right: none;
    border-radius: 0;
}
.user-profile { display: flex; align-items: center; gap: 1.25rem; }

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
    cursor: pointer; color: var(--text-main); font-size: 0.8rem; font-family: 'Inter', sans-serif;
    transition: all 0.2s; display: flex; align-items: center; gap: 6px; font-weight: 500;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.theme-toggle:hover { background: var(--bg-panel); border-color: var(--border-highlight); transform: translateY(-1px); }
.theme-toggle svg { opacity: 0.8; }

.badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.iso-badge { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.3); }
.verified-badge { background: rgba(16, 185, 129, 0.15); color: var(--accent); border: 1px solid rgba(16, 185, 129, 0.3); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: flex; justify-content: center; align-items: center; font-weight: bold; color: white; box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3); }

.dashboard-content { padding: 2rem; max-width: 1200px; margin: 0 auto; flex: 1; }
.dash-header { margin-bottom: 2rem; }
.dash-header p { color: var(--text-muted); margin-top: 0.5rem; }

.query-panel { padding: 2rem; margin-bottom: 2rem; }
.query-panel .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.query-options { display: flex; gap: 1rem; flex-wrap: wrap; }
.query-btn {
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.query-btn svg { opacity: 0.7; transition: opacity 0.2s; }
.query-btn:hover { 
    background: var(--gradient-primary); 
    border-color: rgba(59, 130, 246, 0.4); 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}
.query-btn:hover svg { opacity: 1; color: var(--primary); }
.query-btn.selected { 
    background: var(--primary); 
    color: white; 
    border-color: var(--primary); 
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4); 
}
.query-btn.selected svg { opacity: 1; color: white; }

#routing-visualization { margin: 3rem 0; text-align: center; animation: fadeIn 0.3s ease; }
.pipeline { display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.node { padding: 1rem 1.5rem; border-radius: 12px; font-size: 0.9rem; font-weight: 500; }
.node small { color: var(--text-muted); display: block; margin-top: 4px; font-weight: 400; }
.line { height: 2px; width: 60px; background: var(--border); position: relative; overflow: hidden; }
.animated-line::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), transparent); animation: flow 1s linear infinite;
}
.pulsing { border-color: var(--primary); box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); animation: pulse 1.5s ease-in-out infinite alternate; }
#routing-status { color: var(--text-muted); font-family: monospace; font-size: 0.85rem; background: var(--bg-card); padding: 8px 16px; border-radius: 20px; display: inline-block; border: 1px solid var(--border); }

#results-panel { animation: slideUp 0.5s ease-out; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }

.data-card { border-radius: 12px; padding: 1.75rem; }
.data-card h4 { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.data-value { font-size: 2.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; letter-spacing: -1px; }
.data-value.positive { color: var(--accent); }
.data-value.negative { color: #ef4444; }
.data-insight { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; }

.dash-footer { padding: 1.5rem; border-radius: 0; border-bottom: none; border-left: none; border-right: none; }

/* Glowing Text */
.glowing-text {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.6), 0 0 20px rgba(59, 130, 246, 0.3);
    font-weight: 700;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes flow { 0% { left: -100%; } 100% { left: 100%; } }
@keyframes pulse { from { box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); } to { box-shadow: 0 0 25px rgba(59, 130, 246, 0.5); } }
