/* ==========================================================================
   源码下载站 - 前台样式
   ========================================================================== */
:root {
  --brand: #2b7cff;
  --brand-dark: #1657c9;
  --brand-soft: #eaf2ff;
  --green: #12b886;
  --orange: #f79b28;
  --red: #f2555a;
  --text: #2c3446;
  --muted: #7a8496;
  --line: #e7ebf3;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(23, 43, 99, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0 0 10px; }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { width: 1180px; max-width: calc(100% - 32px); margin: 0 auto; }

/* ---------------- 头部 ---------------- */
.site-header { background: #fff; box-shadow: 0 1px 0 var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 18px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; white-space: nowrap; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px; color: #fff; font-size: 14px; letter-spacing: 1px;
  background: linear-gradient(135deg, #2b7cff, #17b8c9);
  box-shadow: 0 6px 14px rgba(43, 124, 255, .3);
}
.head-search { display: flex; flex: 1; max-width: 460px; }
.head-search input {
  flex: 1; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-right: 0;
  border-radius: 19px 0 0 19px; outline: none; font-size: 14px; background: #f8fafd; color: var(--text);
}
.head-search input:focus { border-color: var(--brand); background: #fff; }
.head-search button {
  height: 38px; padding: 0 20px; border: 0; border-radius: 0 19px 19px 0; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px;
}
.head-search button:hover { background: var(--brand-dark); }
.head-user { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; font-size: 13px; }
.btn-mini { padding: 4px 12px; border-radius: 14px; background: var(--brand); color: #fff !important; }
.btn-mini:hover { background: var(--brand-dark); }

.site-nav { background: linear-gradient(90deg, #2b7cff, #3f92ff 45%, #17b8c9); }
.nav-inner { display: flex; align-items: center; height: 46px; gap: 4px; overflow-x: auto; }
.nav-inner > a { color: rgba(255, 255, 255, .9); padding: 6px 16px; border-radius: 8px; white-space: nowrap; }
.nav-inner > a:hover, .nav-inner > a.on { background: rgba(255, 255, 255, .18); color: #fff; }
.nav-right { margin-left: auto; }
.nav-right a { color: rgba(255, 255, 255, .85); font-size: 13px; padding-left: 10px; }

/* ---------------- 公告 / 提示 ---------------- */
.top-notice { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.notice-text { background: #fff8e6; border: 1px solid #ffe3a3; color: #94641a; padding: 7px 14px; border-radius: 8px; font-size: 13px; }
.flash { padding: 7px 14px; border-radius: 8px; font-size: 13px; }
.flash-success { background: #e8f9f1; border: 1px solid #b7ecd5; color: #0f7a56; }
.flash-warning { background: #fff8e6; border: 1px solid #ffe3a3; color: #94641a; }
.flash-error { background: #fdecec; border: 1px solid #f8c7c8; color: #b6363a; }

/* ---------------- 布局 ---------------- */
.main { display: flex; gap: 20px; margin: 18px auto 40px; align-items: flex-start; }
.main-main { flex: 1; min-width: 0; }
.sidebar { width: 300px; flex-shrink: 0; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head .more { margin-left: auto; font-size: 13px; color: var(--muted); }
.panel-head .more:hover { color: var(--brand); }
.panel-body { padding: 16px 18px; }
.panel-body.tight { padding: 0; }

/* ---------------- 分类快捷入口 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.cat-card { display: block; background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid transparent; transition: .2s; }
.cat-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.cat-card h3 { font-size: 16px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.cat-card p { color: var(--muted); font-size: 13px; margin: 0; }
.cat-card .count { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 1px 8px; border-radius: 10px; }

/* ---------------- 文章列表 ---------------- */
.post-item { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.post-item:last-child { border-bottom: 0; }
.post-item:hover { background: #fafcff; }
.post-thumb { width: 132px; height: 88px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: #eef2f9; }
.post-thumb-ph {
  width: 132px; height: 88px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eaf2ff, #e6fbf6); color: var(--brand); font-size: 20px; font-weight: 700;
}
.post-info { min-width: 0; flex: 1; }
.post-info h3 { font-size: 15px; margin-bottom: 5px; line-height: 1.5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-info h3 a { color: var(--text); }
.post-info h3 a:hover { color: var(--brand); }
.post-desc { color: var(--muted); font-size: 13px; margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: 14px; color: #98a2b3; font-size: 12px; flex-wrap: wrap; }
.post-meta .cat { color: var(--brand); background: var(--brand-soft); padding: 1px 8px; border-radius: 10px; }

.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #f0f3f9; color: var(--muted); }
.tag-hot { background: #fdecec; color: var(--red); }
.tag-top { background: #fff3e0; color: var(--orange); }
.tag-new { background: #e8f9f1; color: var(--green); }
.tag-free { background: #e8f9f1; color: var(--green); }
.tag-auth { background: #fff3e0; color: var(--orange); }

/* ---------------- 热门排行 ---------------- */
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px dashed var(--line); }
.rank-list li:last-child { border-bottom: 0; }
.rank-no {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px; background: #eef2f9; color: var(--muted);
  font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.rank-list li:nth-child(1) .rank-no { background: var(--red); color: #fff; }
.rank-list li:nth-child(2) .rank-no { background: var(--orange); color: #fff; }
.rank-list li:nth-child(3) .rank-no { background: #2bb6d6; color: #fff; }
.rank-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rank-num { color: #a9b2c3; font-size: 12px; flex-shrink: 0; }

/* ---------------- 侧栏 ---------------- */
.cat-side li { display: flex; align-items: center; padding: 9px 18px; border-bottom: 1px dashed var(--line); }
.cat-side li:last-child { border-bottom: 0; }
.cat-side .n { margin-left: auto; color: #a9b2c3; font-size: 12px; }
.auth-card { padding: 18px; text-align: center; background: linear-gradient(160deg, #2b7cff, #17b8c9); color: #fff; border-radius: var(--radius); margin-bottom: 18px; }
.auth-card h3 { font-size: 16px; margin-bottom: 8px; }
.auth-card p { font-size: 13px; color: rgba(255, 255, 255, .88); }
.auth-card .btn { background: #fff; color: var(--brand); margin-top: 6px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-block; padding: 9px 20px; border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  font-size: 14px; cursor: pointer; text-align: center; transition: .2s;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn-lg { padding: 13px 34px; font-size: 16px; border-radius: 10px; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-gray { background: #eef2f9; color: var(--text); }
.btn-gray:hover { background: #e3e9f4; color: var(--text); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #0ea273; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ---------------- 面包屑 & 分页 ---------------- */
.crumb { color: var(--muted); font-size: 13px; padding: 4px 0 0; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 18px; }
.pager a, .pager span.current {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.pager span.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager-gap { border: 0 !important; background: transparent !important; }
.pager-total { margin-left: auto; color: var(--muted); font-size: 12px; border: 0 !important; background: transparent !important; }

/* ---------------- 文章详情 ---------------- */
.post-head { padding: 20px 18px 0; }
.post-head h1 { font-size: 22px; line-height: 1.5; margin-bottom: 10px; }
.post-head .post-meta { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.article-body { padding: 18px; font-size: 15px; line-height: 1.9; word-break: break-word; }
.article-body h2 { font-size: 18px; margin: 22px 0 10px; padding-left: 10px; border-left: 4px solid var(--brand); }
.article-body h3 { font-size: 16px; margin: 18px 0 8px; }
.article-body p { margin: 0 0 12px; }
.article-body img { border-radius: 8px; margin: 10px 0; }
.article-body ul, .article-body ol { margin: 0 0 12px; padding-left: 22px; list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body code { background: #f2f5fa; padding: 2px 6px; border-radius: 5px; font-family: Consolas, Monaco, monospace; font-size: 13px; color: #c7254e; }
.article-body pre { background: #1f2937; color: #e6edf3; padding: 14px 16px; border-radius: 10px; overflow: auto; }
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body blockquote { margin: 12px 0; padding: 10px 16px; background: #f7f9fd; border-left: 4px solid var(--line); color: var(--muted); }
.article-body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 8px 10px; }

/* 下载信息区 */
.down-box { margin: 18px; border: 1px solid #ffe0b2; background: #fffaf0; border-radius: 12px; padding: 18px; }
.down-box.locked { border-color: #ffd9d9; background: #fff7f7; }
.down-box .db-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.down-attrs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.down-attrs div { background: #fff; border: 1px solid #f0e2c8; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.down-attrs div b { color: var(--text); font-weight: 600; }
.down-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.down-tip { font-size: 13px; color: var(--muted); }
.down-locked-tip { font-size: 13px; color: #b6363a; margin: 0 0 12px; }

/* ---------------- 表单 ---------------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: #fff; color: var(--text); outline: none; font-family: inherit;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 124, 255, .12); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.7; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-hint { font-size: 12px; color: #a9b2c3; margin-top: 4px; }

/* 登录 / 注册 */
.auth-wrap { max-width: 420px; margin: 40px auto; }
.auth-wrap .panel-body { padding: 26px 28px; }
.auth-title { text-align: center; margin-bottom: 20px; }
.auth-title h1 { font-size: 20px; margin-bottom: 4px; }
.auth-title p { color: var(--muted); font-size: 13px; margin: 0; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* 会员中心 */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs a { padding: 12px 16px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on, .tabs a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-box { background: #f8fafd; border-radius: 10px; padding: 14px; text-align: center; }
.stat-box b { display: block; font-size: 20px; color: var(--brand); }
.stat-box span { font-size: 12px; color: var(--muted); }

/* ---------------- 表格 ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { background: #f8fafd; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:hover td { background: #fafcff; }
.table .nowrap { white-space: nowrap; }

/* ---------------- 空状态 / 页脚 ---------------- */
.empty { padding: 46px 20px; text-align: center; color: #a9b2c3; }
.empty b { display: block; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.site-footer { background: #1f2937; color: #9aa5b6; margin-top: 20px; padding: 30px 0 0; }
.footer-inner { display: flex; gap: 40px; padding-bottom: 24px; flex-wrap: wrap; }
.foot-col { flex: 1; min-width: 200px; }
.foot-col h4 { color: #fff; font-size: 14px; margin-bottom: 10px; }
.foot-col p { font-size: 13px; line-height: 1.8; color: #8c97a8; }
.foot-links { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.foot-links a { color: #9aa5b6; }
.foot-links a:hover { color: #fff; }
.copyright { display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid #2b3644; padding: 16px 0; font-size: 12px; }
.copyright a { color: #9aa5b6; }
.copyright a:hover { color: #fff; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .main { flex-direction: column; }
  .sidebar { width: 100%; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .down-attrs { grid-template-columns: 1fr; }
  .head-search { display: none; }
}
@media (max-width: 640px) {
  .header-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 10px; }
  .cat-grid { grid-template-columns: 1fr; }
  .post-thumb, .post-thumb-ph { width: 92px; height: 66px; font-size: 15px; }
  .footer-inner { gap: 20px; }
}
