/* --- Variables & Theme --- */
:root {
    --bg-docs: #f9fafb;
    --text-docs: #111827;
    --card-docs: #ffffff;
    --border-docs: #e5e7eb;
    --primary-docs: #57B3EE;
    --bg-hover-docs: #f3f4f6;
    --code-bg: #1f293b;
    --code-text: #e5e7eb;
    --muted-text-docs: #6b7280;
    --header-height: 60px;
}

[data-theme="dark"] {
    --bg-docs: #111827;
    --text-docs: #f9fafb;
    --card-docs: #1f2937;
    --border-docs: #374151;
    --primary-docs: #57B3EE;
    --bg-hover-docs: #374151;
    --code-bg: #0f172a;
    --code-text: #e5e7eb;
    --muted-text-docs: #9ca3af;
}

/* --- Layout Structure --- */
.docs-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    background-color: var(--bg-docs);
    position: relative;
    overflow-x: hidden;
}

/* --- Sidebar Navigation (Responsive) --- */
.docs-sidebar {
    width: 260px;
    background: var(--card-docs);
    border-right: 1px solid var(--border-docs);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    
    /* Mobile: Hidden by default (Off-canvas) */
    position: fixed;
    top: var(--header-height);
    left: -100%; /* Sembunyi di kiri */
    height: calc(100vh - var(--header-height));
    z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

/* Class active ditambahkan via JS saat tombol menu diklik */
.docs-sidebar.active {
    left: 0;
}

.docs-nav {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

.docs-nav h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--muted-text-docs);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.docs-nav a {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-docs);
    text-decoration: none;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.docs-nav a:hover, 
.docs-nav a.active {
    background: var(--bg-hover-docs);
    color: var(--primary-docs);
}

/* --- Main Content --- */
.docs-content {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
    color: var(--text-docs);
}

/* Container limits for readability */
.docs-container {
    max-width: 900px;
    margin: 0 auto;
}

/* --- Typography & Elements --- */
.docs-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-docs);
    line-height: 1.2;
}

.docs-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-docs);
    color: var(--primary-docs);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.docs-content p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-docs);
    margin-bottom: 1.5rem;
}

/* --- Feature Grid (Cards) --- */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-item {
    background: var(--card-docs);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-docs);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.feature-item strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-docs);
}

.feature-item p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted-text-docs);
}

/* --- API Reference Styles --- */
.api-endpoint {
    background: var(--card-docs);
    border: 1px solid var(--border-docs);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.method {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    width: fit-content;
}

.method.post { background-color: #fef3c7; color: #d97706; }
.method.get { background-color: #dcfce7; color: #166534; }
.method.put { background-color: #dbeafe; color: #57B3EE;}
.method.delete { background-color: #fee2e2; color: #ef4444; }

.url {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    font-size: 1rem;
    word-break: break-all;
}

/* --- Tables & Lists --- */
.doc-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.doc-list li {
    margin-bottom: 0.5rem;
    color: var(--text-docs);
    line-height: 1.6;
}

.param-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.param-table th, .param-table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-docs);
}

.param-table th { color: var(--muted-text-docs); font-weight: 600; }
.param-table code {
    background: var(--bg-hover-docs);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: var(--primary-docs);
}

/* --- Code Blocks --- */
.code-example-block {
    background: var(--code-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    color: var(--code-text);
    margin-top: 1rem;
}

.code-content {
    padding: 1rem;
    font-family: monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* --- Mobile Toggle Button (Specific for Docs if needed) --- */
/* Note: Usually handled by header.ejs, but if docs has specific button: */
.docs-toggle-btn {
    display: flex;
    margin-bottom: 1rem;
    background: var(--card-docs);
    border: 1px solid var(--border-docs);
    padding: 0.5rem;
    border-radius: 0.5rem;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-docs);
}

/* --- Desktop Responsive --- */
@media (min-width: 768px) {
    /* Restore Sidebar for Desktop */
    .docs-sidebar {
        position: sticky; /* Sticky on scroll */
        top: var(--header-height);
        left: 0;
        height: calc(100vh - var(--header-height));
        box-shadow: none;
    }

    .docs-layout {
        flex-direction: row;
    }

    .docs-content {
        padding: 3rem 4rem;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .api-endpoint {
        flex-direction: row;
        align-items: center;
    }
    
    .docs-toggle-btn {
        display: none;
    }
}

@media (min-width: 1024px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}