:root {
    --primary-color: #8b5cf6; /* A nice purple */
    --primary-hover: #7c3aed;
    --primary-light: #f5f3ff;
    --text-main: #334155;
    --text-muted: #64748b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Nunito', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
}

.sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-heading {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    padding: 15px 24px 5px;
    letter-spacing: 0.5px;
}

.nav-item {
    margin: 0 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 14.5px;
    gap: 12px;
}

.nav-link i:first-child {
    font-size: 18px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.ml-auto {
    margin-left: auto;
}

.dropdown-icon {
    font-size: 16px !important;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.nav-link:hover i {
    color: var(--primary-color);
}

.nav-item.active > .nav-link {
    color: var(--primary-color);
}

.nav-item.active > .nav-link i {
    color: var(--primary-color);
}

.sub-menu {
    display: none;
    padding: 5px 0 5px 36px;
}

.nav-item.open .sub-menu {
    display: block;
}

.sub-menu li a {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 6px;
}

.sub-menu li a:hover {
    color: var(--primary-color);
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-body);
    border-radius: 6px;
    padding: 0 15px;
    height: 40px;
    border: 1px solid var(--border-color);
    width: 300px;
}

.search-icon {
    color: var(--text-muted);
    margin-right: 10px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
}

.search-bar input::placeholder {
    color: #94a3b8;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

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

.page-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
}

.breadcrumbs {
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-main);
    font-weight: 600;
}

.breadcrumbs span {
    color: var(--text-muted);
}

/* Layout Row */
.layout-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.sidebar-topics {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
}

.main-details {
    flex: 1;
    min-width: 0;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.topics-card {
    padding: 20px;
}

.topics-card .card-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

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

.topics-list li a {
    display: block;
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 600;
    border: 1px solid transparent;
}

.topics-list li.active a {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.topics-list li:not(.active) a:hover {
    background-color: var(--bg-body);
}

.doc-card {
    padding: 24px;
    margin-bottom: 24px;
}

.doc-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}

.doc-card .card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
}

.expand-btn:hover {
    color: var(--primary-color);
}

.code-block {
    background-color: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.code-block pre {
    margin: 0;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

/* Syntax Highlighting Colors Simulation */
.code-block pre code {
    white-space: pre;
}

.code-block .tag { color: #e11d48; }
.code-block .attr { color: #059669; }
.code-block .string { color: #2563eb; }
.code-block .comment { color: #94a3b8; font-style: italic; }

.doc-desc {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-muted);
}

/* Credit List styled */
.credit-group h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

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

.credit-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 14.5px;
}

.credit-list li i.ri-checkbox-circle-line {
    color: var(--primary-color);
    font-size: 18px;
}

.credit-list li a {
    color: #94a3b8;
    margin-left: 5px;
}

.credit-list li a:hover {
    color: var(--primary-color);
}

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* Responsive tweaks */
@media (max-width: 991px) {
    .layout-row {
        flex-direction: column;
    }
    .sidebar-topics {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .app-layout {
        position: relative;
    }
    .sidebar {
        position: absolute;
        left: -100%;
        transition: left 0.3s ease;
        box-shadow: 4px 0 10px rgba(0,0,0,0.05);
    }
    .sidebar.show {
        left: 0;
    }
    .search-bar {
        width: 200px;
    }
}


/* Dark Mode Variables */
[data-theme='dark'] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-light: rgba(139, 92, 246, 0.15);
}

/* Dark Mode Specific Overrides */
[data-theme='dark'] .sidebar, [data-theme='dark'] .topbar, [data-theme='dark'] .card { background-color: var(--bg-card); }
[data-theme='dark'] .code-block { background-color: rgba(0,0,0,0.2); }
[data-theme='dark'] .code-block pre { color: #e2e8f0; }
