/* ==================================================================
   磊浪（自建版）站点样式
   视觉规范：
   - 主色 绿 #1cc088，背景浅绿渐变
   - 字体 霞鹜文楷 LXGW WenKai + Noto Sans SC
   - 卡片化布局，圆角，柔和阴影
   - 图标采用 FontAwesome（CDN）
   ================================================================== */

:root {
    --primary-color: #1cc088;
    --primary-hover: #14a77e;
    --card-bg: #fff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e0e6ed;
    --light-bg: #f5f7fa;
    --success-bg: #e8f5e9;
    --error-bg: #ffebee;
    --loading-bg: #e3f9f2;
    --nav-height: 70px;
}

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

body {
    font-family: 'LXGW WenKai', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background-color: var(--light-bg);
    color: var(--text-dark);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e8f9f2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1.0rem;
}

code {
    font-family: 'LXGW WenKai', 'Courier New', monospace;
    border-radius: 6px;
}

/* ===== 布局样式 ===== */
.container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    width: 100%;
}

/* ===== 导航栏样式 ===== */
.navbar {
    background-color: var(--card-bg);
    height: var(--nav-height);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
}

.logo span {
    font-family: 'Noto Sans SC', sans-serif;
    transform: translateX(-5px);
    color: var(--primary-color);
}

.logo img {
    width: 30px;
    height: 30px;
    transform: translateY(-3%);
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 1.01rem;
}

