/* ============================================
   API计费解析系统 - 管理后台主题
   ============================================ */

/* ===== CSS变量 - 深色主题（默认） ===== */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1a1d27;
    --bg-card-hover: #1f2230;
    --bg-sidebar: #0d0f15;
    --bg-input: #1e2130;
    --bg-badge: #252836;

    --border: #2a2d3a;
    --border-light: #333648;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);
    --cyan: #06b6d4;
    --purple: #a855f7;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xs: 4px;

    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --header-height: 60px;
    --transition: all 0.2s ease;
    --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== CSS变量 - 亮色主题 ===== */
body.light-mode {
    --bg-primary: #f1f5f9;
    --bg-secondary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #1e293b;
    --bg-input: #f1f5f9;
    --bg-badge: #e2e8f0;

    --border: #e2e8f0;
    --border-light: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-white: #f8fafc;

    --accent: #6366f1;
    --accent-light: #4f46e5;
    --accent-dark: #4338ca;
    --accent-glow: rgba(99, 102, 241, 0.15);

    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.1);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.1);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 231, 0.1);
    --purple: #9333ea;

    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

/* 亮色主题 - 侧边栏文字颜色（保持白色/浅色） */
body.light-mode .sidebar-brand-text,
body.light-mode .sidebar-link { color: rgba(255,255,255,0.7); }

