:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --gray-lighter: #e2e8f0;
    --bg: #f8fafc;
    --sidebar-width: 280px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--bg);
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.logo {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.875rem;
    color: var(--gray-light);
    margin-top: 0.25rem;
}

.nav {
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-light);
    padding: 0 1.5rem 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.5rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: white;
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary-light);
}

.sidebar-footer {
    padding: 1.5rem 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.code-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.control-btn {
    flex: 1;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.endpoint {
    font-size: 0.75rem;
    color: var(--gray-light);
    margin-bottom: 0.5rem;
}

.endpoint code {
    color: var(--primary-light);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.version {
    font-size: 0.75rem;
    color: var(--gray-light);
}

/* Main Content */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 4rem;
    max-width: 1200px;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark);
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

p {
    margin-bottom: 1rem;
    color: var(--dark);
    line-height: 1.7;
}

.lead {
    font-size: 1.25rem;
    color: var(--secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

ul, ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
    color: var(--dark);
    line-height: 1.7;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.info-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.info-card h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
}

.info-card p {
    font-size: 0.875rem;
    margin: 0;
    color: var(--gray);
}

/* Feature Section */
.feature-section {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
    margin: 2rem 0;
}

.feature-section h2 {
    color: var(--dark);
}

.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.feature-list li {
    padding-left: 1.5rem;
    position: relative;
    color: var(--dark);
    line-height: 1.8;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* Code Blocks */
.code-block {
    background: white;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-lighter);
}

.code-header {
    background: var(--bg);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-lighter);
    cursor: pointer;
    transition: background 0.2s;
    gap: 0.5rem;
}

.code-header:hover {
    background: #f1f5f9;
}

.code-header span {
    font-size: 0.875rem;
    color: var(--gray);
    font-family: var(--font-mono);
    flex: 1;
}

.collapse-btn {
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    transition: color 0.2s, transform 0.2s;
}

.collapse-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.copy-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.code-block pre {
    padding: 1.5rem;
    overflow-x: auto;
    margin: 0;
    background: white;
    max-height: 500px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.code-block pre.collapsed {
    max-height: 0;
    padding: 0 1.5rem;
    overflow: hidden;
}

.code-block.is-collapsed {
    border-bottom: none;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--dark);
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--gray-lighter);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: var(--primary-dark);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert ul {
    margin: 0.5rem 0 0 1.25rem;
}

.alert li {
    margin-bottom: 0.25rem;
}

.alert-warning {
    background: #fef3c7;
    border-left-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-left-color: var(--primary);
    color: #1e40af;
}

.alert strong {
    font-weight: 600;
}

/* Steps */
.step {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0;
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
}

.step-number {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    margin-top: 0;
    color: var(--dark);
}

.step-content p {
    color: var(--secondary);
}

.note {
    font-size: 0.875rem;
    color: var(--gray);
    font-style: italic;
}

/* Architecture Diagram */
.architecture-diagram {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
    margin: 2rem 0;
}

.arch-layer {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--gray-lighter);
}

.arch-layer h3 {
    margin: 0 0 1rem 0;
    text-align: center;
    color: var(--primary);
}

.arch-components {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.arch-component {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--gray-lighter);
    font-size: 0.875rem;
}

.arch-arrow {
    text-align: center;
    font-size: 2rem;
    color: var(--primary);
    margin: 1rem 0;
}

/* Object Grid */
.object-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.object-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--gray-lighter);
    text-align: center;
}

.object-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.object-card code {
    display: inline-block;
    margin-top: 0.5rem;
    background: var(--bg);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

thead {
    background: var(--dark);
    color: white;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
}

th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    border-bottom: 1px solid var(--gray-lighter);
    font-size: 0.875rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg);
}

/* Security List */
.security-list {
    list-style: none;
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
}

.security-list li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    color: var(--secondary);
}

.security-list li::before {
    content: "🔒";
    position: absolute;
    left: 0;
}

/* Permission Grid */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.permission-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid var(--gray-lighter);
}

.permission-card h3 {
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-lighter);
}

.permission-card ul {
    list-style: none;
}

.permission-card li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--secondary);
}

.permission-card li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* Permission Hierarchy */
.permission-hierarchy {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
    margin: 2rem 0;
}

.hierarchy-level {
    text-align: center;
    padding: 1rem;
}

.level-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.level-badge.admin {
    background: var(--danger);
    color: white;
}

.level-badge.write {
    background: var(--warning);
    color: white;
}

.level-badge.read {
    background: var(--success);
    color: white;
}

.hierarchy-arrow {
    text-align: center;
    color: var(--gray);
    font-size: 1.25rem;
    margin: 0.5rem 0;
}

/* API Endpoints */
.api-endpoint {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-lighter);
    margin: 1rem 0;
}

.endpoint-method {
    background: var(--primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.endpoint-path {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--dark);
}

.endpoint-base {
    font-size: 1.125rem;
    font-weight: 500;
}

/* Command Cards */
.command-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-lighter);
    margin: 1.5rem 0;
}

.command-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
    font-family: var(--font-mono);
}

.command-card > p {
    margin-bottom: 1rem;
}

/* Example */
.example {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary);
    border: 1px solid var(--gray-lighter);
    margin: 2rem 0;
}

.example h3 {
    margin-top: 0;
    color: var(--dark);
}

.example p {
    color: var(--dark);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 2rem 1.5rem;
    }
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
