/* =========================================
   教学社区页面样式
   ========================================= */

.comm-page {
  padding-bottom: 30px;
}

.comm-hero {
  text-align: center;
  padding: 0 0 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  position: relative;
}

.comm-hero-inner {
  width: 100%;
  margin: 0 auto;
}

.comm-hero::after {
  content: "";
  display: block;
  width: 100%;
  height: 14px;
  margin: 10px auto 0;
  background-image: url('../images/border-top-pattern.svg');
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto 14px;
  opacity: 0.55;
}

.comm-hero-ornate {
  width: 100%;
  height: 28px;
  margin: 2px auto 12px;
  background-image: url('../images/border-top-pattern.svg');
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto 20px;
  opacity: 0.9;
}

.comm-title {
  font-size: 34px;
  letter-spacing: 3px;
  color: #1f2f52;
  margin-bottom: 6px;
  font-weight: 700;
}

.comm-subtitle {
  color: #888;
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 2px;
}

.comm-tabs {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 0 0 18px;
}

.comm-tabs--in-main {
  width: 100%;
}

.comm-tab {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(197, 160, 89, 0.55);
  background: rgba(197, 160, 89, 0.05);
  color: #7c6a42;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.comm-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(26, 43, 76, 0.08);
  background: rgba(197, 160, 89, 0.08);
}

.comm-tab.active {
  background: rgba(197, 160, 89, 0.12);
  border-color: rgba(197, 160, 89, 0.75);
}

/* 两行两列：上行 [小贴士 | 标题+Tab]；下行 [热门/高赞 | 帖子]，热门与首帖顶对齐 */
.comm-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto auto;
  gap: 26px 26px;
  align-items: start;
  height: auto;
}

.comm-side-tip {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.comm-main-top {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.comm-side-lists {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 38px;
  position: sticky;
  top: 8px;
  align-self: start;
  min-width: 0;
}

.comm-main-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

/* 左侧栏上下装饰当边框（用你指定的第二张图） */
.comm-side-ornament {
  height: 48px;
  background-image: url('../images/side-ornament.png');
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 280px auto;
  opacity: 0.95;
  margin: -6px auto 2px;
}

.comm-side-ornament--bottom {
  margin: 6px auto 0;
  transform: scaleY(-1);
}

.side-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(31, 47, 82, 0.12);
  border-radius: 14px;
  padding: 16px 16px;
  box-shadow: 0 12px 24px rgba(26, 43, 76, 0.06);
  position: relative;
}

.side-card-ornament {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -56%);
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0;
  opacity: 0.95;
  pointer-events: none;
}

.side-ornament-img{
  display: block;
  width: min(780px, 100%);
  height: 112px;
  object-fit: contain;
  opacity: 0.95;
}

.side-card--tip .side-text {
  margin-bottom: 12px;
}

.side-title {
  color: #1f2f52;
  letter-spacing: 2px;
  margin-bottom: 10px;
  font-size: 18px;
}

.side-hint {
  margin: -6px 0 10px;
  font-size: 12px;
  color: rgba(31, 47, 82, 0.55);
  letter-spacing: 0.06em;
}

.side-text {
  color: #666;
  line-height: 1.8;
  font-size: 14px;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.side-list li { list-style: none; }

.side-link {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 47, 82, 0.03);
  border: 1px solid rgba(31, 47, 82, 0.08);
  color: #1f2f52;
  transition: transform 0.2s ease, background 0.2s ease;
}

.side-link:hover {
  transform: translateY(-1px);
  background: rgba(197, 160, 89, 0.06);
}

.side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.side-btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(197, 160, 89, 0.65);
  background: rgba(197, 160, 89, 0.12);
  color: #6d5b35;
  font-size: 14px;
  cursor: pointer;
}

.side-btn.ghost {
  background: rgba(31, 47, 82, 0.03);
  border-color: rgba(31, 47, 82, 0.12);
  color: #1f2f52;
}

