/* ==========================================================================
   榴莲社区 · 新增组件样式
   通知面板 / Toast / 骨架屏 / 加载更多
   ========================================================================== */

/* ==========================================================================
   图标统一居中
   ---------------------------------------------------------------------------
   所有 <span data-icon="..."> 会被 icons.js 替换成内联 <svg>。
   如果容器保持默认的 inline，svg 会按文字基线对齐，视觉上会整体上移 1~3px，
   在圆形按钮、圆角徽章这类「几何中心」容器里尤其明显。
   统一改成 inline-flex + 居中，并让 svg 变成块级，消除基线影响。
   ========================================================================== */

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

[data-icon] > svg {
  display: block;
  flex-shrink: 0;
}

/* ---------------- 通知铃铛 ---------------- */

.bell-badge {
  position: absolute;
  top: 3px; right: 3px;
  min-width: 15px; height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e03131;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  border: 2px solid var(--secondary);
  box-sizing: content-box;
}

#bellBtn { position: relative; }

/* ---------------- 通知面板 ---------------- */

.notify-panel {
  position: fixed;
  top: 58px; right: 16px;
  width: 340px;
  max-height: 480px;
  display: none;
  flex-direction: column;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .13);
  z-index: 200;
  overflow: hidden;
}

.notify-panel.open { display: flex; }

.np-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
}

.np-body { overflow-y: auto; max-height: 420px; }

.np-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.np-item {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .1s;
}

.np-item:hover { background: var(--hover); }

.np-item.unread { background: rgba(0, 136, 204, .05); }
.np-item.unread .np-text b { color: var(--tertiary); }

.np-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

.np-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  min-width: 0;
}

.np-text b { color: var(--text); font-weight: 600; }

.np-time {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 2px;
}

.btn-ghost.sm {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 14px);
  background: #262626;
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 300;
  max-width: 86vw;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.dark .toast { background: #3a3b3c; }

/* ---------------- 骨架屏 ---------------- */

.skel {
  background: linear-gradient(90deg, var(--hover) 25%, #ececec 37%, var(--hover) 63%);
  background-size: 400% 100%;
  animation: skel-shine 1.3s ease infinite;
  border-radius: 4px;
}

body.dark .skel {
  background: linear-gradient(90deg, #232527 25%, #2c2e30 37%, #232527 63%);
  background-size: 400% 100%;
}

@keyframes skel-shine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skel-title { width: 62%; height: 17px; margin-bottom: 9px; }
.skel-meta { width: 40%; height: 13px; }
.skel-line { height: 15px; margin-bottom: 9px; border-radius: 4px; }

/* ---------------- 分页条（参考 linux.do 页码分页） ---------------- */

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0 6px;
}

.list-end {
  font-size: 12.5px;
  color: var(--faint);
  padding: 4px 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 20px 0 8px;
}

.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text2);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.pager-btn:hover:not(:disabled):not(.active) {
  background: var(--hover);
  color: var(--text);
}

.pager-btn.active {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.pager-btn:disabled {
  color: var(--faint);
  opacity: .45;
  cursor: not-allowed;
}

.pager-btn.pager-arrow svg { width: 15px; height: 15px; }

.pager-gap {
  min-width: 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
  user-select: none;
}

.pager-total {
  width: 100%;
  margin-top: 8px;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
}

@media (max-width: 560px) {
  .pager-btn { min-width: 28px; height: 28px; padding: 0 6px; font-size: 12.5px; }
  .pager-gap { min-width: 16px; }
}

/* ---------------- 话题副信息 ---------------- */

.topic-meta-num {
  font-size: 12.5px;
  color: var(--faint);
  /* linux.do 的 topic header：徽章靠左、回复/浏览数靠右 */
  margin-left: auto;
  white-space: nowrap;
}

/* ---------------- 回复框提示中的小头像 ---------------- */

.mini-av {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 5px;
}

/* ---------------- 发帖弹窗语言选择 ---------------- */

.composer-meta select {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  font-family: inherit;
  font-size: 12.5px;
  background: var(--secondary);
  color: var(--text2);
  cursor: pointer;
}

.composer-meta select:focus { outline: none; border-color: var(--tertiary); }

/* ==========================================================================
   搜索页
   ========================================================================== */

.search-hero {
  margin-bottom: 18px;
}

.sh-input {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  transition: border-color .12s, box-shadow .12s;
}

.sh-input:focus-within {
  border-color: var(--tertiary);
  box-shadow: 0 0 0 3px rgba(0, 136, 204, .12);
}

.sh-ic {
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  flex-shrink: 0;
}

.sh-ic svg { width: 17px; height: 17px; }

.sh-input input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 0 8px;
}

.sh-input input::placeholder { color: var(--faint); }

.sh-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 9px;
  min-height: 18px;
}

/* 搜索关键词高亮 */
.hl {
  background: #fff3c4;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

body.dark .hl { background: #4a3f14; color: #ffe066; }

/* 列表标签：必须保持 inline-flex。
   此前这里写 display:inline-block + line-height:19px，特异性高于 style.css 的
   .tag-badge(inline-flex)，导致内部 svg 按文字基线对齐、图标与文字错位，
   且与同行的 .cat-badge(20px inline-flex) 基线不一致 → 整排标签看起来歪斜。
   省略号改在内部 span 上做，不再破坏 flex 居中。 */
.topic-badges .tag-badge {
  max-width: 420px;
  min-width: 0;
}
.topic-badges .tag-badge > span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ==========================================================================
   社区公约 · 首次进入同意弹层（全局组件，所有页面生效）
   ========================================================================== */

.consent-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 20, 26, .46);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: consentFade .18s ease;
}

@keyframes consentFade { from { opacity: 0; } to { opacity: 1; } }

.consent-box {
  width: 100%;
  max-width: 460px;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
  padding: 22px 24px 20px;
  animation: consentUp .22s cubic-bezier(.2, .8, .3, 1);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

@keyframes consentUp {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.consent-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.consent-ic {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--banner-bg);
  color: var(--primary);
}

.consent-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.2px;
}

.consent-ver {
  font-size: 11.5px;
  color: var(--faint);
  margin: 3px 0 0;
}

.consent-body {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0 12px;
}

.consent-lead {
  font-size: 13.5px;
  color: var(--text);
  margin: 0 0 9px;
  font-weight: 500;
}

.consent-points {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text2);
}

.consent-points li { margin: 3px 0; }

.consent-more {
  font-size: 12px;
  color: var(--faint);
  margin: 10px 0 0;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
}

.consent-check input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.consent-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.consent-actions .btn-primary {
  flex: 1;
  height: 38px;
}

.consent-actions .btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.consent-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.consent-link:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .consent-box { padding: 18px 18px 16px; }
  .consent-actions { flex-direction: column; align-items: stretch; }
  .consent-link { text-align: center; }
}
