/* Common styles for Gensee API Documentation */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    display: grid;
    grid-template-columns: 250px 1fr 350px;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Table of Contents */
.toc {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    height: fit-content;
}

.toc h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 0;
    display: block;
    border-radius: 4px;
    transition: all 0.2s;
}

.toc a:hover {
    color: #3498db;
    background-color: #f1f3f4;
    padding-left: 10px;
}

.toc a.active {
    color: #3498db;
    background-color: #e3f2fd;
    padding-left: 10px;
    font-weight: 600;
}

.toc a.disabled {
    color: #bbb;
    cursor: not-allowed;
}

.toc a.disabled:hover {
    color: #bbb;
    background-color: transparent;
    padding-left: 0;
}

.toc h4 {
    color: #7f8c8d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 20px 0 10px 0;
    letter-spacing: 0.5px;
}

.toc .sub-menu {
    margin-left: 15px;
    border-left: 2px solid #ecf0f1;
    padding-left: 15px;
}

.toc .sub-menu a {
    font-size: 13px;
    color: #7f8c8d;
}

/* Brand Header */
.brand-header {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    margin-right: 12px;
}

.brand-name, .brand-text {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.learn-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.learn-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.section-divider {
    height: 1px;
    background: #ecf0f1;
    margin: 20px 0;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.main-content h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 32px;
}

.main-content h2 {
    color: #34495e;
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
    font-size: 24px;
}

.main-content h3 {
    color: #34495e;
    margin: 25px 0 15px 0;
    font-size: 18px;
}

.main-content p {
    margin-bottom: 15px;
    color: #555;
}

.main-content pre {
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 15px 0;
}

.main-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #e83e8c;
}

.main-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.main-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.main-content table th,
.main-content table td {
    border: 1px solid #e1e4e8;
    padding: 12px;
    text-align: left;
}

.main-content table th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #2c3e50;
}

.main-content table td {
    color: #555;
}

.main-content ul,
.main-content ol {
    margin: 15px 0 15px 30px;
}

.main-content li {
    margin-bottom: 8px;
    color: #555;
}

/* Endpoint Badge */
.endpoint-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    margin-right: 8px;
    text-transform: uppercase;
    min-width: 45px;
    text-align: center;
    color: white;
}

.endpoint-badge.post {
    background-color: #e67e22;
}

.endpoint-badge.get {
    background-color: #3498db;
}

.endpoint-separator {
    color: #bbb;
    margin: 0 8px;
    font-weight: normal;
}

.endpoint-url {
    font-family: 'Monaco', 'Consolas', monospace;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-block;
}

/* Info Box */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.info-box h3 {
    color: #1565c0;
    margin-top: 0;
    font-size: 16px;
}

.info-box p {
    color: #1565c0;
    margin: 5px 0;
}

/* Subtitle text styling */
.subtitle-text {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 30px;
}

/* Cyan info box variant */
.info-box.cyan {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
}

.info-box.cyan h3 {
    color: #3498db;
}

.info-box.cyan p {
    color: #555;
}

/* Purple info box variant */
.info-box.purple {
    background: #f3e8f8;
    border-left: 4px solid #9b59b6;
}

.info-box.purple h3 {
    color: #9b59b6;
}

/* Warning Box */
.warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.warning-box h3 {
    color: #856404;
    margin-top: 0;
    font-size: 16px;
}

.warning-box p {
    color: #856404;
    margin: 5px 0;
}

/* Margin bottom utility */
.mb-0 {
    margin-bottom: 0;
}

/* Margin top utilities for h3 */
h3.mt-20 {
    margin-top: 20px;
}

h3.mt-30 {
    margin-top: 30px;
}

/* Endpoint Box (for overview pages) */
.endpoint-box {
    background: white;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0;
    transition: all 0.3s;
}

.endpoint-box:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.endpoint-box h3 {
    margin-top: 0;
    color: #2c3e50;
}

.endpoint-box a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

.endpoint-box a:hover {
    text-decoration: underline;
}

/* Code Panel */
.code-panel {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.code-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* Tab Container Styles */
.tab-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.tab-header {
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.tab-buttons {
    display: flex;
}

.header-copy-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-right: 16px;
    transition: background 0.2s;
}

.header-copy-button:hover {
    background: #2980b9;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-button.active {
    color: #2c3e50;
    background: white;
    border-bottom-color: #3498db;
}

.tab-button:hover:not(.active) {
    background: #e9ecef;
    color: #495057;
}

.tab-content {
    display: none;
    padding: 0;
}

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

.tab-content pre {
    background: none;
    padding: 16px;
    border-radius: 0;
    overflow: auto;
    max-height: 400px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}

/* Code Section Styles */
.code-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.code-header {
    background: #2c3e50;
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-content {
    padding: 16px;
}

.code-content pre {
    background: none;
    padding: 0;
    border-radius: 0;
    overflow: auto;
    max-height: 400px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}

/* Status and Error Badges */
.status-code {
    background: #27ae60;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.error-code {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

/* Parameter Styles */
.param-name {
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    color: #e74c3c;
}

.param-type {
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Monaco', 'Consolas', monospace;
}

.required {
    color: #e74c3c;
    font-size: 12px;
    font-weight: 600;
}

.optional {
    color: #7f8c8d;
    font-size: 12px;
}

/* Legacy Code Example Styles (for backwards compatibility) */
.code-example {
    background: #2d2d2d;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin-top: 10px;
    position: relative;
}

.code-example pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: #f8f8f2;
    font-size: 12px;
    line-height: 1.5;
}

.copy-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.copy-button:hover {
    background: #2980b9;
}

/* API Token Styling */
.api-token {
    color: #3498db;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.api-token:hover {
    color: #2980b9;
}

.api-token.loading {
    color: #95a5a6;
    cursor: wait;
    pointer-events: none;
}

.api-token.loaded {
    color: #27ae60;
    font-family: 'Monaco', 'Consolas', monospace;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Editable Query Styles (for search.html) */
.editable-query {
    background: none;
    border: none;
    padding: 0;
    color: #3498db;
    text-decoration: underline;
    font-weight: 600;
    cursor: text;
    outline: none;
    transition: color 0.2s;
    display: inline;
}

.editable-query:hover {
    color: #2980b9;
}

.editable-query:focus {
    color: #2980b9;
}

.editable-query:empty:before {
    content: attr(data-placeholder);
    color: #adb5bd;
    font-style: italic;
}

.edit-icon {
    display: inline-block;
    margin-left: 4px;
    color: #3498db;
    font-size: 11px;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: text;
}

.editable-query:hover + .edit-icon,
.edit-icon:hover {
    opacity: 1;
}

.editable-query:focus + .edit-icon {
    opacity: 1;
}

/* Migration Box (for search.html) */
.migration-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.migration-box h3 {
    color: #856404;
    margin-top: 0;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.migration-box h3::after {
    content: '▼';
    font-size: 12px;
    transition: transform 0.3s;
}

.migration-box h3.collapsed::after {
    transform: rotate(-90deg);
}

.migration-content {
    margin-top: 15px;
    color: #856404;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.migration-content.collapsed {
    max-height: 0;
    margin-top: 0;
}

.migration-content ol {
    margin: 15px 0 15px 20px;
    padding-left: 0;
}

.migration-content li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.migration-content a {
    color: #0056b3;
    text-decoration: none;
    font-weight: 600;
}

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

.migration-content code {
    background: #fff;
    border: 1px solid #d4a017;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 200px 1fr 300px;
    }
}

@media (max-width: 992px) {
    .container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .toc,
    .code-panel {
        position: static;
    }

    .main-content {
        padding: 20px;
    }
}
