/* ==============================================================================
   NIC Registry Platform - Interactive API Documentation & Playground Stylesheet
   ============================================================================== */

.api-docs-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem 1rem;
}

/* Hero Section */
.api-hero {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.api-hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}
.api-hero-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.api-hero-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 800px;
    line-height: 1.5;
}
.api-hero-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.api-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.api-badge-pill.primary {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
[data-theme="dark"] .api-badge-pill.primary {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #93c5fd;
}

/* Sticky Credentials Bar */
.api-credentials-bar {
    position: sticky;
    top: 70px;
    z-index: 40;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.api-cred-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.api-cred-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 200px;
}
.api-cred-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.api-cred-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease;
}
.api-cred-input:focus {
    border-color: var(--primary);
}
.api-cred-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}
.btn-api-action {
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-api-action:hover {
    background: var(--border-color);
}
.btn-api-action.btn-accent {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* Layout Grid */
.api-workspace {
    display: grid;
    grid-template-columns: 280px 1fr 400px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 1200px) {
    .api-workspace {
        grid-template-columns: 260px 1fr;
    }
    .api-code-column {
        grid-column: 1 / -1;
        position: static !important;
        top: auto !important;
    }
}
@media (max-width: 860px) {
    .api-workspace {
        grid-template-columns: 1fr;
    }
    .api-catalog-panel {
        position: static !important;
        top: auto !important;
        max-height: 380px;
    }
    .api-credentials-bar {
        position: relative !important;
        top: auto !important;
        padding: 0.75rem !important;
    }
}

/* Column 1: Endpoint Catalog */
.api-catalog-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    position: sticky;
    top: 170px;
}
.api-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    outline: none;
}
.api-category-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.65rem 0.5rem 0.35rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.api-endpoint-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.1s ease;
    text-decoration: none;
    margin-bottom: 2px;
}
.api-endpoint-item:hover {
    background: var(--bg-surface-alt);
}
.api-endpoint-item.active {
    background: #e0e7ff;
    color: #1e40af;
    font-weight: 600;
}
[data-theme="dark"] .api-endpoint-item.active {
    background: #1e3a8a;
    color: #93c5fd;
}

/* Method Badges */
.method-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    text-align: center;
    min-width: 44px;
}
.method-GET {
    background: #dcfce7;
    color: #15803d;
}
.method-POST {
    background: #dbeafe;
    color: #1d4ed8;
}
.method-PUT {
    background: #fef3c7;
    color: #b45309;
}
.method-DELETE {
    background: #fee2e2;
    color: #b91c1c;
}
[data-theme="dark"] .method-GET {
    background: #14532d;
    color: #86efac;
}
[data-theme="dark"] .method-POST {
    background: #1e3a8a;
    color: #93c5fd;
}
[data-theme="dark"] .method-PUT {
    background: #78350f;
    color: #fde68a;
}
[data-theme="dark"] .method-DELETE {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Column 2: Playground */
.api-playground-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.endpoint-active-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}
.endpoint-route-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.endpoint-active-path {
    font-family: var(--font-mono, monospace);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}
.endpoint-active-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.form-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 1rem 0 0.5rem 0;
}
.param-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
.param-table th, .param-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.param-name {
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    color: var(--text-primary);
}
.param-input {
    width: 100%;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.body-editor-wrap {
    margin-bottom: 1.25rem;
}
.body-editor-textarea {
    width: 100%;
    min-height: 140px;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #0f172a;
    color: #f8fafc;
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    line-height: 1.4;
    outline: none;
    resize: vertical;
}

.playground-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.btn-execute {
    background: #2563eb;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.65rem 1.4rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease;
}
.btn-execute:hover {
    background: #1d4ed8;
}
.btn-execute:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Response Section */
.response-container {
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #1e293b;
    overflow: hidden;
}
.response-header {
    background: #1e293b;
    padding: 0.65rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.response-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #94a3b8;
}
.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
}
.status-badge.s2xx {
    background: #15803d;
    color: #ffffff;
}
.status-badge.s4xx {
    background: #b45309;
    color: #ffffff;
}
.status-badge.s5xx {
    background: #b91c1c;
    color: #ffffff;
}
.btn-copy-sm {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
}
.btn-copy-sm:hover {
    background: #334155;
}
.response-body-pre {
    padding: 1rem;
    margin: 0;
    color: #f8fafc;
    font-family: var(--font-mono, monospace);
    font-size: 0.82rem;
    line-height: 1.45;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
}

/* Column 3: Dynamic Code Generator */
.api-code-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 170px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.code-panel-tabs {
    display: flex;
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}
.code-tab-btn {
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.code-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-surface);
}
.code-preview-wrap {
    background: #0f172a;
    padding: 1rem;
    position: relative;
}
.code-preview-pre {
    margin: 0;
    color: #f8fafc;
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    line-height: 1.45;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
}
.btn-copy-code {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
}
.btn-copy-code:hover {
    background: #334155;
}

/* Developer Security & Integration Guide */
.api-guide-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}
.api-guide-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}
.api-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.api-guide-card {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}
.api-guide-card h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.api-guide-card p, .api-guide-card li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* JSON Syntax Colors */
.json-key { color: #60a5fa; }
.json-string { color: #4ade80; }
.json-number { color: #f59e0b; }
.json-boolean { color: #c084fc; }
.json-null { color: #94a3b8; }

/* SDK Examples & EPP Protocol Tabs */
.docs-sub-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.docs-sub-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.docs-sub-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.docs-pill-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}
.docs-pill-tab {
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.docs-pill-tab:hover {
    color: var(--text-primary);
    border-color: var(--primary);
}
.docs-pill-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.docs-code-card {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.docs-code-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
    flex-wrap: wrap;
}
.docs-lang-switch {
    display: flex;
    gap: 0.35rem;
}
.docs-lang-btn {
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.docs-lang-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.docs-pre {
    margin: 0;
    padding: 1rem;
    background: #0f172a;
    color: #f8fafc;
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    max-height: 440px;
    overflow-y: auto;
}
.epp-frame-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .epp-frame-grid {
        grid-template-columns: 1fr;
    }
}
.epp-frame-box {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.epp-frame-label {
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
