/* 帖子关联（post_rel）— 前台表单 / 帖子展示 / 后台设置共用样式
   前缀 prel-；颜色、圆角、阴影全部走核心 CSS 变量，适配主题换肤。 */

/* ==================== 发帖 / 编辑页表单 ==================== */

.prel-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}

.prel-form-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--tx);
}

.prel-form-head .prel-opt {
  font-weight: 400;
  font-size: 12px;
  color: var(--tx-3);
}

.prel-field {
  margin-bottom: 12px;
}

.prel-field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--tx-2);
}

.prel-picker {
  position: relative;
}

.prel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.prel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--soft-2);
  color: var(--tx);
  font-size: 12px;
}

.prel-chip img,
.prel-chip-cover {
  width: 24px;
  height: 32px;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius-s);
}

.prel-chip-cover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  color: var(--tx-3);
  font-size: 11px;
}

.prel-chip-ic {
  display: inline-flex;
  align-items: center;
  color: var(--tx-3);
}

.prel-chip-text {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prel-chip-text em {
  margin-left: 4px;
  font-style: normal;
  color: var(--tx-3);
}

.prel-chip-x {
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--tx-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.prel-chip-x:hover {
  color: var(--err);
}

.prel-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--card);
  color: var(--tx);
  font-size: 13px;
  box-sizing: border-box;
}

.prel-input:focus {
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 0 2px var(--ac-soft);
}

.prel-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 240px;
  overflow: auto;
  display: none;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--card);
  box-shadow: var(--shadow);
}

.prel-results.is-open {
  display: block;
}

.prel-result {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--bd);
  background: transparent;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.prel-result:last-child {
  border-bottom: 0;
}

.prel-result:hover {
  background: var(--soft);
}

.prel-result-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prel-result-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--tx);
}

.prel-result-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--tx-3);
}

.prel-result-flag {
  flex: none;
  font-size: 11px;
  color: var(--tx-3);
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  padding: 1px 5px;
}

.prel-result-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--tx-3);
}

/* ==================== 帖子页展示 ==================== */

.prel-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  background: var(--soft-2);
}

.prel-box-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--tx);
}

.prel-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.prel-book {
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.prel-book:hover {
  border-color: var(--ac);
}

.prel-book-cover {
  width: 48px;
  height: 64px;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius-s);
  background: var(--soft);
}

.prel-book-cover.prel-book-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-3);
  font-size: 12px;
}

.prel-book-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prel-book-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}

.prel-book-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--tx-3);
}

.prel-terms {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.prel-terms-label {
  color: var(--tx-3);
  font-size: 12px;
}

.prel-term {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
}

.prel-term-ic {
  flex: none;
  display: inline-flex;
  align-items: center;
  margin-top: 1px;
  color: var(--tx-3);
}

.prel-term-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prel-term-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}

.prel-term-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  color: var(--tx-3);
}

.prel-term:hover {
  border-color: var(--ac);
}

/* ==================== 后台设置 ==================== */

.prel-deps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.prel-dep {
  padding: 4px 8px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  background: var(--soft-2);
  font-size: 12px;
  color: var(--tx-2);
}

.prel-dep.is-ok {
  color: var(--ok);
  border-color: var(--ok);
}

.prel-dep.is-off {
  color: var(--err);
  border-color: var(--err);
}

.prel-warn {
  color: var(--err);
}

.prel-forums {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.prel-fitem {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--tx-2);
}

/* ==================== 响应式 ==================== */

@media (max-width: 720px) {
  .prel-books {
    grid-template-columns: minmax(0, 1fr);
  }
  .prel-chip-text {
    max-width: 160px;
  }
}
