:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;

    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.dashboard-container { display: flex; min-height: 100vh; }

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: 280px;
    margin: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.logo { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 700; }
.text-primary { color: var(--accent-blue); }
.icon-large { width: 28px; height: 28px; }
.icon-small { width: 16px; height: 16px; }

.api-key-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.status-msg {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    min-height: 20px;
}
.status-msg.error { color: #ef4444; }

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 40px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.page-title { font-size: 1.8rem; font-weight: 700; }

.time-filters {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--panel-border);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.filter-btn:hover { color: var(--text-primary); }
.filter-btn.active {
    background: var(--panel-bg);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Detail Filters */
.detail-filters {
    padding: 16px 20px;
    display: flex;
    gap: 24px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select {
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-family);
    min-width: 200px;
    outline: none;
    cursor: pointer;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card { padding: 20px; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.card-title { color: var(--text-secondary); font-size: 0.95rem; font-weight: 500; }
.icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bg-blue { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.bg-green { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.bg-purple { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }

.card-value { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }

/* Charts */
.charts-section { flex: 1; display: flex; flex-direction: column; }
.chart-container { flex: 1; padding: 24px; display: flex; flex-direction: column; min-height: 400px; }
.chart-header { margin-bottom: 20px; }
.chart-header h2 { font-size: 1.1rem; font-weight: 600; }
.canvas-wrapper { flex: 1; position: relative; }

/* Login Overlay */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    background-image: 
        radial-gradient(at 50% 50%, rgba(59, 130, 246, 0.2) 0px, transparent 60%);
}
#login-overlay.hidden { display: none; }

.login-box {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-box h1 { font-size: 1.5rem; margin-bottom: 12px; }
.login-box p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 30px; line-height: 1.5; }

.ms-btn {
    background: #0078d4; color: white; border: none; padding: 12px 24px;
    border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; transition: background 0.2s;
}
.ms-btn:hover { background: #106ebe; }

/* Header User Badge */
.header-actions { display: flex; align-items: center; gap: 16px; }

.user-badge {
    display: flex; align-items: center; gap: 8px;
    background: rgba(15, 23, 42, 0.6); padding: 6px 12px;
    border-radius: 20px; border: 1px solid var(--panel-border); font-size: 0.85rem;
}
.user-badge .role { color: var(--text-secondary); font-size: 0.75rem; }

.btn-icon {
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 8px; border-radius: 8px; transition: all 0.2s;
}
.btn-icon:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
