/* css/styles.css */
:root {
    /* Theme Colors - Deep Space Dark */
    --bg-core: #0d1117;
    --bg-panel: #161b22;
    --bg-glass: rgba(22, 27, 34, 0.85);
    
    /* Accents */
    --accent-primary: #2f81f7; /* Pro Blue */
    --accent-glow: rgba(47, 129, 247, 0.15);
    --border-subtle: #30363d;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    
    /* Functional Colors */
    --success: #238636;
    --danger: #da3633;
    
    /* Font Stack */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Segoe UI Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-core);
    color: var(--text-main);
    font-family: var(--font-stack);
    height: 100vh;
    overflow: hidden; /* Prevents whole-page scroll */
    display: flex;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 60px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    z-index: 20;
}

.sidebar-icon {
    width: 42px; height: 42px; margin-bottom: 12px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); cursor: pointer; transition: all 0.2s ease;
}
.sidebar-icon svg { width: 22px; height: 22px; fill: currentColor; }
.sidebar-icon:hover, .sidebar-icon.active {
    background-color: var(--accent-glow); color: var(--accent-primary);
}

/* --- MAIN LAYOUT --- */
.main-stage {
    flex-grow: 1; display: flex; flex-direction: column; position: relative;
    background: radial-gradient(circle at 90% 10%, rgba(47,129,247,0.05) 0%, transparent 40%);
    overflow: hidden; /* Ensure only content-area scrolls */
}

/* FIX: ADDED THIS CLASS TO ENABLE SCROLLING */
.content-area {
    flex-grow: 1;
    overflow-y: auto; /* Enables vertical scrolling */
    overflow-x: hidden;
    position: relative;
    width: 100%;
    /* Smooth scrolling for anchor links */
    scroll-behavior: smooth;
}

.top-bar {
    height: 55px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-glass); backdrop-filter: blur(12px);
    z-index: 10;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.brand-title { font-size: 15px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 10px; }
.brand-badge { background: #1f6feb; color: white; font-size: 9px; padding: 2px 6px; border-radius: 12px; }

/* --- DASHBOARD CARDS --- */
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px; padding-bottom: 60px; /* Extra padding at bottom for scroll comfort */
    text-align: left;
}

.dashboard-card {
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    background: rgba(22, 27, 34, 0.9);
    border-color: var(--accent-primary);
    box-shadow: 0 15px 30px -10px rgba(0,0,0,0.5);
}

.card-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 15px;
}
.card-icon svg { width: 22px; height: 22px; fill: currentColor; }

.card-title { font-size: 18px; font-weight: 700; color: #fff; margin: 0 0 8px 0; }
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 20px 0; flex-grow: 1; }

.card-status {
    font-size: 11px; font-family: var(--font-mono); color: var(--success);
    display: flex; align-items: center; gap: 6px;
    background: rgba(35, 134, 54, 0.1); padding: 4px 8px; border-radius: 4px; width: fit-content;
}

/* --- COMMON UTILS --- */
.btn {
    background: transparent; border: 1px solid var(--border-subtle); color: var(--text-main);
    height: 32px; padding: 0 14px; border-radius: 6px; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: 0.2s;
}
.btn:hover { background: rgba(255,255,255,0.08); }
.btn.primary { background: var(--success); border-color: rgba(255,255,255,0.1); color: white; }

/* --- STATUS DOTS --- */
.dot { 
    width: 6px; height: 6px; border-radius: 50%; 
    background: var(--text-muted); transition: 0.3s; 
}
.dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot.offline { background: var(--danger); box-shadow: none; }

/* --- CONTROLS --- */
.controls-group { display: flex; gap: 10px; align-items: center; }

.lang-select {
    appearance: none; background: #0d1117; border: 1px solid var(--border-subtle);
    color: var(--text-main); padding: 6px 12px; border-radius: 6px;
    font-family: var(--font-mono); font-size: 12px; cursor: pointer; outline: none;
    transition: border-color 0.2s;
}
.lang-select:hover { border-color: var(--accent-primary); }

/* --- CUSTOM SCROLLBAR (MATCHING THEME) --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-core); }
::-webkit-scrollbar-thumb { 
    background: var(--border-subtle); 
    border-radius: 5px; 
    border: 2px solid var(--bg-core); 
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- MARKDOWN PREVIEW STYLES (New for V6.6) --- */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: #fff; margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25;
}
.markdown-body h1 { font-size: 2em; border-bottom: 1px solid var(--border-subtle); padding-bottom: .3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-subtle); padding-bottom: .3em; }
.markdown-body p { margin-top: 0; margin-bottom: 16px; }
.markdown-body a { color: var(--accent-primary); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body code {
    background-color: rgba(110,118,129,0.4); padding: 0.2em 0.4em; border-radius: 6px;
    font-family: var(--font-mono); font-size: 85%;
}
.markdown-body pre {
    padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45;
    background-color: #161b22; border-radius: 6px; margin-bottom: 16px;
}
.markdown-body pre code { background-color: transparent; padding: 0; }
.markdown-body blockquote {
    padding: 0 1em; color: var(--text-muted); border-left: 0.25em solid var(--border-subtle); margin: 0 0 16px 0;
}
.markdown-body ul, .markdown-body ol { padding-left: 2em; margin-bottom: 16px; }
.markdown-body hr {
    height: 0.25em; padding: 0; margin: 24px 0; background-color: var(--border-subtle); border: 0;
}

/* =========================================
   REFACTORED STYLES (V7.7.0 CLEANUP)
   ========================================= */

/* --- DASHBOARD HERO --- */
.dashboard-container {
    max-width: 1200px; margin: 0 auto; padding: 60px 20px; text-align: center;
}
.dashboard-header { margin-bottom: 50px; }
.dashboard-title {
    font-size: 42px; font-weight: 800; margin-bottom: 15px;
    background: linear-gradient(135deg, #fff 0%, #8b949e 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.dashboard-subtitle {
    font-size: 16px; color: var(--text-muted); max-width: 600px;
    margin: 0 auto; line-height: 1.6;
}
.version-tag {
    color: var(--accent-primary); font-size: 12px;
    border: 1px solid var(--accent-primary);
    padding: 2px 6px; border-radius: 4px;
    margin-top: 10px; display: inline-block;
}

/* --- APP LOADER --- */
.loader-overlay {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    flex-direction: column; gap: 15px;
    background: var(--bg-core); z-index: 50;
}
.loader-spinner {
    width: 30px; height: 30px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loader-text { font-size: 14px; color: var(--text-muted); }

@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- ERROR STATE --- */
.error-container {
    height: 100%; display: flex; align-items: center;
    justify-content: center; flex-direction: column;
    gap: 20px; text-align: center;
}
.error-icon { font-size: 40px; color: var(--danger); }
.error-title { margin: 0 0 10px 0; color: #fff; }
.error-box {
    background: rgba(0,0,0,0.3); padding: 10px;
    border-radius: 6px; margin-bottom: 15px; text-align: left;
}
.error-code { color: #ff7b72; font-size: 12px; font-family: monospace; }