:root {
    /* Modern Color Palette */
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    
    --secondary-color: #64748b; /* Slate 500 */
    
    --bg-color: #f1f5f9; /* Slate 100 - Lighter background */
    --sidebar-bg: #0f172a; /* Slate 900 */
    --sidebar-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.8);
    
    --text-main: #1e293b; /* Slate 800 */
    --text-secondary: #64748b; /* Slate 500 */
    --text-light: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --border-color: #e2e8f0; /* Slate 200 */
    
    /* Status Colors */
    --success-color: #10b981; /* Emerald 500 */
    --success-bg: #d1fae5;
    --warning-color: #f59e0b; /* Amber 500 */
    --warning-bg: #fef3c7;
    --danger-color: #ef4444; /* Red 500 */
    --danger-bg: #fee2e2;

    /* Spacing & Layout */
    --sidebar-width: 280px;
    --header-height: 72px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    
    /* Effects */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --transition-speed: 0.3s;
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-speed);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================================
   Login Page Modernization 
   ========================================= */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    position: relative;
    overflow: hidden;
}

/* Decorative background shapes */
.login-page::before, .login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    z-index: 0;
    filter: blur(80px);
}

.login-page::before {
    top: -100px;
    left: -100px;
}

.login-page::after {
    bottom: -100px;
    right: -100px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--glass-blur);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    z-index: 1;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-container h1 {
    margin-bottom: 8px;
    font-size: 28px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    margin-bottom: 40px;
    color: var(--text-secondary);
    font-size: 15px;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
    background-color: #f1f5f9;
    color: var(--text-main);
}

.form-group input:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

button {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: translateY(0);
}

/* =========================================
   Dashboard Layout 
   ========================================= */
.dashboard-container {
    display: flex;
    height: 100%;
    background-color: var(--bg-color);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-gradient);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
    z-index: 20;
    transition: width 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 32px;
    /* border-bottom: 1px solid rgba(255,255,255,0.05); */
}

.sidebar-header h2 {
    font-size: 22px;
    color: #fff;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar nav {
    flex: 1;
    padding: 32px 16px;
    overflow-y: auto;
}

.sidebar nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar nav a:hover {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
    transform: translateX(4px);
}

.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
    color: #fff;
    border: 1px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.sidebar nav a.active .nav-icon {
    color: #818cf8;
}

.nav-icon {
    margin-right: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.sidebar-footer a {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #f87171 !important;
    text-decoration: none !important;
    padding: 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-footer a:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

header h2 {
    font-size: 24px;
    color: var(--text-main);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 50px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.user-details {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-details strong {
    color: var(--text-main);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

#content-area {
    padding: 40px;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 32px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

.card h3 {
    margin-bottom: 24px;
    font-size: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

th {
    text-align: left;
    padding: 16px 24px;
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
    transition: background-color 0.2s;
}

tr:hover td {
    background-color: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #fef2f2;
    color: var(--danger-color);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background-color: #fee2e2;
    border-color: #fecaca;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.025em;
    display: inline-block;
}

.badge-success {
    background-color: var(--success-bg);
    color: #059669;
}

.badge-warning {
    background-color: var(--warning-bg);
    color: #d97706;
}

.badge-danger {
    background-color: var(--danger-bg);
    color: #dc2626;
}

/* Query Console */
.query-console {
    font-family: 'Fira Code', monospace;
    width: 100%;
    min-height: 150px;
    padding: 20px;
    background-color: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    border: 1px solid #334155;
    margin-bottom: 20px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.6;
}

.query-console:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Utility */
.hidden { display: none !important; }
.error { 
    color: var(--danger-color); 
    font-size: 13px; 
    margin-top: 12px;
    padding: 10px;
    background: #fef2f2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.error::before {
    content: '!';
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 25px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        width: 100%;
    }
    
    header {
        padding: 0 20px;
    }
    
    #content-area {
        padding: 20px;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    #sidebar-toggle {
        display: inline-flex !important;
    }

    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 15;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        backdrop-filter: blur(4px);
    }

    .sidebar.open + .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}