/* Reset and base styles */
:root {
    --primary-color: #2563eb;
    --sidebar-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --hover-bg: #f3f4f6;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.mobile-menu-button:hover {
    background: #f9fafb;
    color: #0366d6;
}

.mobile-menu-button i {
    font-size: 1.2rem;
    color: var(--text-primary);
}

/* Close Button */
.close-sidebar {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.close-sidebar:hover {
    color: #0366d6;
}

/* GitBook-style Layout */
.gitbook-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.gitbook-sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    padding: 0;
    font-size: 14px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0;
}

.site-title {
    color: #111827;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    margin: 0;
    padding: 0;
}

.site-title:hover {
    color: #0366d6;
}

.site-title i {
    margin-right: 0.75rem;
    color: var(--primary-color);
}

/* Navigation Styles */
.gitbook-nav {
    padding: 0;
    margin: 0;
}

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

.section-title {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.section-title:hover {
    background: var(--hover-bg);
}

.nav-group {
    margin: 0;
    padding: 0;
    background-color: #fff;
}

.group-title {
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    color: #111827;
    background-color: #f9fafb;
    font-size: 0.875rem;
    margin: 0;
    border-bottom: 1px solid #e5e7eb;
    letter-spacing: 0.01em;
}

.nav-items {
    list-style: none;
    list-style-type: none;
    padding: 0;
    margin: 0;
    background-color: #fff;
}

.nav-item {
    margin: 0;
    border-bottom: 1px solid #f3f4f6;
}

.nav-item:last-child {
    border-bottom: none;
}

.nav-item a {
    padding: 0.7rem 1.2rem;
    color: #374151;
    text-decoration: none;
    display: block;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    line-height: 1.5;
}

.nav-item:hover a {
    background-color: #f9fafb;
    color: #0366d6;
}

.nav-item.active a {
    color: #0366d6;
    background-color: #f1f8ff;
    border-left: 2px solid #0366d6;
    font-weight: 500;
}

/* Main Content Area */
.gitbook-main {
    flex: 1;
    margin-left: 300px;
    width: calc(100% - 300px);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    max-width: none;
    padding: 2rem;
    margin: 0 auto;
}

.content {
    width: 100%;
    max-width: none;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
}

.content h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding: 0;
    color: #111827;
    line-height: 1.3;
}

.content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    padding: 0;
    color: #111827;
}

.content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
    padding: 0;
    color: #111827;
}

.content p {
    margin: 0 0 1rem;
    line-height: 1.6;
}

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

.content li {
    margin: 0.25rem 0;
}

.content pre {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    overflow-x: auto;
}

.content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: #f3f4f6;
    border-radius: 3px;
}

.content pre code {
    padding: 0;
    background: none;
}

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.6;
    color: var(--text-primary);
}

.markdown-content h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem;
}

.markdown-content p {
    margin: 1rem 0;
}

.markdown-content code {
    background: var(--hover-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.markdown-content pre {
    background: var(--hover-bg);
    padding: 1rem;
    border-radius: 3px;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

/* Navigation Buttons */
.markdown-content nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.markdown-content nav a {
    text-decoration: none;
    color: inherit;
}

.markdown-content nav .nav-card {
    display: block;
    padding: 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.markdown-content nav .nav-card:hover {
    background: white;
    border-color: #93c5fd;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.markdown-content nav .nav-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.markdown-content nav .nav-title {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.markdown-content nav a:hover .nav-title {
    color: #2563eb;
}

.markdown-content nav svg {
    width: 1rem;
    height: 1rem;
}

.markdown-content nav .prev .nav-label svg {
    margin-right: 0.375rem;
}

.markdown-content nav .next {
    text-align: right;
}

.markdown-content nav .next .nav-label {
    justify-content: flex-end;
}

.markdown-content nav .next .nav-label svg {
    margin-left: 0.375rem;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .markdown-content nav .nav-card {
        background: rgba(248, 250, 252, 0.02);
        border-color: rgba(226, 232, 240, 0.1);
    }
    
    .markdown-content nav .nav-card:hover {
        background: rgba(248, 250, 252, 0.03);
        border-color: rgba(147, 197, 253, 0.3);
    }
    
    .markdown-content nav .nav-label {
        color: #94a3b8;
    }
    
    .markdown-content nav .nav-title {
        color: #e2e8f0;
    }
    
    .markdown-content nav a:hover .nav-title {
        color: #60a5fa;
    }
}

/* Syntax highlighting styles */
pre {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    overflow: auto;
    margin-bottom: 16px;
}

pre code {
    color: #24292e !important;
    background: none !important;
    white-space: pre;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

/* SQL specific syntax colors */
.language-sql .keyword,
.language-sql .operator {
    color: #d73a49 !important;
}

.language-sql .string {
    color: #032f62 !important;
}

.language-sql .number {
    color: #005cc5 !important;
}

.language-sql .function {
    color: #6f42c1 !important;
}

.language-sql .comment {
    color: #6a737d !important;
}

/* Make sure inline code is also readable */
code {
    background-color: rgba(27,31,35,0.05) !important;
    border-radius: 3px;
    font-size: 85%;
    padding: 0.2em 0.4em;
    color: #24292e !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gitbook-main {
        margin-left: 0;
        width: 100%;
    }

    .gitbook-layout.sidebar-open .gitbook-main {
        opacity: 0.4;
    }

    .mobile-menu-button {
        display: block;
    }

    .close-sidebar {
        display: block;
    }

    .gitbook-sidebar {
        transform: translateX(-100%);
    }

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

/* List Styles */
.markdown-content ul {
    padding-left: 2rem;
    margin: 1rem 0;
}

.markdown-content li {
    margin: 0.5rem 0;
}

/* Table Styles */
.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
}

.markdown-content th {
    background: var(--hover-bg);
    font-weight: 600;
}

/* Blockquote Styles */
.markdown-content blockquote {
    border-left: 4px solid var(--border-color);
    color: var(--text-secondary);
    margin: 1rem 0;
    padding: 0 1rem;
}

/* Section Icons */
[href*="/go/"]::before {
    content: "\f121";  /* code */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.5rem;
}

[href*="/sql/"]::before {
    content: "";  /* database */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.5rem;
}
