/* SPMC API Documentation Styles */
/* Brand Colors: Primary #4F46E5 (Indigo), Success #10B981, Warning #F59E0B, Danger #EF4444 */

:root {
    --color-primary: #c00000;
    --color-primary-dark: #800000;
    --color-primary-light: #ff4444;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-text: #1F2937;
    --color-text-light: #6B7280;
    --color-border: #E5E7EB;
    --color-bg: #FFFFFF;
    --color-bg-light: #F9FAFB;
    --color-bg-dark: #F3F4F6;
    --sidebar-width: 280px;
    --header-height: 60px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    font-size: 16px;
}

code {
    font-family: 'Monaco', 'Courier New', 'Consolas', monospace;
    font-size: 0.9em;
}

/* Layout Container */
.docs-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-light);
    border-right: 1px solid var(--color-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-header .version {
    font-size: 14px;
    opacity: 0.9;
}

/* Search Container */
.search-container {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--color-bg);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.2s;
}

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

.search-result-item:hover {
    background: var(--color-bg-light);
}

.search-result-title {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.search-result-path {
    font-size: 13px;
    color: var(--color-text-light);
    font-family: 'Monaco', monospace;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

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

.nav-link.active {
    background: var(--color-primary);
    color: white;
}

.nav-link .badge {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.nav-link.active .badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Collapsible Navigation */
.nav-item.collapsible > .nav-link::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    margin-left: 8px;
}

.nav-item.collapsible.collapsed > .nav-link::after {
    transform: rotate(-90deg);
}

.nav-item.collapsible.collapsed .nav-sublist {
    display: none;
}

/* Sub-navigation */
.nav-sublist {
    list-style: none;
    padding-left: 0;
    margin-top: 4px;
}

.nav-subitem {
    margin-bottom: 2px;
}

.nav-sublink {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 40px;
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.nav-sublink:hover {
    background: var(--color-bg-dark);
    color: var(--color-text);
}

.nav-sublink.active {
    background: var(--color-bg-dark);
    color: var(--color-primary);
    font-weight: 500;
}

/* Method Badges */
.method-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 8px;
    letter-spacing: 0.5px;
}

.method-get {
    background: #61AFFE;
    color: white;
}

.method-post {
    background: var(--color-success);
    color: white;
}

.method-put {
    background: var(--color-warning);
    color: white;
}

.method-delete {
    background: var(--color-danger);
    color: white;
}

.method-patch {
    background: #50E3C2;
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-light);
}

.sidebar-footer p {
    margin-bottom: 4px;
}

.sidebar-footer code {
    background: var(--color-bg-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

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

.content-section {
    margin-bottom: 60px;
}

.content-section h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
}

.content-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
    margin-top: 32px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border);
}

.content-section h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
    margin-top: 24px;
}

.content-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
    margin-top: 20px;
}

.content-section p {
    margin-bottom: 16px;
    color: var(--color-text);
    line-height: 1.7;
}

.lead {
    font-size: 18px;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* Inline Code */
code:not(pre code) {
    background: var(--color-bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-danger);
    font-size: 0.9em;
}

.base-url {
    font-size: 16px;
    font-weight: 600;
}

/* Info Boxes */
.info-box {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.info-box-performance {
    border-left-color: var(--color-success);
}

/* Alert Boxes */
.alert {
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
    border-left: 4px solid;
}

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

.alert-danger {
    background: #FEE2E2;
    border-left-color: var(--color-danger);
    color: #991B1B;
}

.alert-info {
    background: #DBEAFE;
    border-left-color: #3B82F6;
    color: #1E40AF;
}

/* Endpoint Cards */
.endpoint-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.endpoint-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.endpoint-path {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg-light);
    padding: 6px 12px;
    border-radius: 6px;
}

.endpoint-summary h3 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 8px;
}

.endpoint-summary p {
    color: var(--color-text-light);
}

.endpoint-section {
    margin-top: 24px;
}

