/* ===== walle-yiwa — 组件(components)=====
可复用组件:按钮、表单、提示条、卡片/文章卡片、胶囊链接、标签、分页、评论区、徽章、空状态。
页面专属样式在 pages.css。===== */

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  height: 40px;
  line-height: 38px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  text-align: center;
}
.btn-primary { background: var(--walle-yellow); color: #3A2E1A; }
.btn-primary:hover { background: var(--walle-yellow-deep); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text-main); }
.btn-secondary:hover { border-color: var(--text-faint); background: var(--soft-hover-bg); }
.btn-danger { background: var(--surface); border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-sm { height: 32px; line-height: 30px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { background: var(--disabled-bg); color: var(--text-faint); cursor: not-allowed; }
/* ===== 表单 ===== */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field input, .comment-form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-main);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input { height: 44px; }
.comment-form textarea { padding: 12px 14px; resize: vertical; min-height: 96px; }
.field input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--walle-yellow);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.18);
}

/* 蜜罐字段:对真人不可见,拦截自动注册/登录机器人 */
.hp-field {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* 字段级错误提示(注册确认密码,默认隐藏,由 register.js 切换 visible) */
.field-error {
  display: none;
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
}
.field-error.visible { display: block; }
.field-hint { color: var(--text-faint); font-size: 12.5px; margin-top: 6px; }

/* 头像上传(资料设置页):预览 + 提示 */
.avatar-preview-wrap { margin-bottom: 10px; }
.avatar-preview-img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
}
.avatar-clear-btn { display: inline-block; margin-top: 8px; }

/* 复选框字段(资料设置:回复邮件通知) */
.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  cursor: pointer;
}
.field-checkbox input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--walle-yellow-deep);
  flex-shrink: 0;
  cursor: pointer;
}