.nav-links .nav-link.active,
.nav-links .nav-link.active:hover {
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links .nav-link.active i {
    color: var(--primary-color);
}

.nav-link:hover {
    color: var(--primary-color);
}

/* ===== 移动端菜单按钮 ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-dark);
    cursor: pointer;
    margin-right: -3px;
}

/* ===== 移动端导航菜单 ===== */
.mobile-nav {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 99;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav.active {
    max-height: 100%;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    font-size: 1.1rem;
}

.mobile-nav-link.active {
    border-left-color: var(--primary-color);
    background-color: rgba(28, 192, 136, 0.05);
    color: var(--primary-color);
}

.mobile-nav-link:hover {
    background-color: rgba(28, 192, 136, 0.05);
    color: var(--primary-color);
}

/* ===== 卡片组件样式 ===== */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 25px;
}

.card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    background-color: rgba(28, 192, 136, 0.15);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 18px;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* ===== 卡片背景样式 ===== */
.card-background {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    line-height: 1.9;
}

.card-background:hover {
    border-color: rgba(28, 192, 136, 0.3);
}

.card-background a {
    text-decoration: none;
    color: #1cc088;
}

.card-background a:hover {
    color: #18a978;
    text-decoration: none;
}

.card-background li {
    margin-left: 18px;
}

/* ===== 功能介绍样式 ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.09);
    border-color: rgba(28, 192, 136, 0.3);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 10px;
}

/* ===== 复制按钮样式 ===== */
.keepright {
    margin-left: auto;
}

.button {
    all: unset;
    display: inline-flex;
    align-items: center;
    border-radius: 5px;
    border: solid 1px #333;
    padding: 6px 15px;
    white-space: nowrap;
    transition: all .2s;
    cursor: pointer;
    box-shadow: 0 1px 1px hsl(0deg 0% 0% / 10%);
    font-size: 0.92rem;
}

.button:hover {
    background-color: #f3f4f6;
    color: rgba(28, 192, 136, 0.9);
}

.button i {
    width: 1em;
    height: 1em;
    margin-right: 5px;
}

/* ===== 代码块样式 ===== */
pre {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.92rem;
    line-height: 1.7;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
}

code {
    font-family: 'Courier New', Consolas, monospace;
    color: #2c3e50;
}

/* ===== 站点统计样式 ===== */
.examples {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 768px) {
    .examples {
        grid-template-columns: repeat(2, 1fr);
    }
}

.example-item {
    background: rgba(28, 192, 136, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s;
}

.example-item:hover {
    background: rgba(28, 192, 136, 0.15);
}

.example-img {
    color: var(--primary-color);
    transform: translateY(5%);
    width: 1.1em;
}

.example-count {
    margin-left: auto;
    background: rgba(28, 192, 136, 0.15);
    padding: 0 6px;
    border-radius: 5px;
    word-break: break-all;
    font-size: 0.9rem;
}

/* ===== 友情链接样式 ===== */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.link-item {
    background: rgba(28, 192, 136, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s;
}

.link-item:hover {
    background: rgba(28, 192, 136, 0.15);
}

.link-img {
    width: 18px;
    height: 18px;
    transform: translateY(1%);
}

/* ===== 评分样式 ===== */
.rating-container {
    text-align: center;
    padding: 10px 0;
}

.stars {
    display: inline-flex;
    gap: 5px;
    font-size: 2rem;
    color: #ddd;
    cursor: pointer;
    margin-bottom: 10px;
}

/* 选中/悬停态。
   注意：评分页的星星是 #starPick 下的裸 <span>，由 JS 切换 .on 类；
   历史上这里只写了 .star.active，与 JS 实际用的类名对不上，导致点击后不高亮。
   下面同时兼容 .on 与 .star.active 两种写法。 */
.stars .star:hover,
.stars .star.active,
.stars span.on,
.stars .on {
    color: #ffc107;
}

/* 已选中的星星加一点点放大反馈，交互更明确 */
.stars span {
    transition: color .15s ease, transform .15s ease;
}
.stars span.on {
    transform: scale(1.06);
}

.rating-info {
    color: var(--text-light);
    font-size: 1.05rem;
}

.average-stars {
    color: #ffc107;
    margin-right: 8px;
}

.rating-count {
    color: var(--text-light);
}

/* ===== 页脚样式 ===== */
.footer {
    background-color: var(--card-bg);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 1.0rem;
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
}

.footer p {
    line-height: 1.5;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.footer a {
    text-decoration: none;
    color: var(--text-dark);
}

.footer a:hover {
    color: #1cc088;
    text-decoration: none;
}

/* ===== 通用提示条 ===== */
.muted {
    color: var(--text-light);
}

/* ===== 子页面通用区块（hero / section） ===== */
.hero {
    text-align: center;
    padding: 50px 0 10px;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.hero p {
    color: var(--text-light);
    font-size: 1.05rem;
}

.section {
    padding: 20px 0 30px;
}

.section-title {
    text-align: center;
    margin-bottom: 25px;
}

.section-title h2 {
    font-size: 1.5rem;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.section-title p {
    color: var(--text-light);
}

.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }

/* ===== 文档页布局 ===== */
.doc-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 25px;
    align-items: start;
}

.doc-nav {
    position: sticky;
    top: calc(var(--nav-height) + 20px);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
}

.doc-nav ul { list-style: none; }
.doc-nav li a {
    display: block;
    padding: 9px 20px;
    color: var(--text-light);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

.doc-nav li a:hover,
.doc-nav li a.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background: rgba(28, 192, 136, 0.05);
}

.doc-content h2 {
    font-size: 1.4rem;
    margin: 25px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-dark);
}

.doc-content h3 {
    font-size: 1.15rem;
    margin: 18px 0 8px;
    color: var(--text-dark);
}

.doc-content p { margin-bottom: 10px; }
.doc-content ul, .doc-content ol { margin: 0 0 10px 22px; }
.doc-content li { margin-bottom: 6px; }

code.inline {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #c0392b;
}

/* ===== 代码框 / 复制按钮 ===== */
.code-box {
    position: relative;
    margin: 10px 0 16px;
}

.code-box pre {
    margin-top: 0;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

/* ===== 提示框 ===== */
.alert {
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

.alert-info {
    background: var(--success-bg);
    border-left: 4px solid var(--primary-color);
    color: #1b7a5a;
}

.alert-warn {
    background: #fff8e1;
    border-left: 4px solid #f1c40f;
    color: #8a6d00;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-solid {
    background: var(--primary-color);
    color: #fff;
}

.btn-solid:hover { background: var(--primary-hover); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 统计网格卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 22px 15px;
    text-align: center;
}

.stat-card .num {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.stat-card .label {
    color: var(--text-light);
    font-size: 0.92rem;
}

/* ===== 表单 ===== */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row input[type="text"] {
    flex: 1;
    min-width: 220px;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border 0.3s;
}

.form-row input[type="text"]:focus {
    border-color: var(--primary-color);
}

select {
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    outline: none;
}

textarea {
    width: 100%;
    min-height: 90px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

textarea:focus { border-color: var(--primary-color); }

.empty {
    text-align: center;
    color: var(--text-light);
    padding: 30px 0;
}

/* ===== 双栏网格 ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ===== 评分页 ===== */
.rating-big { text-align: center; padding: 10px 0; }
.rating-big .score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
}
.rating-big .meta { color: var(--text-light); margin-top: 8px; }
.stars-sm { color: #f6b93b; letter-spacing: 2px; }

.dist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.9rem;
}
.dist-row > span:first-child { width: 42px; color: var(--text-light); }
.dist-row .bar {
    flex: 1;
    height: 10px;
    background: #eef1f4;
    border-radius: 5px;
    overflow: hidden;
}
.dist-row .bar i {
    display: block;
    height: 100%;
    background: var(--primary-color);
    border-radius: 5px;
}
.dist-row .cnt { width: 36px; text-align: right; color: var(--text-light); }

/* ---------- 评价分页控件 ---------- */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}
.pager:empty { margin-top: 0; }

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: .9rem;
    transition: all .15s ease;
}
.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.page-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    cursor: default;
}
.page-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.page-gap { color: var(--text-light); padding: 0 2px; }

.comment-item {
    display: flex;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding: 14px 0;
}
/* 请求头调试卡片（?debug=1） */
.debug-card { border-color: var(--primary-color); }
.debug-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.debug-table th, .debug-table td {
  border: 1px solid var(--border-color);
  padding: 6px 10px; text-align: left; word-break: break-all;
}
.debug-table thead th { background: var(--bg-secondary); }
.debug-table .dbg-k { color: var(--primary-color); font-family: monospace; white-space: nowrap; width: 1%; }

/* 评价项左侧圆形头像图标，复刻不蒜子 ratings.php 风格 */
.comment-item .avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.comment-item .comment-main { flex: 1; min-width: 0; }
.comment-item .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.88rem;
    color: var(--text-light);
}

/* ===== 捐赠页 ===== */
.donate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 10px;
}
.donate-card { text-align: center; }
.donate-card h3 { margin: 10px 0 4px; }
.donate-card p { color: var(--text-light); font-size: 0.9rem; }
.qr {
    width: 100%;
    aspect-ratio: 1;
    max-width: 200px;
    margin: 0 auto;
    background: #f0f2f5;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 10px;
}

/* ===== 排行榜 ===== */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef1f4;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
}
.rank-badge.top1 { background: #ffd700; color: #7a5b00; }
.rank-badge.top2 { background: #c0c0c0; color: #505050; }
.rank-badge.top3 { background: #cd7f32; color: #fff; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
thead th {
    background: rgba(28, 192, 136, 0.08);
    color: var(--text-dark);
    text-align: left;
    padding: 11px 12px;
    font-weight: 600;
    white-space: nowrap;
}
tbody td {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
}
tbody tr:hover { background: rgba(28, 192, 136, 0.04); }
tbody a { color: var(--primary-color); text-decoration: none; }
tbody a:hover { text-decoration: underline; }

/* ===== 后台管理 ===== */
.admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary-color); color: #fff;
  padding: 10px 16px; border-radius: 10px; margin-bottom: 16px;
  font-size: 0.95rem;
}
.admin-bar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.6); }
.admin-bar .btn-ghost:hover { background: rgba(255,255,255,.15); }