/* Platform Support */
.platform-support {
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.platform-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.platform-supported {
    background: #D1FAE5;
    color: #065F46;
}

.platform-unsupported {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

/* Parameters Table */
.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.params-table thead {
    background: var(--color-bg-light);
}

.params-table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.params-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.params-table tr:last-child td {
    border-bottom: none;
}

.params-table code {
    background: var(--color-bg-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-required {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-optional {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

/* Response Items */
.response-item {
    margin: 16px 0;
}

.response-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.response-description {
    color: var(--color-text-light);
    font-size: 14px;
}

/* Status Code Badges */
.status-code {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
}

.status-2xx {
    background: #D1FAE5;
    color: #065F46;
}

.status-4xx {
    background: #FEF3C7;
    color: #92400E;
}

.status-5xx {
    background: #FEE2E2;
    color: #991B1B;
}

/* Code Examples */
.code-example {
    background: #282C34;
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #21252B;
    border-bottom: 1px solid #181A1F;
}

.code-language {
    color: #ABB2BF;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.copy-button:active {
    transform: scale(0.95);
}

.code-example pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-example code {
    color: #ABB2BF;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
}

/* Code Tabs */
.code-tabs {
    margin: 16px 0;
}

.tab-buttons {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-button:hover {
    color: var(--color-text);
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.example-description {
    color: var(--color-text-light);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Database Documentation Styles */
.table-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.table-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
    cursor: pointer;
}

.table-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table-card h3 {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--color-primary);
}

.table-card p {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 12px;
}

.table-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-light);
}

/* Mermaid Diagram Container */
.mermaid-container {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin: 24px 0;
    overflow-x: auto;
}

.mermaid-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mermaid-controls button {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.mermaid-controls button:hover {
    background: var(--color-bg-dark);
    border-color: var(--color-primary);
}

/* Column Details */
.column-list {
    list-style: none;
    margin: 16px 0;
}

.column-item {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: start;
}

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

.column-name {
    font-weight: 600;
    color: var(--color-text);
    font-family: 'Monaco', monospace;
}

.column-type {
    color: var(--color-primary);
    font-family: 'Monaco', monospace;
    font-size: 13px;
}

.column-constraints {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.constraint-badge {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* Footer */
.content-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
}

.content-footer a {
    color: var(--color-primary);
    text-decoration: none;
}

.content-footer a:hover {
    text-decoration: underline;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .content-section h1 {
        font-size: 28px;
    }
    
    .content-section h2 {
        font-size: 24px;
    }
    
    .content-section h3 {
        font-size: 20px;
    }
    
    .endpoint-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .params-table {
        font-size: 12px;
    }
    
    .params-table th,
    .params-table td {
        padding: 8px;
    }
    
    .table-list {
        grid-template-columns: 1fr;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.search-results::-webkit-scrollbar,
.code-example pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track,
.code-example pre::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb,
.code-example pre::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover,
.code-example pre::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* Print Styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .copy-button,
    .tab-buttons {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
    }
    
    .endpoint-card {
        page-break-inside: avoid;
    }
}

/* Additional Database Documentation Styles */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.stat-card {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diagram-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-secondary {
    background: var(--color-bg-light);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-dark);
    border-color: var(--color-primary);
}

.table-header {
    margin-bottom: 16px;
}

.table-header h3 {
    margin: 0;
    color: var(--color-primary);
}

.table-description {
    margin-bottom: 20px;
    padding: 12px;
    background: var(--color-bg-light);
    border-left: 4px solid var(--color-primary);
    border-radius: 4px;
}

.table-section {
    margin-top: 24px;
}

.table-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
}

.columns-table,
.indexes-table,
.constraints-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.columns-table thead,
.indexes-table thead,
.constraints-table thead {
    background: var(--color-bg-light);
}

.columns-table th,
.indexes-table th,
.constraints-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.columns-table td,
.indexes-table td,
.constraints-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.columns-table tr:last-child td,
.indexes-table tr:last-child td,
.constraints-table tr:last-child td {
    border-bottom: none;
}

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

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

.badge-nullable {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

.badge-not-null {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-unique {
    background: #D1FAE5;
    color: #065F46;
}

.badge-index {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

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

.relationships-list {
    list-style: none;
    padding: 0;
}

.relationships-list li {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.relationships-list li:last-child {
    border-bottom: none;
}

.relationship-type {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-bg-dark);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
}

.migrations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.migration-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
}

.migration-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.migration-version {
    background: var(--color-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

.migration-filename {
    color: var(--color-text-light);
    font-size: 13px;
}

.migration-description {
    margin-bottom: 12px;
    color: var(--color-text);
}

.migration-tables {
    margin-bottom: 8px;
    font-size: 14px;
}

.migration-tables a {
    color: var(--color-primary);
    text-decoration: none;
}

.migration-tables a:hover {
    text-decoration: underline;
}

.migration-date {
    font-size: 12px;
    color: var(--color-text-light);
}

/* Diagram Error Styling */
.diagram-error {
    padding: 20px;
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    border-radius: 6px;
    color: #991B1B;
}

.diagram-error strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.diagram-error p {
    margin: 0;
    font-size: 14px;
}

/* Highlight for search matches */
mark {
    background: #FEF3C7;
    color: #92400E;
    padding: 2px 4px;
    border-radius: 2px;
}