.comm-main-top,
.comm-main-body {
  min-width: 0;
  height: auto;
  overflow: visible;
  padding-right: 0;
}

/* 恢复为整页滚动，不做独立滚动条 */

.comm-panel { display: none; }
.comm-panel.active { display: block; }

.post-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.post-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 47, 82, 0.12);
  border-radius: 16px;
  padding: 18px 18px;
  box-shadow: 0 16px 30px rgba(26, 43, 76, 0.07);
}

.post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(197, 160, 89, 0.14);
  border: 1px solid rgba(197, 160, 89, 0.55);
  color: #6d5b35;
  font-weight: 700;
}

.name {
  color: #1f2f52;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: normal;
  line-height: 1.45;
  max-width: min(100%, 520px);
}

.meta {
  color: #8b8b8b;
  font-size: 12px;
  margin-top: 2px;
}

.post-badge {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(197, 160, 89, 0.55);
  background: rgba(197, 160, 89, 0.05);
  color: #7c6a42;
  font-size: 12px;
  letter-spacing: 1px;
}

.post-badge.warn {
  border-color: rgba(31, 47, 82, 0.18);
  background: rgba(31, 47, 82, 0.04);
  color: #1f2f52;
}

.post-title {
  color: #1f2f52;
  letter-spacing: 1px;
  font-size: 18px;
  margin-bottom: 8px;
}

.post-excerpt {
  color: #666;
  line-height: 1.85;
  margin-bottom: 12px;
}

.post-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-top: 1px solid rgba(31, 47, 82, 0.08);
  padding-top: 12px;
  flex-wrap: wrap;
}

.post-foot-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.post-btn-delete {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(170, 71, 45, 0.35);
  background: rgba(255, 245, 240, 0.95);
  color: #7a2f18;
  cursor: pointer;
}

.post-btn-delete:hover {
  background: rgba(255, 230, 220, 0.95);
}

.post-btn-delete--admin {
  border-color: rgba(31, 47, 82, 0.18);
  color: #1f2f52;
  background: rgba(31, 47, 82, 0.04);
}

.post-stats {
  display: flex;
  gap: 14px;
  color: #777;
  font-size: 13px;
  align-items: center;
  flex-wrap: wrap;
}

.post-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.post-btn-like {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(197, 160, 89, 0.45);
  background: rgba(255, 255, 255, 0.95);
  color: #1f2f52;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.post-btn-like[aria-pressed='true'],
.post-btn-like[data-liked='1'] {
  border-color: rgba(197, 160, 89, 0.85);
  background: rgba(197, 160, 89, 0.12);
  color: #6b4e1f;
}

.post-btn-like:hover {
  border-color: var(--primary-gold);
}

.post-btn-like:disabled {
  opacity: 0.6;
  cursor: wait;
}

.post-stat-views {
  color: #888;
}

.post-link {
  color: #c5a059;
  font-weight: 600;
}

/* 帖子详情页：主文居中 */
.comm-page--detail {
  padding-bottom: 48px;
  max-width: 920px;
}

.post-detail-back {
  margin: 16px 0 20px;
}

.post-detail-back a {
  color: var(--primary-gold);
  font-weight: 700;
  text-decoration: none;
}

.post-detail-back a:hover {
  text-decoration: underline;
}

.post-detail-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.post-detail-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(31, 47, 82, 0.1);
  border-radius: 18px;
  padding: 28px 26px 32px;
  box-shadow: 0 16px 36px rgba(26, 43, 76, 0.08);
}

.post-detail-title {
  font-size: 1.45rem;
  color: #1f2f52;
  letter-spacing: 0.06em;
  line-height: 1.35;
  margin: 0 0 12px;
  text-align: center;
}

.post-detail-who {
  text-align: center;
  color: #444;
  font-size: 0.95rem;
  margin: 0 0 6px;
  line-height: 1.55;
}