/* 算术验证码区:题目行 + 输入框,样式与 .field 一致 */
.captcha .captcha-question {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
  background: var(--soft-hover-bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  margin-bottom: 8px;
}

.form-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.form-actions.center { justify-content: center; }

/* ===== 提示条 ===== */
.notice { border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14.5px; margin-bottom: 18px; line-height: 1.6; }
.notice-error { background: var(--notice-error-bg); color: var(--error); }
.notice-info { background: var(--notice-info-bg); color: var(--yiwa-blue-deep); }
.notice-success { background: var(--notice-success-bg); color: var(--success); }
.notice a { word-break: break-all; }

/* ===== 卡片/文章卡片(首页/搜索/标签/作者列表共用) ===== */
.article-list { display: flex; flex-direction: column; gap: 32px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.article-card {
  padding: 28px 32px;
  border: 1px solid var(--card-border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.article-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-border-hover);
  box-shadow: var(--card-shadow-hover);
}
.article-title { font-size: 22px; line-height: 1.4; margin-bottom: 10px; }
.article-title a { color: var(--text-main); text-decoration: none; }
.article-title a:hover { color: var(--walle-yellow-deep); }
.article-summary { color: var(--text-sub); font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
.article-meta { color: var(--text-faint); font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.article-card .article-meta { margin-bottom: 14px; }
.article-card .post-body { margin-bottom: 0; }
.article-preview {
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
}
/* 搜索关键词高亮:--walle-yellow 28% 浅底,文字保持原色 */
.hl {
  background: rgba(232, 163, 61, 0.28);
  border-radius: 3px;
  padding: 0 1px;
}


/* ===== 通用胶囊链接(阅读全文/提问等,pill 按钮) ===== */
.pill-btn {
  display: inline-block;
  font-size: 13.5px;
  color: var(--text-sub);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pill-btn:hover {
  color: var(--yiwa-blue-deep);
  border-color: var(--yiwa-blue);
  background: var(--pill-hover-bg);
}
.pill-btn-primary { color: var(--yiwa-blue); }
.article-card .pill-btn { margin-top: 18px; margin-right: 10px; }

/* ===== 标签 ===== */
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--tag-chip-text);
  background: var(--tag-chip-bg);
  border: 1px solid var(--tag-chip-border);
  border-radius: 999px;
  padding: 1px 9px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tag-chip:hover { background: var(--tag-chip-hover-bg); border-color: var(--yiwa-blue); }
.tag-cloud { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.tag-chip-lg { font-size: 13.5px; padding: 5px 14px; }
.tag-count { color: var(--text-faint); font-size: 12px; font-weight: 400; }
.page-desc {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; }
.page-btn {
  color: var(--text-main); text-decoration: none; font-size: 14.5px;
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px;
  background: var(--surface);
}
.page-btn:hover { border-color: var(--walle-yellow); color: var(--walle-yellow-deep); }
.page-info { color: var(--text-faint); font-size: 13px; }

/* ===== 评论区 ===== */
.comments { border-top: 1px solid var(--border); padding-top: 28px; }
.comments-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.comments-title { font-size: 20px; margin-bottom: 0; }
.comment-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.comment-sort-link { color: var(--yiwa-blue); text-decoration: none; }
.comment-sort-link:hover { color: var(--yiwa-blue-deep); text-decoration: underline; }
.comment-sort-link.active { color: var(--walle-yellow-deep); font-weight: 600; text-decoration: none; cursor: default; }
.comment-sort-sep { color: var(--text-faint); }
.comment-form { margin-bottom: 28px; }
.login-hint {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--text-sub);
  font-size: 14.5px;
  margin-bottom: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.login-hint-reg { white-space: nowrap; }
.comment-list { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--avatar-bg); color: var(--avatar-text);
  font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 13px; }
/* 用户上传头像:评论作者行(28px)与导航(24px),统一圆形 */
.avatar-img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-nav-wrap {
  position: relative;
  display: inline-flex;
}
.avatar-nav-link {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; padding: 2px;
  border: 2px solid transparent; transition: border-color 0.15s ease;
}
.avatar-nav-link:hover { border-color: var(--walle-yellow); }
.avatar-nav {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-initial {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--avatar-bg); color: var(--avatar-text);
  font-weight: 600; font-size: 14px; line-height: 1;
}
/* 导航未读红点:绝对定位在头像右上角(-2px 偏移),点击直达通知中心 */
.notif-dot-link {
  position: absolute;
  top: -2px;
  right: -2px;
  line-height: 0;
  text-decoration: none;
}
.notif-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--notif-dot-bg);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}
.comment-author { font-size: 15px; font-weight: 600; }
.comment-date { color: var(--text-faint); font-size: 12.5px; margin-left: auto; }
.comment-body { font-size: 15px; line-height: 1.65; word-break: break-word; padding-left: 46px; }
.reply-list {
  list-style: none;
  margin-top: 12px;
  margin-left: 46px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
}
.reply .comment-body { padding-left: 38px; }
.reply .avatar { margin-right: 0; }

/* 瓦力徽章 */
.badge {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 2px 8px;
}
.badge-walle { background: var(--walle-badge-bg); color: var(--walle-badge-text); }
.badge-yiwa { background: var(--badge-yiwa-bg); color: var(--yiwa-blue-deep); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-sub); }
.empty-state.small { padding: 32px 20px; }
.empty-icon { display: flex; justify-content: center; margin-bottom: 12px; color: var(--text-faint); }
.empty-icon svg { opacity: 0.65; }
.empty-main { font-size: 17px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
.empty-sub { font-size: 14px; color: var(--text-faint); }

/* ===== 响应式:组件相关 ===== */
@media (max-width: 768px) {
  .card { padding: 20px; }
  .article-title { font-size: 19px; }
  .article-card { padding: 24px 26px; }
  .comment-body { padding-left: 0; }
  .reply-list { margin-left: 0; padding-left: 12px; }
  .reply .comment-body { padding-left: 0; }
  .tag-chip { font-size: 11.5px; padding: 0 8px; }
}

@media (max-width: 480px) {
  .btn-sm { padding: 0 10px; font-size: 13px; }
  .tag-chips { gap: 4px; }
  .comment-form textarea { font-size: 14.5px; }
}
