/* ============================================
   CodeNest 码巢 — GitHub 风格扩展样式
   叠加在 styles.css 之上（链接顺序在后，可覆盖变量）
   ============================================ */

/* ── 主题色：龙虾橙 → 开发者蓝 ── */
:root {
  --accent: #4C8DFF;
  --accent-bright: #6BA3FF;
  --accent-dim: #2F6FE0;
  --info: #6BA3FF;
  --star: #E3B341;
  --star-dim: #b9912f;
}

/* ── 通用页面容器（避开固定导航）── */
.page { padding-top: calc(var(--nav-h) + 44px); padding-bottom: 90px; min-height: 100vh; }
.page-head { margin-bottom: 26px; }
.page-title { font-size: 27px; font-weight: 800; letter-spacing: -.6px; }
.page-sub { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }

/* ── 品牌 ── */
.brand-mark { width: 26px; height: 26px; color: var(--accent); display: inline-flex; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { font-weight: 800; font-size: 18px; letter-spacing: -.4px; color: var(--text); }
.brand-text em { font-style: normal; color: var(--accent); font-weight: 700; margin-left: 2px; }

/* ── 搜索条 ── */
.search-bar {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 15px;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { color: var(--text-3); flex-shrink: 0; }
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; font-family: var(--font);
}
.search-bar input::placeholder { color: var(--text-3); }

/* ── 筛选 / 排序行 ── */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; align-items: center; }
.filter-label { font-size: 12.5px; color: var(--text-3); margin-right: 2px; }
.spacer { flex: 1; }
.result-count { font-size: 13px; color: var(--text-3); }

/* ── 仓库卡片网格 ── */
.repo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.repo-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; transition: border-color .2s, transform .2s;
}
.repo-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.repo-path { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.repo-name { font-size: 16.5px; font-weight: 700; color: var(--accent-bright); letter-spacing: -.3px; }
.repo-card:hover .repo-name { color: var(--text); }
.repo-desc { font-size: 13.5px; color: var(--text-2); margin: 8px 0 14px; line-height: 1.6; min-height: 40px; }
.repo-meta { display: flex; align-items: center; gap: 16px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.repo-meta .mi { display: inline-flex; align-items: center; gap: 4px; }
.lang-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.topic-tag { font-size: 11px; color: var(--accent-bright); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 8px; border-radius: 999px; }

/* ── Star 按钮 ── */
.star-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s; font-family: var(--font);
}
.star-btn:hover { border-color: var(--star); color: var(--star); }
.star-btn.on { background: color-mix(in srgb, var(--star) 16%, transparent); border-color: var(--star); color: var(--star); }
.star-btn:disabled { opacity: .5; cursor: not-allowed; }
.star-btn svg { width: 15px; height: 15px; }

/* ── 克隆 / 复制框 ── */
.clone-box {
  display: flex; align-items: center; gap: 10px; background: var(--code-bg);
  border: 1px solid var(--code-border); border-radius: 10px; padding: 11px 13px;
  font-family: var(--mono); font-size: 13px; margin-top: 4px;
}
.clone-box code { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clone-copy { margin-left: auto; }

/* ── 项目详情布局 ── */
.detail-path { font-size: 21px; line-height: 1.4; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.detail-path a { color: var(--accent-bright); font-weight: 700; }
.detail-path a:hover { text-decoration: underline; }
.detail-path .sep { color: var(--text-3); }
.private-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--text-3) 18%, transparent); color: var(--text-2); font-weight: 600; }

/* ── 举报机制 ── */
.removed-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700;
  background: color-mix(in srgb, var(--error) 16%, transparent);
  color: var(--error); border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
}
.removed-banner {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px; margin-bottom: 20px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
}
.removed-banner b { font-size: 15px; color: var(--error); font-weight: 700; }
.removed-banner span { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.report-btn { color: var(--text-2); }
.report-btn:hover:not(:disabled) {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 40%, transparent);
}
.report-btn.reported, .report-btn:disabled {
  opacity: .6; cursor: not-allowed; color: var(--text-3);
}
.detail-actions { display: flex; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 28px; margin-top: 22px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; align-self: start; }
.side-card h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin-bottom: 12px; }
.meta-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); gap: 10px; }
.meta-row:last-child { border-bottom: none; }
.meta-row .k { color: var(--text-3); }
.meta-row .v { color: var(--text); text-align: right; word-break: break-all; }
.side-card a.btn, .side-card .star-btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ── 资料 / 头像 ── */
.profile-head { display: flex; gap: 20px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.profile-uname { color: var(--text-3); font-size: 14px; }
.profile-bio { color: var(--text-2); margin: 12px 0; max-width: 640px; line-height: 1.7; }

/* ── 空状态 ── */
.empty { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty .big { font-size: 44px; margin-bottom: 12px; }
.empty a { color: var(--accent-bright); }

/* ── 表单 ── */
.form { max-width: 740px; }
.form .field { margin-bottom: 18px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.form input[type=text], .form input[type=url], .form textarea, .form select {
  width: 100%; padding: 11px 14px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text); font-size: 14.5px;
  font-family: var(--font); outline: none; transition: border-color .2s;
}
.form textarea { min-height: 200px; resize: vertical; font-family: var(--mono); line-height: 1.65; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); }
.form .hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.6; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form .req { color: var(--error); }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.toggle-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── 标记 ── */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ── 提示 toast ── */
.toast-msg {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: all .3s; z-index: 300; font-size: 14px; max-width: 90vw;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-msg.err { border-color: color-mix(in srgb, var(--error) 40%, transparent); }
.toast-msg.ok { border-color: color-mix(in srgb, var(--success) 40%, transparent); }

/* ── 加载 ── */
.loading { text-align: center; padding: 50px; color: var(--text-3); }
.spin { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: flex; justify-content: center; padding: 50px; }

/* ── README 渲染 ── */
.readme { font-size: 15px; line-height: 1.8; color: var(--text); }
.readme > *:first-child { margin-top: 0; }
.readme h1, .readme h2, .readme h3, .readme h4 { line-height: 1.3; margin: 24px 0 10px; font-weight: 700; letter-spacing: -.3px; }
.readme h1 { font-size: 23px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.readme h2 { font-size: 19px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.readme h3 { font-size: 16px; }
.readme p { margin: 11px 0; color: var(--text-2); }
.readme code { background: var(--code-bg); border: 1px solid var(--code-border); padding: 1px 6px; border-radius: 5px; font-size: 13px; color: var(--accent-bright); font-family: var(--mono); }
.readme pre { background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 10px; padding: 14px 16px; overflow: auto; margin: 12px 0; }
.readme pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 13px; }
.readme ul, .readme ol { margin: 11px 0 11px 22px; color: var(--text-2); }
.readme li { margin: 5px 0; }
.readme a { color: var(--accent-bright); }
.readme blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-3); margin: 12px 0; }
.readme img { max-width: 100%; border-radius: 8px; }
.readme hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.readme table { border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.readme th, .readme td { border: 1px solid var(--border); padding: 7px 12px; }
.readme th { background: var(--surface-2); }

/* ── 落地页特色仓库 ── */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; transition: border-color .2s, transform .2s; }
.feat-card:hover { border-color: var(--accent-dim); transform: translateY(-3px); }
.feat-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.feat-card h3 a { color: var(--accent-bright); }
.feat-card h3 a:hover { color: var(--text); }
.feat-card p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; min-height: 42px; }
.step { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-bright); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.step h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.step p { font-size: 14px; color: var(--text-2); line-height: 1.65; }

/* ── 响应式 ── */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .repo-grid { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}
