/* ====================== Reset & Base ====================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #2b6cb0;
    --primary-dark: #1a4f8b;
    --primary-light: #ebf4ff;
    --primary-gradient: linear-gradient(135deg, #2b6cb0 0%, #3182ce 100%);
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text: #1a202c;
    --text-muted: #718096;
    --text-light: #a0aec0;
    --border: #e2e8f0;
    --border-light: #edf2f7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100%; }

/* ====================== Auth Page ====================== */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.auth-container {
    display: flex; width: 900px; max-width: 100%; min-height: 580px;
    background: var(--bg-card); border-radius: 20px; box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.auth-sidebar {
    width: 360px; min-width: 360px; background: var(--primary-gradient);
    padding: 48px 36px; color: white; display: flex; flex-direction: column;
}
.auth-brand { margin-bottom: 40px; }
.auth-brand .brand-icon { font-size: 48px; margin-bottom: 12px; }
.auth-brand h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.auth-brand .brand-subtitle { font-size: 14px; opacity: 0.8; margin-top: 4px; }
.auth-features { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.feature-item { display: flex; align-items: flex-start; gap: 14px; }
.feature-icon { font-size: 24px; line-height: 1; }
.feature-text { display: flex; flex-direction: column; gap: 2px; }
.feature-text strong { font-size: 14px; font-weight: 600; }
.feature-text span { font-size: 12px; opacity: 0.75; }
.auth-footer-text { font-size: 12px; opacity: 0.6; margin-top: auto; padding-top: 24px; }

.auth-main { flex: 1; padding: 48px 40px; display: flex; flex-direction: column; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 32px; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; }
.auth-tab { flex: 1; padding: 10px; border: none; background: transparent; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: all .2s; }
.auth-tab.active { background: white; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth-form { display: none; }
.auth-form.active { display: flex; flex-direction: column; }
.auth-form h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-form .form-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; transition: border-color .2s; font-family: var(--font); }
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,108,176,.1); }
.form-group input::placeholder { color: var(--text-light); }
.form-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.form-error { font-size: 13px; color: #e53e3e; min-height: 20px; margin-bottom: 8px; }
.form-terms { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 16px; }

/* ====================== Buttons ====================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: all .2s; font-family: var(--font); text-decoration: none; }
.btn-primary { background: var(--primary-gradient); color: white; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(43,108,176,.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border-light); color: var(--text); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-text { transition: opacity .2s; }
.btn-loader { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; }
.btn-loading .btn-text { opacity: 0; }
.btn-loading .btn-loader { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-logout { color: #e53e3e; font-size: 13px; }
.btn-logout:hover { background: #fff5f5; color: #c53030; }

/* ====================== Navbar ====================== */
.navbar { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 24px; background: white; border-bottom: 1px solid var(--border); position: fixed; top: 0; left: 0; right: 0; z-index: 100; }
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-brand .brand-icon { font-size: 22px; }
.nav-brand .brand-name { font-size: 16px; font-weight: 700; color: var(--text); }
.nav-center .nav-subtitle { font-size: 13px; color: var(--text-muted); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-gradient); color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.user-name { font-size: 14px; font-weight: 500; }

/* ====================== App Layout ====================== */
.app-body { background: var(--bg); }
.app-container { display: flex; margin-top: 60px; min-height: calc(100vh - 60px); }

/* ====================== Sidebar ====================== */
.sidebar { width: 260px; min-width: 260px; background: white; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 60px; left: 0; bottom: 0; z-index: 50; }
.sidebar-header { padding: 20px 20px 12px; border-bottom: 1px solid var(--border-light); }
.sidebar-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); transition: all .15s; }
.sidebar-item:hover { background: var(--primary-light); }
.sidebar-item .sidebar-icon { font-size: 20px; margin-top: 1px; }
.sidebar-item-content { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sidebar-item-desc { font-size: 11px; color: var(--text-muted); }
.sidebar-footer { border-top: 1px solid var(--border-light); padding: 12px 20px; }
.sidebar-info { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-light); }

/* ====================== Main Content ====================== */
.main-content { flex: 1; margin-left: 260px; padding: 32px; min-height: calc(100vh - 60px); }

/* ====================== Dashboard ====================== */
.dashboard-welcome { max-width: 1000px; }
.welcome-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.welcome-subtitle { font-size: 15px; color: var(--text-muted); margin-bottom: 28px; }

.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 36px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border-light); }
.stat-value { font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.dashboard-content h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.doc-cards { display: flex; flex-direction: column; gap: 16px; }
.doc-card { display: flex; align-items: center; gap: 20px; background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border-light); text-decoration: none; color: var(--text); transition: all .2s; }
.doc-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--primary); }
.doc-card-icon { font-size: 40px; min-width: 60px; text-align: center; }
.doc-card-body { flex: 1; }
.doc-card-body h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.doc-card-body p { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.doc-card-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.doc-tag { display: inline-block; padding: 2px 10px; border-radius: 20px; background: var(--primary-light); color: var(--primary); font-size: 12px; font-weight: 500; }
.doc-updated { font-size: 12px; color: var(--text-light); }
.doc-card-info { font-size: 12px; color: var(--text-light); }
.doc-card-arrow { font-size: 20px; color: var(--text-light); transition: all .2s; }
.doc-card:hover .doc-card-arrow { color: var(--primary); transform: translateX(4px); }

/* ====================== Document Page ====================== */
.doc-sidebar { width: 280px; min-width: 280px; }
.doc-container { max-width: 960px; }
.doc-header { margin-bottom: 32px; padding-bottom: 20px; border-bottom: 2px solid var(--border); }
.doc-header h1 { font-size: 26px; font-weight: 700; line-height: 1.3; }
.doc-content { font-size: 15px; line-height: 1.8; color: #2d3748; }
.doc-content h1 { font-size: 26px; font-weight: 700; margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc-content h2 { font-size: 22px; font-weight: 700; margin: 28px 0 12px; color: var(--primary-dark); }
.doc-content h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.doc-content h4 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
.doc-content h5 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.doc-content p { margin-bottom: 12px; }
.doc-content ul, .doc-content ol { margin: 8px 0; padding-left: 24px; }
.doc-content li { margin-bottom: 4px; }
.doc-content strong { font-weight: 600; }
.doc-content hr { margin: 24px 0; border: none; border-top: 1px solid var(--border); }
.doc-content code { background: #f1f3f5; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #d63384; }
.doc-content pre code { background: none; padding: 0; color: inherit; }

/* TOC */
.sidebar-toc { flex: 1; overflow-y: auto; padding: 12px 8px; }
.toc-item { display: block; padding: 6px 12px; font-size: 13px; color: var(--text-muted); text-decoration: none; border-radius: 4px; transition: all .15s; line-height: 1.4; }
.toc-item[data-level="2"] { font-weight: 600; color: var(--text); }
.toc-item[data-level="3"] { padding-left: 24px; font-size: 12px; }
.toc-item[data-level="4"] { padding-left: 36px; font-size: 12px; }
.toc-item:hover { background: var(--primary-light); color: var(--primary); }
.toc-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.doc-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }
.doc-footer p { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.doc-footer-links { display: flex; justify-content: center; gap: 24px; }
.doc-footer-links a { color: var(--primary); text-decoration: none; font-weight: 500; font-size: 14px; }
.doc-footer-links a:hover { text-decoration: underline; }

/* ====================== Responsive ====================== */
@media (max-width: 768px) {
    .auth-sidebar { display: none; }
    .auth-main { padding: 32px 24px; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .nav-center { display: none; }
    .doc-sidebar { display: none; }
}
