/* ============================================================
 * 技能互换平台 · 样式
 * 设计基调：浅色、克制、清晰层级，无堆砌渐变。
 * ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --text: #1a1d24;
  --text-2: #5b6472;
  --text-3: #8a93a3;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --match: #0f9d6e;          /* 双向互补 / 匹配绿 */
  --match-soft: #e6f7f0;
  --warn: #d97706;
  --border: #e7e9ee;
  --border-2: #eef0f3;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow: 0 4px 16px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.14);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --maxw: 1140px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; height: 60px; gap: 28px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.logo .logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 16px;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 8px 14px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent; color: var(--text-2); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 10px; font-weight: 500;
}
.btn-ghost:hover { border-color: #cfd4dc; color: var(--text); }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text); }

/* ---------- 通用区块 ---------- */
.page { padding: 28px 0 64px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: .2px; }
.page-head p { margin: 0; color: var(--text-2); }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 18px; margin: 0; }
.section-head .more { color: var(--text-3); font-size: 13px; }

/* ---------- 首页 Hero ---------- */
.hero {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 36px 34px; box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: .3px; }
.hero p { color: var(--text-2); margin: 0 0 22px; max-width: 620px; }
.search-box {
  display: flex; gap: 10px; max-width: 640px;
}
.search-box input {
  flex: 1; border: 1px solid var(--border); border-radius: 11px;
  padding: 13px 16px; font-size: 15px; background: var(--surface-2); outline: none;
  transition: border .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff; }
.search-box button {
  background: var(--primary); color: #fff; border: none; border-radius: 11px;
  padding: 0 22px; font-weight: 600; font-size: 15px;
}
.search-box button:hover { background: var(--primary-hover); }

