:root {
    --bg-color: #0b0f19;
    --glass-bg: rgba(20, 25, 40, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --brand-primary: #3b82f6;
    --brand-secondary: #8b5cf6;
    --accent-positive: #10b981;
    --accent-negative: #ef4444;
    --accent-neutral: #eab308;
    --font-family: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-highlight: rgba(0, 0, 0, 0.05);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --brand-primary: #2563eb;
    --brand-secondary: #7c3aed;
}

[data-theme="light"] .app-bg {
    background: radial-gradient(circle at 50% 0%, #e2e8f0 0%, #f8fafc 70%);
}

[data-theme="light"] .nav-item.active, [data-theme="light"] .tree-item.active {
    color: var(--brand-primary);
    background: rgba(37, 99, 235, 0.1);
}


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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background animated orbs */
.app-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 0%, #151b2e 0%, var(--bg-color) 70%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: var(--brand-secondary);
    animation-delay: 0s;
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--brand-primary);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 60%;
    width: 300px;
    height: 300px;
    background: #0ea5e9;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
}

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--brand-primary);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
}
.nav-menu::-webkit-scrollbar {
    display: none; /* Hide scrollbar for aesthetics */
}
.nav-menu {
    scrollbar-width: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
    transform: translateX(4px);
}

.nav-item.active {
    color: white;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    border-left: 3px solid var(--brand-primary);
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--glass-highlight);
    border: 2px solid var(--brand-primary);
    padding: 2px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    font-size: 0.95rem;
}

.user-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    border-radius: 16px;
    /* Hide scrollbar for aesthetics */
    scrollbar-width: none;
}
.main-content::-webkit-scrollbar {
    display: none;
}

/* Top bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    height: 100%;
    flex: 1;
    max-width: 500px;
    border-radius: 16px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-box i {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.action-btn {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 16px;
}

.notification-btn {
    width: 72px;
    position: relative;
}

.notification-btn i {
    font-size: 1.25rem;
}

.badge {
    position: absolute;
    top: 16px;
    right: 18px;
    background: var(--brand-secondary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border: none;
    padding: 0 1.5rem;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.notification-btn:hover {
    background: var(--glass-highlight);
}

/* Dashboard Content */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.welcome-section h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.welcome-section p {
    color: var(--text-secondary);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.kpi-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kpi-card:hover {
    transform: translateY(-5px);
}

/* Glowing borders */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    opacity: 0.7;
}

.gradient-border-1::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.gradient-border-2::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.gradient-border-3::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.gradient-border-4::before { background: linear-gradient(90deg, #10b981, #34d399); }

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--glass-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.kpi-trend.positive { color: var(--accent-positive); }
.kpi-trend.negative { color: var(--accent-negative); }
.kpi-trend.neutral { color: var(--accent-neutral); }

.kpi-trend span {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.glass-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.chart-section {
    padding: 1.5rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.side-section {
    padding: 1.5rem;
}

.cluster-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cluster-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.cluster-item:hover {
    background: var(--glass-highlight);
    border-color: var(--glass-border);
    transform: scale(1.02);
}

.cluster-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.icon-blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.icon-purple { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.icon-orange { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.cluster-info {
    flex: 1;
}

.cluster-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.cluster-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cluster-metric {
    text-align: right;
}

.cluster-metric strong {
    display: block;
    font-size: 0.95rem;
}

.cluster-metric span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.dashboard-content > * {
    animation: fadeIn 0.6s ease-out forwards;
}

.kpi-grid .kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: 0.4s; }
.content-grid > .glass-panel { animation-delay: 0.5s; }

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .logo {
        margin-bottom: 0;
    }
    
    .nav-menu, .sidebar-bottom {
        display: none;
    }
}

/* Markdown content styles */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.6;
    margin-top: 1rem;
    text-align: left;
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 12px;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: var(--brand-primary);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.markdown-body h1 { font-size: 1.75rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem; margin-top: 0; }
.markdown-body h2 { font-size: 1.4rem; }
.markdown-body p { margin-bottom: 1rem; color: var(--text-secondary); }
.markdown-body ul, .markdown-body ol { margin-bottom: 1rem; padding-left: 2rem; color: var(--text-secondary); }
.markdown-body strong { color: var(--text-primary); }
.markdown-body code { background: var(--glass-bg); padding: 0.2rem 0.4rem; border-radius: 4px; font-family: monospace; font-size: 0.9em; color: var(--brand-secondary); }
/* Tree Navigation Hierarchy Styles */
.tree-container {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.95rem;
}

.tree-item:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.tree-item.active {
    color: white;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    border-left: 3px solid var(--brand-primary);
}

.tree-item i {
    font-size: 1.2rem;
    min-width: 1.2rem;
}

.tree-item.folder i {
    color: var(--brand-secondary);
}

.tree-item.file i {
    color: var(--text-secondary);
}

.tree-children {
    display: flex;
    flex-direction: column;
    padding-left: 1.5rem;
    border-left: 1px solid var(--glass-border);
    margin-left: 1rem;
    margin-top: 0.2rem;
}
