/* ========== OpenAPI 页面样式 ========== */

.openapi-container {
    max-width: 900px;
    margin: 0 auto;
}

/* 页面标题 */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    margin: 0 0 6px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
}

.page-desc {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

/* Tab 切换 */
.api-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
}

.api-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.api-tab:hover {
    color: #374151;
}

.api-tab.active {
    background: white;
    color: var(--business-color, #5B7FFF);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.api-tab svg {
    flex-shrink: 0;
}

/* Tab 内容 */
.api-tab-content {
    display: none;
}

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

/* ========== 密钥管理 ========== */
.keys-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.keys-count {
    font-size: 13px;
    color: #6b7280;
}

.btn-create {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--business-color, #5B7FFF);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-create:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

/* 密钥列表 */
.keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.key-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.key-card.disabled {
    opacity: 0.6;
}

.key-info {
    flex: 1;
    min-width: 0;
}

.key-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.key-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.key-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.key-status.enabled {
    background: #dcfce7;
    color: #16a34a;
}

.key-status.disabled {
    background: #fee2e2;
    color: #dc2626;
}

.key-preview {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #6b7280;
    margin-bottom: 4px;
}

.key-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
}

.key-meta span {
    display: inline-flex;
    align-items: center;
}

.key-actions {
    display: flex;
    gap: 4px;
}

.key-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
}

.key-action-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.key-action-btn.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* 空状态 */
.keys-empty,
.logs-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.keys-empty .empty-icon {
    margin-bottom: 16px;
    opacity: 0.4;
}

.keys-empty p {
    margin: 0 0 6px 0;
    font-size: 15px;
    color: #6b7280;
}

.keys-empty span {
    display: block;
    font-size: 13px;
    margin-bottom: 20px;
}

.logs-empty p {
    margin: 0;
    font-size: 14px;
}

/* ========== 接口文档 ========== */
.docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.docs-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.docs-info span {
    font-size: 12px;
    color: #6b7280;
}

.docs-info code {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #374151;
}

.btn-copy-md {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-copy-md:hover {
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
}

/* 文档区块 */
.doc-section {
    margin-bottom: 24px;
}

.doc-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
}

.doc-section > p {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px 0;
}

.doc-code {
    padding: 12px 14px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 8px;
}

.doc-code code {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #e2e8f0;
}

.doc-hint {
    font-size: 12px;
    color: #9ca3af;
}

.doc-hint code {
    padding: 2px 6px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 11px;
}

/* 接口卡片 */
.endpoint {
    padding: 16px;
    background: white;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.endpoint-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.method {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.method.get {
    background: #dbeafe;
    color: #1d4ed8;
}

.method.post {
    background: #dcfce7;
    color: #16a34a;
}

.method.put {
    background: #fef3c7;
    color: #d97706;
}

.method.delete {
    background: #fee2e2;
    color: #dc2626;
}

.endpoint-title code {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #374151;
}

.endpoint-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.endpoint-params,
.endpoint-response,
.endpoint-example {
    margin-top: 12px;
}

.params-label,
.response-label,
.example-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.endpoint-params table {
    width: 100%;
    font-size: 13px;
}

.endpoint-params td {
    padding: 6px 0;
    vertical-align: top;
    border-bottom: 1px solid #f3f4f6;
}

.endpoint-params td:first-child {
    width: 140px;
}

.endpoint-params td:first-child code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #374151;
}

.endpoint-params td:nth-child(2) {
    width: 60px;
}

.endpoint-params td:last-child {
    color: #6b7280;
}

.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.tag.required {
    background: #fee2e2;
    color: #dc2626;
}

.tag.optional {
    background: #f3f4f6;
    color: #6b7280;
}

.endpoint-response pre,
.endpoint-example pre {
    margin: 0;
    padding: 12px 14px;
    background: #1e293b;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #e2e8f0;
    line-height: 1.5;
    overflow-x: auto;
}

/* 平台ID表格和错误码表格 */
.platform-table,
.error-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.platform-table td,
.error-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.platform-table td:first-child,
.error-table td:first-child {
    width: 180px;
}

.platform-table td:first-child code,
.error-table td:first-child code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    color: #374151;
}

