/* ==========================================================================
   内网穿透平台 - 前台样式
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --text-sub: #4b5563;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f1f3f7;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: var(--text); }
.logo img { height: 32px; }
.logo-mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 15px;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
    padding: 7px 14px; border-radius: var(--radius-sm);
    color: var(--text-sub); font-size: 14px; transition: all .15s;
}
.nav a:hover { background: var(--border-light); color: var(--text); }
.nav a.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 16px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; color: var(--text-sub);
    font-size: 14px; font-family: inherit; cursor: pointer;
    transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #d1d5db; color: var(--text); background: #fafafa; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: #bfdbfe; background: var(--primary-light); }
.btn-outline-primary:hover { background: #dbeafe; color: var(--primary-dark); border-color: #93c5fd; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ---------- 统计块 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--text); }
.stat-value small { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 500; color: var(--text-sub); }
.form-label .req { color: var(--danger); margin-left: 3px; }
.form-control {
    width: 100%; height: 38px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; color: var(--text);
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
select.form-control { cursor: pointer; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--text-sub); }
.checkbox input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 12px 14px; background: #fafbfc;
    color: var(--text-sub); font-weight: 600; font-size: 13px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--border-light); color: var(--text-sub); }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.actions { white-space: nowrap; }
table.data td.actions .btn { margin-right: 6px; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 500; line-height: 1.7;
    background: #f3f4f6; color: var(--text-sub);
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger  { background: #fef2f2; color: #dc2626; }
.badge-info    { background: #f0f9ff; color: #0284c7; }

/* ---------- 提示 ---------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent;
}
.alert-info    { background: var(--primary-light); border-color: #bfdbfe; color: #1e40af; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ---------- Toast ---------- */
#toast-box { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
    background: #1f2937; color: #fff; box-shadow: var(--shadow-lg);
    animation: toastIn .22s ease; max-width: 90vw;
}
.toast.success { background: #059669; }
.toast.error   { background: #dc2626; }
.toast.warning { background: #d97706; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ---------- 模态框 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    z-index: 9000; display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn .16s ease;
}
.modal {
    background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 460px;
    box-shadow: var(--shadow-lg); animation: modalIn .2s ease; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-lg { max-width: 720px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border-light); font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 22px; line-height: 1; background: none; border: none; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.pagination ul { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; list-style: none; margin: 0; padding: 0; }
.pagination li { display: inline-block; list-style: none; }
.pagination a, .pagination span, .pagination li a, .pagination li span {
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: #fff; color: var(--text-sub);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13.5px;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active span, .pagination li.active span,
.pagination .active a, .pagination li.active a { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled span, .pagination li.disabled span { opacity: .45; }

/* ---------- 首页 Hero ---------- */
.hero { background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 45%, #0ea5e9 100%); color: #fff; padding: 80px 0 90px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero h1 { font-size: 40px; line-height: 1.25; margin-bottom: 18px; font-weight: 700; }
.hero p.lead { font-size: 16px; opacity: .9; max-width: 620px; margin-bottom: 30px; line-height: 1.8; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn { height: 46px; padding: 0 30px; font-size: 15px; }
.hero .btn-light { background: #fff; border-color: #fff; color: var(--primary); }
.hero .btn-light:hover { background: #f8fafc; color: var(--primary-dark); }
.hero .btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.2); color: #fff; }
.hero-stats { display: flex; gap: 44px; margin-top: 46px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 28px; font-weight: 700; }
.hero-stat span { font-size: 13px; opacity: .82; }

/* ---------- 区块 ---------- */
.section { padding: 64px 0; }
.section-head { text-align: center; margin-bottom: 42px; }
.section-head h2 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.section-head p { color: var(--text-muted); font-size: 15px; }

/* ---------- 特性 ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 24px; transition: all .2s; }
.feature:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icon {
    width: 44px; height: 44px; border-radius: 11px; background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center; margin-bottom: 15px; font-size: 20px;
}
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--text-muted); font-size: 13.5px; line-height: 1.75; }

/* ---------- 套餐卡 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 22px; align-items: stretch; }
.plan {
    background: #fff; border: 2px solid var(--border); border-radius: var(--radius-lg);
    padding: 30px 26px; display: flex; flex-direction: column; position: relative; transition: all .2s;
}
.plan:hover { box-shadow: var(--shadow-md); }
.plan.recommend { border-color: var(--primary); box-shadow: 0 8px 26px rgba(37, 99, 235, .13); }
.plan-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: #fff; font-size: 12px; padding: 3px 14px; border-radius: 20px; white-space: nowrap;
}
.plan h3 { font-size: 18px; margin-bottom: 6px; }
.plan .plan-sub { color: var(--text-muted); font-size: 13px; min-height: 20px; margin-bottom: 18px; }
.plan .price { font-size: 34px; font-weight: 700; color: var(--primary); line-height: 1; }
.plan .price small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.plan ul { margin: 22px 0; flex: 1; }
.plan li { padding: 7px 0 7px 24px; position: relative; color: var(--text-sub); font-size: 13.5px; border-bottom: 1px dashed var(--border-light); }
.plan li:last-child { border-bottom: none; }
.plan li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; }

/* ---------- 侧边控制台布局 ---------- */
.console-layout { display: grid; grid-template-columns: 216px 1fr; gap: 22px; align-items: start; padding: 24px 0 60px; }
.side-menu { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; position: sticky; top: 86px; }
.side-menu a {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-radius: var(--radius-sm); color: var(--text-sub); font-size: 14px; transition: all .15s;
}
.side-menu a:hover { background: var(--border-light); color: var(--text); }
.side-menu a.active { background: var(--primary); color: #fff; }
.side-menu .menu-group { padding: 14px 14px 6px; font-size: 12px; color: var(--text-muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 44px; margin-bottom: 14px; opacity: .35; }

/* ---------- 代码块 ---------- */
pre.code {
    background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: var(--radius-sm);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre;
}
code.inline { background: #f1f3f7; padding: 2px 6px; border-radius: 4px; font-size: 12.5px; color: #be185d; font-family: Consolas, Menlo, monospace; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: var(--border-light); border-radius: 10px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #06b6d4); border-radius: 10px; transition: width .3s; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: calc(100vh - 62px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-card .auth-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.captcha-img { height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; }

/* ---------- 底部 ---------- */
.footer { border-top: 1px solid var(--border); background: #fff; padding: 32px 0; margin-top: 40px; color: var(--text-muted); font-size: 13px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-10 { margin-bottom: 10px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sub { color: var(--text-sub); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.mono { font-family: Consolas, Menlo, "Courier New", monospace; }
.break-all { word-break: break-all; }
.hide { display: none !important; }

/* ---------- 内容排版（公告/教程） ---------- */
.article-body { font-size: 15px; line-height: 1.9; color: var(--text-sub); }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { color: var(--text); margin: 26px 0 12px; line-height: 1.4; }
.article-body h1 { font-size: 24px; }
.article-body h2 { font-size: 20px; }
.article-body h3 { font-size: 17px; }
.article-body p { margin: 12px 0; }
.article-body ul, .article-body ol { margin: 12px 0 12px 22px; }
.article-body ul li { list-style: disc; margin: 6px 0; }
.article-body ol li { list-style: decimal; margin: 6px 0; }
.article-body img { border-radius: var(--radius-sm); margin: 12px 0; }
.article-body pre { background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12.5px; margin: 14px 0; }
.article-body code { background: #f1f3f7; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #be185d; }
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article-body table th, .article-body table td { border: 1px solid var(--border); padding: 9px 12px; }
.article-body blockquote { border-left: 3px solid var(--primary); padding-left: 14px; color: var(--text-muted); margin: 14px 0; }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
    .topbar-inner { gap: 14px; }
    .nav { display: none; }
    .hero { padding: 52px 0 60px; }
    .hero h1 { font-size: 27px; }
    .hero-stats { gap: 26px; margin-top: 32px; }
    .console-layout { grid-template-columns: 1fr; }
    .side-menu { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 8px; }
    .side-menu a { white-space: nowrap; padding: 8px 12px; }
    .side-menu .menu-group { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .section { padding: 42px 0; }
    table.data { font-size: 13px; }
    table.data th, table.data td { padding: 10px; }
}
