/* 省心Pay 全局样式 - 金融科技风 */
:root {
    --primary: #0f766e;
    --primary-dark: #0d5a54;
    --accent: #10b981;
    --accent-light: #34d399;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --sidebar-w: 240px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s;
    background: #fff; color: var(--text); border-color: var(--border);
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 14px; background: #fff; transition: border .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

/* 提示框 */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== 安装页 ===== */
.install-page, .login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
    padding: 20px;
}
.install-wrap, .login-wrap { width: 100%; max-width: 560px; }
.install-card, .login-card {
    background: #fff; border-radius: 16px; padding: 36px; box-shadow: var(--shadow-lg);
}
.login-card { max-width: 400px; margin: 0 auto; }
.install-head, .login-head { text-align: center; margin-bottom: 24px; }
.install-head h1, .login-head h1 { font-size: 24px; margin: 12px 0 4px; }
.install-head p { color: var(--text-muted); font-size: 13px; }

.logo-badge {
    display: inline-block; padding: 8px 18px; background: var(--primary); color: #fff;
    border-radius: 20px; font-weight: 700; font-size: 15px; letter-spacing: .5px;
}

.form-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.section-title { font-size: 14px; color: var(--primary); margin-bottom: 14px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn-group { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

.install-done { text-align: center; padding: 20px 0; }
.install-done h2 { margin: 16px 0 8px; }
.install-done p { color: var(--text-muted); margin-bottom: 8px; }
.install-foot { text-align: center; color: rgba(255,255,255,.7); margin-top: 20px; font-size: 12px; }

/* ===== 后台布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: #0f172a; color: #cbd5e1;
    padding: 20px 0; position: fixed; top: 0; bottom: 0; left: 0;
    display: flex; flex-direction: column; z-index: 10;
}
.sidebar-logo {
    padding: 0 24px 24px; color: #fff; font-size: 20px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 24px;
    color: #94a3b8; font-size: 14px; transition: all .15s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-item.active { background: rgba(16,185,129,.08); color: var(--accent-light); border-left-color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; }
.sidebar-footer { margin-top: auto; padding: 16px 24px; font-size: 12px; color: #64748b; border-top: 1px solid rgba(255,255,255,.05); }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 28px 32px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}
.topbar h1 { font-size: 22px; }
.topbar .user-box { display: flex; align-items: center; gap: 12px; }
.topbar .avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600;
}

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent);
}
.stat-card.t-blue::before { background: #3b82f6; }
.stat-card.t-green::before { background: var(--accent); }
.stat-card.t-orange::before { background: var(--warning); }
.stat-card.t-purple::before { background: #8b5cf6; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 卡片容器 */
.panel {
    background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 20px; overflow: hidden;
}
.panel-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.panel-head h3 { font-size: 15px; }
.panel-body { padding: 20px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { color: var(--text-muted); font-weight: 500; background: #f8fafc; }
.table tr:hover td { background: #f8fafc; }
.table .num { font-family: "SF Mono", Consolas, monospace; }

/* 状态标签 */
.tag {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-paid { background: #d1fae5; color: #065f46; }
.tag-expired { background: #fee2e2; color: #991b1b; }

/* 二维码网格 */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.qr-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.qr-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.qr-card img { width: 100%; height: 180px; object-fit: cover; background: #f8fafc; }
.qr-card .qr-info { padding: 12px; }
.qr-card .qr-info h4 { font-size: 14px; margin-bottom: 4px; }
.qr-card .qr-info .meta { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* API 信息 */
.code-block {
    background: #0f172a; color: #e2e8f0; border-radius: var(--radius);
    padding: 16px; font-family: "SF Mono", Consolas, monospace; font-size: 13px;
    overflow-x: auto; position: relative;
}
.code-block .copy-btn {
    position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.1);
    color: #fff; border: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,.2); }
.key-row {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: #f8fafc; border-radius: var(--radius); margin-bottom: 10px;
}
.key-row .key-val { flex: 1; font-family: monospace; font-size: 13px; color: var(--text); }
.key-row .key-status { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #d1fae5; color: #065f46; }

/* ===== 支付页 ===== */
.pay-page {
    min-height: 100vh; background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pay-card {
    background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
    max-width: 380px; width: 100%; overflow: hidden;
}
.pay-head {
    background: var(--primary); color: #fff; padding: 20px; text-align: center;
}
.pay-head h1 { font-size: 18px; }
.pay-head .pay-tip { font-size: 12px; opacity: .85; margin-top: 4px; }
.pay-amount-box { text-align: center; padding: 28px 20px 8px; }
.pay-amount-label { color: var(--text-muted); font-size: 14px; }
.pay-amount {
    font-size: 48px; font-weight: 800; color: var(--danger); margin: 8px 0;
    font-family: "SF Mono", Consolas, monospace;
}
.pay-amount .yuan { font-size: 20px; }
.pay-warning {
    background: #fff7ed; color: #9a3412; padding: 10px 16px; font-size: 12px;
    text-align: center; border-top: 1px dashed #fed7aa; border-bottom: 1px dashed #fed7aa;
    margin: 16px 0;
}
.pay-qr-box { padding: 8px 20px 24px; text-align: center; }
.pay-qr-box img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--border); }
.pay-qr-box .scan-tip { font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.pay-order { text-align: center; padding: 12px; font-size: 12px; color: var(--text-muted); background: #f8fafc; }
.pay-countdown { font-size: 13px; color: var(--warning); margin-top: 8px; }

/* 文档页 */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.docs-toc { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: sticky; top: 20px; height: fit-content; }
.docs-toc a { display: block; padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--text-muted); }
.docs-toc a:hover { background: #f1f5f9; color: var(--primary); }
.docs-content { background: #fff; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); min-height: 600px; }
.docs-content h2 { font-size: 20px; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 { font-size: 16px; margin: 16px 0 8px; }
.docs-content p { margin-bottom: 12px; color: #334155; }
.docs-content ul { margin: 8px 0 16px 20px; }
.docs-content li { margin-bottom: 6px; }
.docs-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: var(--primary-dark); }

.empty { text-align: center; padding: 40px; color: var(--text-muted); }
.empty svg { width: 48px; height: 48px; opacity: .4; margin-bottom: 12px; }

.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px;
    text-align: center; cursor: pointer; transition: all .15s;
}
.upload-area:hover { border-color: var(--accent); background: #f0fdf4; }
.upload-area svg { width: 40px; height: 40px; color: var(--text-muted); margin-bottom: 8px; }

@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .docs-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { position: static; width: 100%; }
    .main { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
}