.platform-table td:last-child,
.error-table td:last-child {
    color: #6b7280;
}

/* ========== 调用日志 ========== */
.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.logs-info {
    font-size: 13px;
    color: #6b7280;
}

.btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-clear:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* 日志列表 */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: white;
    border-radius: 8px;
    font-size: 13px;
}

.log-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.log-status-dot.success {
    background: #10b981;
}

.log-status-dot.failed,
.log-status-dot.error {
    background: #ef4444;
}

.log-endpoint {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #374151;
    font-size: 13px;
}

.log-key {
    font-size: 12px;
    color: #9ca3af;
    margin-left: auto;
}

.log-detail {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 18px;
    font-size: 12px;
    color: #9ca3af;
}

.log-time {
    flex-shrink: 0;
}

.log-business {
    padding: 2px 6px;
    background: #f3f4f6;
    border-radius: 4px;
}

.log-message {
    color: #6b7280;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    background: #f9fafb;
}

/* 表单 */
.form-field {
    margin-bottom: 16px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-field label .optional {
    font-weight: 400;
    color: #9ca3af;
}

.form-field input {
    width: 100%;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #1f2937;
    box-sizing: border-box;
    transition: all 0.15s;
}

.form-field input:focus {
    outline: none;
    border-color: var(--business-color, #5B7FFF);
    box-shadow: 0 0 0 3px rgba(91, 127, 255, 0.1);
}

.form-field input::placeholder {
    color: #9ca3af;
}

/* 按钮 */
.btn-cancel {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel:hover {
    background: #f9fafb;
}

.btn-confirm {
    padding: 8px 16px;
    background: var(--business-color, #5B7FFF);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-confirm:hover {
    filter: brightness(0.95);
}

/* Key 显示 */
.key-warning {
    font-size: 13px;
    color: #d97706;
    margin: 0 0 12px 0;
    text-align: center;
}

.key-value {
    padding: 14px 16px;
    background: #1e293b;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #e2e8f0;
    word-break: break-all;
    margin-bottom: 16px;
}

.btn-copy-key {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-copy-key:hover {
    background: #e5e7eb;
}

/* ========== API 文档增强样式 ========== */

/* auto_prepare 模式说明框 */
.endpoint-note {
    margin: 12px 0 16px 0;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    overflow: hidden;
}

.endpoint-note .note-title {
    padding: 10px 14px;
    background: rgba(251, 191, 36, 0.2);
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
}

.endpoint-note .note-content {
    padding: 12px 14px;
    font-size: 13px;
    color: #78350f;
    line-height: 1.6;
}

.endpoint-note .note-content p {
    margin: 0 0 10px 0;
}

.endpoint-note .note-content p:last-child {
    margin-bottom: 0;
}

.endpoint-note .note-content ul,
.endpoint-note .note-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.endpoint-note .note-content li {
    margin-bottom: 4px;
}

.endpoint-note .note-content code {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* 示例描述 */
.example-desc {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 6px;
}

/* 请求示例 */
.example-request {
    margin-bottom: 12px !important;
}

/* 响应示例区分成功和失败 */
.example-response {
    margin-bottom: 12px !important;
}

.example-response.error {
    border-left: 3px solid #ef4444;
}

/* 错误码分类标题 */
.error-category {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.error-category:first-of-type {
    margin-top: 12px;
}

/* 带表头的错误码表格 */
.error-table thead tr {
    background: #f8fafc;
}

.error-table thead th {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
}

.error-table tbody td:nth-child(3) {
    font-size: 12px;
    color: #9ca3af;
}

/* 文档区块描述 */
.section-desc {
    font-size: 12px !important;
    color: #9ca3af !important;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 16px !important;
}

.section-desc code {
    font-size: 11px;
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
