/**
 * API Documentation Styles
 *
 * Content styles for API documentation pages.
 * Header and footer come from unified components.
 * Base styles come from app CSS (vars.css, general.css, bootstrap).
 */

/* ===== NAVBAR TITLE (API variant) =====
 * Centered title in navbar for API documentation pages.
 * Similar to help page search field positioning.
 */
.navbar-title-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar-page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-foreground);
    display: flex;
    align-items: center;
}

.navbar-page-title i {
    color: var(--theme-interactive);
    font-size: 1rem;
}

/* API Container */
.api-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* API Layout - Sidebar + Content */
.api-docs-page {
    display: flex;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

/* API Sidebar */
.api-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Note: api-sidebar-header removed - title now in navbar */

.api-nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-subtle-foreground);
    margin: 0 0 0.75rem;
    padding: 0 0.75rem;
}

.api-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.api-nav-item {
    margin-bottom: 0.125rem;
}

.api-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    color: var(--theme-foreground);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s;
}

.api-nav-link:hover {
    background-color: var(--theme-hover-bg);
    color: var(--theme-foreground);
    text-decoration: none;
}

.api-nav-link.active {
    background-color: var(--theme-interactive-light);
    color: var(--theme-interactive);
    font-weight: 500;
}

.api-nav-link i {
    width: 1rem;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.7;
}

.api-nav-link.active i {
    opacity: 1;
}

/* API Content Area */
.api-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding-top: 1rem;
}

/* Note: .api-page-header removed - title now in sidebar header */

/* API Section */
.api-section {
    margin-bottom: 3rem;
}

.api-section h1,
.api-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.api-section p {
    line-height: 1.6;
    color: var(--theme-foreground);
    margin-bottom: 1rem;
}

/* API Endpoint Box */
.api-endpoint-box {
    background: var(--theme-background-secondary-bg);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.api-endpoint-box p {
    font-size: 0.8125rem;
    color: var(--theme-subtle-foreground);
    margin: 0 0 0.5rem;
}

.api-endpoint-box code {
    color: var(--theme-interactive);
    font-size: 0.9375rem;
}

/* API Two Column Layout */
.api-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.api-two-col > .api-section-left {
    /* Documentation text */
}

.api-two-col > .api-section-right {
    /* Code examples */
}

/* API Card (for request/response examples) */
.api-card {
    background: var(--theme-background-secondary-bg);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.api-card-header {
    background: var(--theme-tertiary-bg);
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-bottom: 1px solid var(--theme-border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-card-body {
    padding: 1rem;
}

/* HTTP Method Badge */
.api-method {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.api-method-get {
    background-color: #10b981;
    color: white;
}

.api-method-post {
    background-color: #3b82f6;
    color: white;
}

.api-method-put {
    background-color: #f59e0b;
    color: white;
}

.api-method-delete {
    background-color: #ef4444;
    color: white;
}

/* Status Badge */
.api-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.api-status-200 {
    background-color: #10b981;
    color: white;
}

.api-status-201 {
    background-color: #10b981;
    color: white;
}

.api-status-400 {
    background-color: #f59e0b;
    color: white;
}

.api-status-401 {
    background-color: #ef4444;
    color: white;
}

.api-status-404 {
    background-color: #6b7280;
    color: white;
}

/* Type Badge */
.api-type {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--theme-tertiary-bg);
    color: var(--theme-foreground);
}

/* ===== DARK MODE BADGE FIX =====
 * Bootstrap's .badge.bg-secondary has poor contrast in dark mode.
 * This override ensures readable text on badge backgrounds.
 */
[data-bs-theme="dark"] .badge.bg-secondary,
.dark .badge.bg-secondary {
    background-color: #6b5b7b !important;
    color: #fff !important;
}

/* ===== CODE EXAMPLE TABS =====
 * Styled tabs for code examples (PHP/JavaScript) in cards
 */
.api-content .card .card-header.p-0 {
    background: var(--theme-tertiary-bg);
}

.api-content .card .nav-tabs.card-header-tabs {
    border-bottom: 1px solid var(--theme-border-color);
    margin: 0;
}

.api-content .card .nav-tabs .nav-link {
    color: var(--theme-subtle-foreground);
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.api-content .card .nav-tabs .nav-link:hover {
    color: var(--theme-foreground);
    border-bottom-color: var(--theme-border-color) !important;
}

.api-content .card .nav-tabs .nav-link.active {
    color: var(--theme-interactive);
    background: transparent !important;
    border-bottom-color: var(--theme-interactive) !important;
}

/* Code Block */
.api-code-block {
    background: var(--theme-code-bg, #1e1e1e);
    border-radius: 6px;
    overflow-x: auto;
    margin: 0;
}

.api-code-block pre {
    margin: 0;
    padding: 1rem;
}

.api-code-block code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* Divider */
.api-divider {
    border: none;
    border-top: 1px solid var(--theme-border-color);
    margin: 2rem 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .api-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .api-docs-page {
        flex-direction: column;
    }

    .api-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
        border-bottom: 1px solid var(--theme-border-color);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .api-nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .api-nav-item {
        margin-bottom: 0;
    }

    .api-nav-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }

    .api-nav-link i {
        display: none;
    }
}