/* 分类 chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chip .ic { font-size: 15px; }

/* 热门技能 */
.hot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hot-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
  transition: box-shadow .15s, transform .1s, border-color .15s;
}
.hot-card:hover { box-shadow: var(--shadow); border-color: #dcdce4; transform: translateY(-2px); }
.hot-card .name { font-weight: 600; }
.hot-card .meta { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.hot-card .ic { font-size: 22px; }

/* ---------- 技能卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  transition: box-shadow .18s, transform .1s, border-color .18s;
}
.skill-card:hover { box-shadow: var(--shadow); border-color: #dcdce4; transform: translateY(-2px); }
.sc-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
}
.sc-id { min-width: 0; }
.sc-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge.online { background: var(--match-soft); color: var(--match); border-color: transparent; }
.badge.offline { background: #fff4e6; color: var(--warn); border-color: transparent; }
.sc-sub { color: var(--text-3); font-size: 12px; }

.skills-block .label { font-size: 12px; color: var(--text-3); margin-bottom: 7px; font-weight: 600; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
}
.tag .lv { font-size: 11px; color: var(--text-3); }
.tag.teach { background: var(--primary-soft); border-color: transparent; color: var(--primary-hover); }
.tag.teach .lv { color: var(--primary); }
.tag.learn { background: #fff5ec; border-color: transparent; color: #b45309; }
.tag.learn .lv { color: #b45309; }

.sc-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border-2); padding-top: 13px; margin-top: auto;
}
.sc-meta { color: var(--text-3); font-size: 12px; display: flex; gap: 12px; }
.sc-meta b { color: var(--text-2); font-weight: 600; }
.btn-sm {
  background: var(--primary); color: #fff; border: none; border-radius: 9px;
  padding: 8px 14px; font-weight: 600; font-size: 13px;
}
.btn-sm:hover { background: var(--primary-hover); }
.btn-sm.match { background: var(--match); }
.btn-sm.match:hover { background: #0c855e; }

/* ---------- 智能匹配 ---------- */
.match-list { display: flex; flex-direction: column; gap: 16px; }
.match-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: grid; grid-template-columns: 1fr 220px; gap: 22px;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s;
}
.match-card:hover { box-shadow: var(--shadow); }
.mc-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mc-head { display: flex; align-items: center; gap: 12px; }
.match-score {
  width: 220px; border-radius: var(--radius-sm); padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--match-soft); border: 1px solid #cdeede;
}
.match-score .big { font-size: 38px; font-weight: 800; color: var(--match); line-height: 1; }
.match-score .pct { font-size: 18px; font-weight: 700; color: var(--match); }
.match-score .cap { margin-top: 6px; font-weight: 700; color: var(--match); font-size: 14px; }
.match-score .sub { margin-top: 4px; color: #3a7d63; font-size: 12px; text-align: center; }
.match-score.oneway { background: #fff7ed; border-color: #fde2c0; }
.match-score.oneway .big, .match-score.oneway .pct, .match-score.oneway .cap { color: var(--warn); }

.reason {
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 13px 15px; font-size: 13.5px; color: var(--text-2); line-height: 1.7;
}
.reason .hl { color: var(--match); font-weight: 700; }
.reason .hl-me { color: var(--primary); font-weight: 700; }
.swap-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.swap-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-weight: 600; }
.swap-pill.give { background: var(--primary-soft); color: var(--primary-hover); }
.swap-pill.get  { background: var(--match-soft); color: var(--match); }
.mc-actions { margin-top: auto; display: flex; gap: 10px; }

/* ---------- 表单（发布页 / 个人中心） ---------- */
.form-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); max-width: 720px;
}
.form-row { margin-bottom: 20px; }
.form-row > label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-row .hint { color: var(--text-3); font-weight: 400; font-size: 12px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; background: var(--surface-2); outline: none;
  transition: border .15s, box-shadow .15s; color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff;
}
.textarea { resize: vertical; min-height: 84px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 动态技能输入 */
.skill-input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.skill-input-row .input { flex: 1; }
.skill-input-row .select { width: 120px; flex: none; }
.skill-input-row .btn-rm {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
  border-radius: 10px; width: 42px; flex: none; font-size: 18px;
}
.skill-input-row .btn-rm:hover { color: #dc2626; border-color: #f0c4c4; }
.add-link { color: var(--primary); font-weight: 600; font-size: 13px; background: none; border: none; padding: 4px 0; }
.add-link:hover { text-decoration: underline; }

/* 分段选择（方式 / 熟练度） */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; transition: all .15s;
}
.seg button.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 个人中心 ---------- */
.profile-head {
  display: flex; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.profile-head .avatar { width: 64px; height: 64px; border-radius: 16px; font-size: 26px; }
.stat-row { display: flex; gap: 28px; margin-left: auto; }
.stat { text-align: center; }
.stat .n { font-size: 22px; font-weight: 800; }
.stat .t { font-size: 12px; color: var(--text-3); }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 24px 0 18px; }
.tabs button {
  background: none; border: none; padding: 10px 4px; margin-right: 22px;
  color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.empty { color: var(--text-3); text-align: center; padding: 40px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* 交换记录条目 */
.exch-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
}
.exch-item .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--match-soft); color: var(--match); display: grid; place-items: center; font-size: 18px; flex: none; }
.exch-item .body { flex: 1; min-width: 0; }
.exch-item .body .t { font-weight: 600; }
.exch-item .body .d { color: var(--text-3); font-size: 12.5px; }
.status-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-tag.pending { background: #fff7ed; color: var(--warn); }
.status-tag.done { background: var(--match-soft); color: var(--match); }
.status-tag.rejected { background: #fef2f2; color: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.5);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { margin: 0 0 4px; font-size: 18px; }
.modal-head p { margin: 0; color: var(--text-3); font-size: 13px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 0 22px 22px; display: flex; gap: 10px; }
.modal-foot .btn-primary, .modal-foot .btn-ghost { flex: 1; padding: 11px; border-radius: 10px; }
.modal-close { position: absolute; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px);
  background: #1a1d24; color: #fff; padding: 13px 22px; border-radius: 12px;
  font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 200; display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ok { color: #4ade80; font-weight: 800; }

/* ---------- 空状态 / 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px 0; color: var(--text-3); font-size: 13px; margin-top: 40px; }

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .hot-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .match-card { grid-template-columns: 1fr; }
  .match-score { width: 100%; flex-direction: row; gap: 14px; justify-content: flex-start; }
  .match-score .sub { text-align: left; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); padding: 10px 20px; gap: 2px;
  }
  .menu-toggle { display: block; margin-left: auto; }
  .header-actions .btn-primary { display: none; }
  .hot-grid, .card-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 24px; }
  .stat-row { gap: 18px; }
}