#adminForm .card { margin-bottom: 16px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-dark); }

.link-edit-row {
  display: grid; grid-template-columns: 1.2fr 2fr 1.4fr auto;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.link-edit-row input { min-width: 0; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.9rem; }
.link-edit-row .lk-del { padding: 8px 10px; }

.logo-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-upload img { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--border-color); object-fit: contain; background: #fff; }
.logo-upload .qr { width: 56px; height: 56px; border-radius: 10px; border: 1px dashed var(--border-color); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; text-align: center; color: var(--text-light); }

.donate-edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.donate-edit-card { border: 1px solid var(--border-color); border-radius: 10px; padding: 12px; text-align: center; }
.donate-edit-card h4 { margin-bottom: 10px; }
.donate-preview { min-height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.donate-preview img { max-width: 100%; max-height: 160px; border-radius: 8px; }
.donate-preview .qr { width: 100%; min-height: 120px; border: 1px dashed var(--border-color); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-light); font-size: 0.8rem; }

.admin-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.save-msg { font-weight: 600; }

/* 捐赠页收款码图片（前台） */
.qr-img { width: 100%; max-width: 200px; border-radius: 8px; }

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .card { padding: 20px; }
    .nav-links { display: none; }
    .mobile-menu-btn { display: block; }
    .mobile-nav { display: block; }
    .card-header { flex-wrap: wrap; }
    .doc-layout { grid-template-columns: 1fr; }
    .doc-nav { position: static; }
}
