:root {
    --bg-dark: #080305;
    --bg-sidebar: #0d0408;
    --bg-card: rgba(22, 7, 14, 0.7);
    --bg-card-hover: rgba(35, 12, 22, 0.85);
    --bg-active-pill: rgba(220, 38, 38, 0.22);
    --border-subtle: rgba(220, 38, 38, 0.15);
    --border-active: rgba(239, 68, 68, 0.5);
    --crimson-primary: #ef4444;
    --crimson-dark: #b91c1c;
    --crimson-glow: rgba(239, 68, 68, 0.35);
    --crimson-light: #f87171;
    --crimson-accent: #fca5a5;
    --text-main: #f8fafc;
    --text-muted: #a39ca0;
    --text-dim: #71696e;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sidebar-width: 290px;
}

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

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background Canvas */
#constellation-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* App Layout */
.app-layout {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 10;
    backdrop-filter: blur(12px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
    padding: 24px 22px 18px 22px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}

.brand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
}

.brand-logo-img {
    height: 28px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
}

.brand-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, var(--crimson-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search Container */
.search-container {
    padding: 0 18px 16px 18px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(22, 7, 14, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 9px 14px;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--crimson-primary);
    background-color: rgba(30, 10, 20, 0.95);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.88rem;
    font-family: var(--font-sans);
}

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

.search-shortcut {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 14px 20px 14px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(220, 38, 38, 0.2);
    border-radius: 4px;
}

.nav-group {
    margin-bottom: 22px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    user-select: none;
}

.nav-group-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-group-header:hover .nav-group-title {
    color: #ffffff;
}

.nav-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-chevron {
    transform: rotate(-90deg);
}

.nav-group.collapsed .nav-items {
    display: none;
}

.nav-items {
    list-style: none;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: #c9c3c6;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.18s ease;
}

.nav-link:hover {
    color: #ffffff;
    background-color: rgba(220, 38, 38, 0.12);
}

.nav-link.active {
    color: #ffffff;
    background: var(--bg-active-pill);
    border-color: var(--border-active);
    font-weight: 600;
    box-shadow: 0 0 16px var(--crimson-glow);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--crimson-light);
}

.online-indicator {
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px #22c55e;
}

/* Main Content Area */
.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    position: relative;
    padding: 48px 64px 80px 64px;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(220, 38, 38, 0.25);
    border-radius: 8px;
}

/* Content Header (Breadcrumbs) */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.crumb {
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.crumb:hover {
    color: #ffffff;
}

.crumb.active {
    color: var(--crimson-accent);
    cursor: default;
}

.separator {
    color: var(--text-dim);
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(22, 7, 14, 0.8);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-home-btn svg {
    width: 14px;
    height: 14px;
}

.back-home-btn:hover {
    color: #ffffff;
    border-color: var(--crimson-primary);
    background: rgba(220, 38, 38, 0.15);
}

/* Home / Welcome View */
.home-view {
    max-width: 900px;
    animation: fadeIn 0.3s ease-out;
}

.greeting-hero {
    margin-bottom: 48px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 10%, var(--crimson-light) 60%, var(--crimson-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 18px;
}

.hero-description {
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 760px;
}

/* Directory Section */
.directory-section {
    margin-top: 40px;
}

.directory-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 32px;
}

.directory-block {
    margin-bottom: 36px;
}

.directory-cat-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(220, 38, 38, 0.3);
    margin-bottom: 14px;
}

.directory-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dir-item-link {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dir-item-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(220, 38, 38, 0.15);
}

.dir-item-link .item-name {
    font-size: 1.02rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.dir-item-link .item-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Doc Article View */
.doc-article-view {
    max-width: 900px;
    animation: fadeIn 0.25s ease-out;
}

.doc-content-wrapper h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.doc-content-wrapper h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 36px;
    margin-bottom: 14px;
}

.doc-content-wrapper h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--crimson-accent);
    margin-top: 24px;
    margin-bottom: 10px;
}

.doc-content-wrapper p {
    font-size: 1rem;
    line-height: 1.75;
    color: #d1c9cc;
    margin-bottom: 18px;
}

.doc-content-wrapper ul, .doc-content-wrapper ol {
    margin-left: 24px;
    margin-bottom: 20px;
    color: #d1c9cc;
    line-height: 1.7;
}

.doc-content-wrapper li {
    margin-bottom: 6px;
}

.doc-content-wrapper a {
    color: var(--crimson-light);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.doc-content-wrapper a:hover {
    color: #ffffff;
}

.doc-content-wrapper strong {
    color: #ffffff;
}

/* Code Blocks */
.doc-content-wrapper pre {
    background: #0b0306;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 10px;
    padding: 18px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.6;
    color: #f1f5f9;
    margin: 20px 0;
    position: relative;
}

.code-container {
    position: relative;
    margin: 20px 0;
}

.code-container pre {
    margin: 0;
}

.code-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: var(--crimson-primary);
}

.doc-content-wrapper code:not(pre code) {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Tables */
.doc-content-wrapper table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background: rgba(14, 5, 10, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}

.doc-content-wrapper th, .doc-content-wrapper td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(220, 38, 38, 0.1);
    font-size: 0.92rem;
}

.doc-content-wrapper th {
    background: rgba(220, 38, 38, 0.15);
    color: #ffffff;
    font-weight: 600;
}

.doc-content-wrapper tr:last-child td {
    border-bottom: none;
}

/* Floating Profile Button */
.floating-profile-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
}

.profile-avatar-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #14050b;
    border: 2px solid rgba(220, 38, 38, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(220, 38, 38, 0.3);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-avatar-btn svg {
    width: 22px;
    height: 22px;
}

.profile-avatar-btn:hover {
    transform: scale(1.08);
    border-color: var(--crimson-primary);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8), 0 0 25px rgba(239, 68, 68, 0.5);
}

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

/* Responsive */
@media (max-width: 860px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .main-content {
        padding: 24px 20px 60px 20px;
    }
    .hero-title {
        font-size: 2.6rem;
    }
}
