:root {
    --brand: #5b6cf0;
    --brand-2: #7b5cc6;
    --brand-grad: linear-gradient(135deg, #5b6cf0 0%, #7b5cc6 100%);
    --bg: #f4f6fb;
    --border: #e3e7f0;
    --text: #1f2430;
    --muted: #7a8194;
    --card-radius: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 232px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--brand-grad);
    padding: 22px 0 16px;
    z-index: 1000;
    box-shadow: 2px 0 16px rgba(31, 36, 48, 0.08);
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 0 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    margin-bottom: 14px;
}

.sidebar-header h3 {
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    margin: 0;
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    margin: 4px 0 0;
}

.sidebar .nav {
    flex: 1 1 auto;
    overflow-y: auto;
}

.nav-item {
    margin: 2px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link i {
    font-size: 17px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-weight: 600;
}

/* ---------- 主区域 ---------- */
.main-content {
    margin-left: 232px;
    padding: 28px 32px 48px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    font-size: 24px;
    font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 12px rgba(31, 36, 48, 0.06);
    margin-bottom: 20px;
}

.card.mx-auto {
    max-width: 1180px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    padding: 16px 22px;
    font-weight: 600;
    color: var(--text);
}

.card-body {
    padding: 22px;
}

.card-footer {
    border-top: 1px solid var(--border);
    padding: 14px 22px;
    border-radius: 0 0 var(--card-radius) var(--card-radius) !important;
}

/* ---------- 控件 ---------- */
.btn {
    border-radius: 9px;
    font-weight: 500;
}

.btn-primary {
    background: var(--brand-grad);
    border: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-grad);
    filter: brightness(1.06);
}

.btn-primary:disabled {
    background: var(--brand-grad);
    opacity: 0.6;
}

.form-control,
.form-select {
    border-radius: 9px;
    border: 1px solid var(--border);
    padding: 9px 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(91, 108, 240, 0.15);
}

.form-label {
    font-weight: 500;
    color: #3a4152;
}

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

/* ---------- 表格 ---------- */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fd;
    border-bottom: 1px solid var(--border);
    color: #5a6175;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    padding: 12px 14px;
}

.table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    font-size: 14px;
}

.table tbody tr:hover {
    background: #fbfcff;
}

.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 500;
}

/* ---------- 进度条 / 分页 / 空状态 ---------- */
.progress {
    height: 24px;
    border-radius: 12px;
    background: #e9ecf5;
}

.progress-bar {
    background: var(--brand-grad);
    border-radius: 12px;
    font-weight: 600;
}

.pagination {
    margin: 0;
}

.page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    border: 1px solid var(--border);
    color: var(--brand);
}

.page-link:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.page-item.active .page-link {
    background: var(--brand);
    border-color: var(--brand);
}

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 52px;
    display: block;
    margin-bottom: 14px;
}

.empty-state p {
    margin: 0;
}

/* ---------- 加载遮罩 / Toast ---------- */
.spinner-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(31, 36, 48, 0.25);
    z-index: 9000;
}

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

.spinner-content {
    background: #fff;
    padding: 26px 34px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(31, 36, 48, 0.18);
}

/* ---------- API 文档 ---------- */
.api-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border-radius: var(--card-radius);
    background: #fff;
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.08);
}

.api-banner > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-banner-code {
    flex: 1 1 280px;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: #f4f5fb;
    color: #3730a3;
    font-size: 12.5px;
    white-space: nowrap;
    overflow-x: auto;
}

.api-endpoint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #f7f8fc;
    border: 1px solid #e6e8f2;
}

.api-endpoint code {
    color: #1f2430;
    word-break: break-all;
}

.api-table thead th {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
    background: #f7f8fc;
}

.api-table td code {
    white-space: nowrap;
}

.api-type-group {
    height: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: #f7f8fc;
    border: 1px solid #e6e8f2;
}

.api-type-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: #3730a3;
}

.api-type-group ul {
    padding-left: 18px;
    margin: 0;
}

.api-snippet {
    margin-bottom: 14px;
}

.api-snippet:last-child {
    margin-bottom: 0;
}

.api-snippet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}

.api-snippet pre,
.api-response {
    margin: 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: #1f2430;
    color: #e6e8f2;
    font-size: 12.5px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

.api-response {
    background: #11151d;
    color: #c9d1df;
}

/* ---------- 移动端 ---------- */
/* ---------- 移动端 ---------- */
.menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1002;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: var(--brand-grad);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(31, 36, 48, 0.18);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

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

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 68px 14px 32px;
    }

    h2 {
        font-size: 20px;
    }

    .card-body {
        padding: 16px;
    }

    .form-control,
    .form-select {
        font-size: 16px;
    }

    .table thead th,
    .table tbody td {
        padding: 9px 10px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .api-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .api-banner-code {
        white-space: normal;
        word-break: break-all;
    }
}