body.light-mode .sidebar-link:hover { background: rgba(255,255,255,0.1); color: #fff; }

body.light-mode .sidebar-link.active { background: var(--accent); color: #fff; }

body.light-mode .sidebar-user-name { color: #e2e8f0; }
body.light-mode .sidebar-user-info { color: rgba(255,255,255,0.5); }
body.light-mode .sidebar-logout { color: rgba(255,255,255,0.5); }
body.light-mode .sidebar-logout:hover { background: rgba(239,68,68,0.2); color: #fca5a5; }

body.light-mode .sidebar-section-label { color: rgba(255,255,255,0.4); }

/* 亮色主题 - 顶栏、统计卡片、表格 */
body.light-mode .stat-card { background: var(--bg-card); color: var(--text-primary); }
body.light-mode .stat-card .stat-label { color: var(--text-secondary); }
body.light-mode .stat-card .stat-value { color: var(--text-primary); }

body.light-mode table thead th { color: var(--text-secondary); border-bottom-color: var(--border); }
body.light-mode table tbody td { color: var(--text-primary); border-bottom-color: var(--border-light); }

body.light-mode .table-empty { color: var(--text-muted); }

body.light-mode .pricing-card h3 { color: var(--text-primary); }
body.light-mode .pricing-card .price { color: var(--accent-dark); }
body.light-mode .pricing-card .price-desc { color: var(--text-secondary); }
body.light-mode .pricing-card ul li { color: var(--text-secondary); }
body.light-mode .pricing-card .package-desc { color: var(--text-muted); }

body.light-mode .api-item .api-title { color: var(--text-primary); }
body.light-mode .api-item .api-desc { color: var(--text-secondary); }
body.light-mode .api-item .api-url-label { color: var(--text-muted); }
body.light-mode .api-item .api-url-row { background: var(--bg-primary); border-color: var(--border); }
body.light-mode .api-item .api-url-row code { color: var(--text-secondary); }
body.light-mode .api-item .api-status { color: var(--text-muted); }

body.light-mode .info-box { background: var(--bg-primary); border-color: var(--border); color: var(--text-secondary); }
body.light-mode .info-box strong { color: var(--text-primary); }

body.light-mode .badge { color: #fff; }
body.light-mode .badge-default { background: var(--bg-badge); color: var(--text-secondary); }

body.light-mode .flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
body.light-mode .flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
body.light-mode .flash-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

body.light-mode .topbar { border-bottom-color: var(--border); }
body.light-mode .topbar-theme-btn { color: var(--text-secondary); }
body.light-mode .topbar-theme-btn:hover { color: var(--text-primary); }

body.light-mode .source-tag {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    color: #4338ca;
}
body.light-mode .source-tag em { color: #3730a3; }
body.light-mode .source-num { background: rgba(99, 102, 241, 0.15); color: #4338ca; }

body.light-mode .modal-content {
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
body.light-mode .modal-content h3 { color: var(--text-primary); }

body.light-mode .auth-card { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

body.light-mode .form-group label { color: var(--text-secondary); }

body.light-mode .pagination-page { color: var(--text-secondary); }
body.light-mode .pagination-page.current { background: var(--accent); color: #fff; }

body.light-mode .result-card { background: var(--bg-primary); border-color: var(--border); }

body.light-mode .tab-panel .section-title { color: var(--text-primary); }

body.light-mode .order-item { color: var(--text-primary); }
body.light-mode .order-item .order-meta { color: var(--text-secondary); }

body.light-mode .log-item { color: var(--text-primary); }

body.light-mode .checkbox-label { color: var(--text-secondary); }

/* 亮色主题修复 - 白色字体不可见问题 */
body.light-mode .page-header h1 { color: var(--text-primary); }
body.light-mode .pricing-name { color: var(--text-primary); }
body.light-mode .pricing-features strong { color: var(--text-primary); }
body.light-mode .result-card h2 { color: var(--text-primary); }
body.light-mode .api-item-header h4 { color: var(--text-primary); }
body.light-mode .btn-outline:hover { background: var(--bg-input); color: var(--text-primary); }
body.light-mode .btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
body.light-mode .topbar-theme-btn:hover { background: var(--bg-input); color: var(--text-primary); }
body.light-mode .badge-gray { color: var(--text-secondary); }
body.light-mode .pricing-card:hover { border-color: var(--accent); }

/* ===== 基础重置 ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--theme-transition);
}

a { text-decoration: none; color: var(--accent-light); transition: var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; }
code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.85em;
    color: var(--accent-light);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== 布局 ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* 主题切换过渡 - 关键布局元素 */
.sidebar, .topbar, .stat-card, .card, .api-item,
.pricing-card, .modal-content, .auth-card, .result-card, .info-box,
.flash-message, .form-input, .form-select, .form-textarea, .source-item,
.table thead, .table td, .pagination, .social-btn { transition: var(--theme-transition); }

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
}

.sidebar-brand-ver {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--bg-card);
    color: var(--text-white);
}

.sidebar-link.active {
    background: var(--accent);
    color: var(--text-white);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}



.sidebar-link-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-link-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--text-white);
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
    transition: var(--transition);
}

.sidebar-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ===== 主内容区 ===== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 顶部栏 ===== */
.topbar {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.topbar-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-breadcrumb span { color: var(--text-primary); }

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-theme-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.topbar-theme-btn:hover { background: var(--bg-card); color: var(--text-white); }

.topbar-theme-btn .icon-sun,
.topbar-theme-btn .icon-moon {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

body.light-mode .topbar-theme-btn .icon-sun {
    transform: rotate(90deg);
    opacity: 0;
}

body:not(.light-mode) .topbar-theme-btn .icon-moon {
    transform: rotate(-90deg);
    opacity: 0;
}

/* ===== 内容区 ===== */
.content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.stat-icon.rose { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-white); line-height: 1.2; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
}

.card-body {
    padding: 20px;
}

.card-body.no-padding { padding: 0; }

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    font-size: 0.86rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(42, 45, 58, 0.5);
    vertical-align: middle;
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg-card-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.table code {
    font-size: 0.8rem;
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
}

.url-ellipsis {
    max-width: 220px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-amber { background: var(--warning-bg); color: var(--warning); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #ce93d8; }
.badge-orange { background: rgba(255, 152, 0, 0.15); color: #ff9800; }
.badge-gray { background: var(--bg-badge); color: var(--text-muted); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.green { background: var(--success); }
.badge-dot.red { background: var(--danger); }
.badge-dot.amber { background: var(--warning); }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-white);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-card);
    color: var(--text-white);
    border-color: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-white);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 0.95rem;
    border-radius: 10px;
}

.btn-block { width: 100%; }

.btn-danger {
    background: var(--danger);
    color: var(--text-white);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: var(--success);
    color: var(--text-white);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-warning:hover { background: #d97706; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 操作按钮组 ===== */
.action-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Flash消息 ===== */
.flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-message {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
    border: 1px solid;
}

.flash-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
.flash-error { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
.flash-info { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 进度条 ===== */
.progress-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
}

.page-info {
    font-size: 0.83rem;
    color: var(--text-muted);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ===== API卡片 ===== */
.api-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: var(--transition);
}

.api-item:hover { border-color: var(--border-light); }

.api-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.api-item-header h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-white);
}

.api-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.api-url-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
}

.api-url-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.api-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-url-box code {
    flex: 1;
    font-size: 0.8rem;
    color: var(--accent-light);
    background: none;
    padding: 0;
    word-break: break-all;
}

.api-url-box .copy-btn {
    flex-shrink: 0;
    padding: 4px 12px;
    font-size: 0.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.api-url-box .copy-btn:hover { background: var(--accent-dark); }
.copy-btn.copied { background: var(--success) !important; }

/* ===== 套餐卡片 ===== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

.pricing-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.pricing-card.popular {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, var(--bg-card) 30%);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
    padding: 3px 18px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pricing-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 16px;
    margin-top: 4px;
}

.pricing-price {
    margin-bottom: 20px;
}

.price-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent-light);
}

.price-unit {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    margin-bottom: 20px;
    text-align: left;
}

.pricing-features li {
    padding: 7px 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    border-bottom: 1px solid rgba(42, 45, 58, 0.5);
}

.pricing-features li:last-child { border-bottom: none; }
.pricing-features strong { color: var(--text-white); }

.pay-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-lg {
    max-width: 780px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-white); }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover { color: var(--text-white); background: var(--bg-input); }

/* ===== Tab切换 ===== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== 认证页面 (登录/注册) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg-primary);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.auth-header p { color: var(--text-muted); font-size: 0.88rem; }

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span { padding: 0 14px; }

.auth-form .form-group { margin-bottom: 14px; }
.auth-form label { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 5px; }
.auth-form .form-input { padding: 10px 14px; }

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a { color: var(--accent-light); font-weight: 600; }

/* 第三方登录 */
.social-login { margin-bottom: 20px; }
.social-login-title {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.social-btns {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    transition: var(--transition);
    cursor: pointer;
}

.social-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.social-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.social-btn.qq { background: #12b7f5; }
.social-btn.wx { background: #07c160; }
.social-btn.alipay { background: #1677ff; }
.social-btn.sina { background: #e6162d; }
.social-btn.baidu { background: #2932e1; }

/* ===== 首页（未登录） ===== */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.landing-nav {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
}

.landing-brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.landing-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.hero-content { max-width: 640px; }

.hero-badge {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    color: var(--accent-light);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 16px;
    letter-spacing: -1px;
    line-height: 1.2;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--accent-light), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.features {
    padding: 80px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.features h2 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 14px;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ===== 支付结果页 ===== */
.result-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg-primary);
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px;
    text-align: center;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.result-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
}

.result-icon.success { background: var(--success-bg); color: var(--success); }
.result-icon.fail { background: var(--danger-bg); color: var(--danger); }

.result-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 10px;
}

.result-card p {
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ===== 文本颜色 ===== */
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-amber { color: var(--warning); }
.text-blue { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* ===== 弹幕来源管理 ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.source-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.source-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-input, #1e2235);
    border: 1px solid var(--border, #2a2e40);
    border-radius: 8px;
    cursor: move;
    transition: all 0.2s;
    min-width: 200px;
    position: relative;
}
.source-item.active {
    border-color: var(--accent, #4f9fff);
    background: rgba(79, 159, 255, 0.08);
}
.source-item .source-drag-handle {
    color: var(--text-muted, #666);
    font-size: 16px;
    cursor: grab;
    user-select: none;
}
.source-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent, #4f9fff);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.source-item:not(.active) .source-num {
    background: var(--bg-badge, #2a2e40);
    color: var(--text-muted, #666);
}
.source-item .source-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.source-item .source-info small {
    color: var(--text-muted, #666);
    font-size: 11px;
}
.source-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

/* ===== 表格中的来源标签 ===== */
.source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 220px;
}
.source-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: rgba(79, 159, 255, 0.12);
    border: 1px solid rgba(79, 159, 255, 0.25);
    border-radius: 12px;
    font-size: 11px;
    color: #8ab4f8;
    white-space: nowrap;
}
.source-tag em {
    font-style: normal;
    font-weight: 700;
    color: #4f9fff;
    font-size: 10px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

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

    .main-area { margin-left: 0; }

    .topbar-toggle { display: block; }

    .content { padding: 16px; }

    .hero h1 { font-size: 2rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    .pricing-grid { grid-template-columns: 1fr; }

    .features-grid { grid-template-columns: 1fr; }

    .social-btns { flex-direction: column; }

    .auth-card { padding: 24px; }
}

/* 移动端：平板 (max-width: 1024px) */
@media (max-width: 1024px) {
    .sidebar { width: var(--sidebar-width); transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .topbar-toggle { display: block; }
    .content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pricing-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
}

/* 移动端：手机 (max-width: 600px) */
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-icon { width: 36px; height: 36px; font-size: 0.9rem; }
    .stat-value { font-size: 1rem !important; }
    .stat-label { font-size: 0.7rem; }
    .pricing-grid { grid-template-columns: 1fr; gap: 12px; }
    .pricing-card { padding: 16px; }
    .card { padding: 14px; }
    .card-header h3 { font-size: 0.95rem; }
    .content { padding: 12px; }
    .topbar { padding: 0 12px; }
    .topbar-breadcrumb { font-size: 0.78rem; }
    .table th, .table td { padding: 8px 8px; font-size: 0.78rem; }
    .modal-content { padding: 16px; margin: 10px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
    .page-header h2 { font-size: 1.1rem; }
    .api-item { padding: 12px; }
    .api-item-header { flex-direction: column; gap: 6px; }
    .api-url-row { flex-direction: column; gap: 6px; }
    .api-url-row code { width: 100%; overflow-x: auto; }
    .api-url-row .copy-btn { width: 100%; }
    .action-btns { flex-wrap: wrap; gap: 4px; }
    .action-btns .btn { font-size: 0.75rem; padding: 4px 10px; }
    .admin-form .form-row, .admin-form .form-row-3 { grid-template-columns: 1fr; }
    .source-list { font-size: 0.78rem; }
    .info-box { font-size: 0.78rem; }
    .empty-state { padding: 30px 16px; }
    .empty-state h3 { font-size: 1rem; }
    .auth-card { max-width: 100%; margin: 0 12px; padding: 20px; }
    .social-btns { flex-direction: column; }
    .social-btn { width: 100%; justify-content: center; }
    .pagination { gap: 4px; }
    .pagination .page-btn { min-width: 28px; height: 28px; font-size: 0.75rem; padding: 0 6px; }
    .pagination .page-info { font-size: 0.75rem; }
    .pricing-price .price-original { font-size: 0.85rem; }
    .pricing-price .price-amount { font-size: 1.4rem; }
    .badge { font-size: 0.7rem; padding: 2px 6px; }
    .form-error { font-size: 0.78rem; }
    .sidebar { width: 260px; }
    .color-picker-wrap { flex-wrap: wrap; }
    .upload-icon-wrap .icon-upload-btn { font-size: 0.78rem; }
    .pkg-icon-img { width: 16px; height: 16px; }
    .progress-bar { height: 6px; }
    .pay-options { flex-direction: column; gap: 8px; }
    .pay-options .btn { width: 100%; }
}

/* 移动端：极小屏 (max-width: 400px) */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 10px; }
    .stat-icon { width: 32px; height: 32px; font-size: 0.8rem; }
    .stat-value { font-size: 0.9rem !important; }
    .content { padding: 8px; }
    .table-wrap { margin: 0 -8px; }
    .auth-header h2 { font-size: 1.2rem; }
    .auth-header p { font-size: 0.8rem; }
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.content { animation: fadeIn 0.3s ease; }

/* ===== 工具类 ===== */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ===== 信息提示框 ===== */
.info-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 16px;
}

.info-box h4 {
    color: var(--info);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.info-box ul {
    list-style: none;
    padding: 0;
}

.info-box li {
    padding: 3px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-left: 16px;
    position: relative;
}

.info-box li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--info);
}

/* ===== 侧边栏遮罩层 ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .sidebar-overlay.show { display: block; }
}

/* ===== 颜色选择器 ===== */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-input-color {
    width: 44px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
    background: var(--bg-input);
    flex-shrink: 0;
}
.color-hex {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* ===== 图标上传 ===== */
.pkg-icon-img {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 4px;
    border-radius: 3px;
    object-fit: contain;
}
.icon-preview img {
    object-fit: contain;
}

/* ===== 分页控件 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.pagination .page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.pagination .page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pagination .page-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 4px;
}

/* ===== 公告框 ===== */
.announcement-box {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
}
.announcement-header {
    background: var(--accent-glow);
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-light);
    border-bottom: 1px solid var(--border);
}
.announcement-body {
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.announcement-body p {
    margin: 6px 0;
}
.announcement-body a {
    color: var(--accent-light);
    text-decoration: underline;
}