.post-detail-meta-line {
  text-align: center;
  color: #888;
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.post-detail-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.post-btn-like--large {
  padding: 8px 18px;
  font-size: 14px;
}

.post-detail-body {
  line-height: 1.9;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-detail-reply-h {
  font-size: 1.05rem;
  color: #1f2f52;
  margin: 28px 0 14px;
  letter-spacing: 0.06em;
}

.post-detail-answer {
  border-top: 1px solid rgba(31, 47, 82, 0.08);
  padding: 14px 0;
}

.post-detail-answer__who {
  font-weight: 600;
  color: #1f2f52;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.post-detail-answer__body {
  line-height: 1.75;
  color: #444;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-detail-answer__time {
  font-size: 0.8rem;
  color: #999;
  margin-top: 8px;
}

.post-detail-empty {
  color: #888;
}

.post-detail-reply-box {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(162, 133, 78, 0.22);
  border-radius: 16px;
  box-sizing: border-box;
}

.rank-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 47, 82, 0.12);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 16px 30px rgba(26, 43, 76, 0.07);
}

.rank-title {
  color: #1f2f52;
  letter-spacing: 2px;
  font-size: 18px;
  margin-bottom: 12px;
}

.rank-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #444;
}

.rk-score {
  color: #c5a059;
  font-weight: 700;
}

.rank-note {
  margin-top: 14px;
  color: #888;
  line-height: 1.8;
  font-size: 13px;
}

/* 发帖弹窗 */
.comm-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.comm-modal.is-open {
  display: flex;
}

.comm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 43, 76, 0.45);
  backdrop-filter: blur(2px);
}

.comm-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(162, 133, 78, 0.28);
  border-radius: 16px;
  padding: 24px 22px 22px;
  box-shadow: 0 24px 48px rgba(26, 43, 76, 0.18);
}

.comm-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(31, 47, 82, 0.06);
  color: #1f2f52;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.comm-modal__close:hover {
  background: rgba(31, 47, 82, 0.1);
}

.comm-modal__title {
  font-size: 1.2rem;
  color: #23170b;
  margin: 0 36px 8px 0;
  letter-spacing: 1px;
}

.comm-modal__sub {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 16px;
  line-height: 1.6;
}

.comm-modal__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.comm-modal__input,
.comm-modal__textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d8c9aa;
  box-sizing: border-box;
  font-family: var(--font-main, inherit);
  font-size: 14px;
  margin-bottom: 12px;
}

.comm-modal__textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.65;
}

.comm-modal__submit {
  margin-top: 4px;
  width: auto;
  min-width: 120px;
}

.comm-modal__msg {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
  min-height: 1.2em;
}

.comm-modal__msg.err {
  color: #b91c1c;
}

.comm-optional {
  font-weight: 400;
  color: #888;
  font-size: 13px;
}

.comm-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.comm-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(31, 47, 82, 0.18);
  background: rgba(255, 255, 255, 0.95);
  color: #1f2f52;
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  font-family: var(--font-main, inherit);
}

.comm-pill:hover {
  border-color: rgba(197, 160, 89, 0.55);
  background: rgba(197, 160, 89, 0.08);
}

.comm-pill.is-active {
  border-color: rgba(197, 160, 89, 0.85);
  background: rgba(197, 160, 89, 0.18);
  color: #5c4a28;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(26, 43, 76, 0.08);
}

.comm-modal__panel--confirm {
  max-width: 420px;
}

.comm-modal__confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 10px;
  flex-wrap: wrap;
}

.side-btn.ghost {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(31, 47, 82, 0.22);
  color: #444;
}

.comm-modal__submit--danger {
  background: rgba(170, 71, 45, 0.12);
  border-color: rgba(170, 71, 45, 0.42);
  color: #7a2f18;
}

@media (max-width: 980px) {
  .comm-layout {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .comm-side-lists {
    position: static;
  }
  .comm-main-top { order: 1; }
  .comm-side-tip { order: 2; }
  .comm-main-body { order: 3; }
  .comm-side-lists { order: 4; }
}

