/* 公告分頁專用樣式；共用 subpage.css 的定稿石框與紅金導覽。 */

.announcement-content {
  padding: clamp(16px, 2.8vw, 30px);
  border-radius: 0 0 8px 8px;
  background: rgba(4, 4, 3, 0.91);
}

.announcement-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.announcement-categories button {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(181, 132, 48, 0.7);
  border-radius: 10px;
  color: #cdbd9f;
  background: linear-gradient(105deg, rgba(48, 25, 9, 0.9), rgba(15, 12, 9, 0.9));
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px rgba(255, 220, 142, 0.08);
}

.announcement-categories button > span {
  grid-row: 1 / 3;
  color: #c98d28;
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.announcement-categories b { color: #f3dab0; font-size: 1.13rem; }
.announcement-categories small { color: #9f917a; font-size: 0.82rem; }

.announcement-categories button:hover,
.announcement-categories button.active {
  border-color: #e0ac4d;
  background: linear-gradient(105deg, rgba(111, 42, 12, 0.92), rgba(32, 17, 9, 0.92));
  box-shadow: inset 0 -3px #c9821f, 0 7px 18px rgba(0, 0, 0, 0.34);
}

.announcement-list-view,
.announcement-detail-view,
.announcement-editor {
  overflow: hidden;
  border: 1px solid rgba(164, 120, 45, 0.72);
  border-radius: 11px;
  background: rgba(7, 6, 5, 0.9);
}

.announcement-list-view + .announcement-list-view {
  margin-top: 22px;
}

.announcement-list-view {
  scroll-margin-top: 92px;
}

.board-description {
  display: block;
  margin-top: 4px;
  color: #a6967e;
  font-size: 0.86rem;
}

.announcement-toolbar,
.detail-title-bar,
.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(173, 126, 47, 0.52);
  background: linear-gradient(90deg, rgba(76, 29, 8, 0.86), rgba(18, 13, 9, 0.82));
}

.announcement-toolbar p,
.detail-title-bar p,
.editor-heading p {
  margin: 0 0 3px;
  color: #d49a35;
  font-family: Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.announcement-toolbar h3,
.detail-title-bar h3,
.editor-heading h3 {
  margin: 0;
  color: #ffe4a4;
  font-size: 1.48rem;
}

.new-post-button,
.back-list-button,
.detail-actions button,
.editor-heading button,
.editor-actions button {
  padding: 9px 14px;
  border: 1px solid #c69a4a;
  border-radius: 7px;
  color: #ffe8b1;
  background: linear-gradient(#742d13, #3b1006);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 226, 153, 0.1);
}

.announcement-list-head,
.announcement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 84px;
  align-items: center;
}

.owner-mode .announcement-list-head,
.owner-mode .announcement-row {
  grid-template-columns: minmax(0, 1fr) 130px 84px 112px;
}

.announcement-list-head {
  min-height: 38px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(190, 144, 61, 0.66);
  color: #bfa66f;
  background: rgba(37, 28, 18, 0.72);
  font-size: 0.86rem;
}

.announcement-list-head span:not(:first-child) { text-align: center; }

.announcement-row {
  min-height: 72px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(147, 106, 40, 0.28);
  color: #b7aa93;
}

.announcement-row:last-child { border-bottom: 0; }
.announcement-row:hover { background: rgba(109, 53, 13, 0.2); }

.announcement-open {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.announcement-icon {
  display: grid;
  width: 48px;
  height: 32px;
  place-items: center;
  border: 1px solid #c68c29;
  border-radius: 7px;
  color: #271200;
  background: linear-gradient(#ffd26a, #ad660d);
  font-family: var(--seal-font);
  font-size: 0.8rem;
  font-weight: 700;
}

.announcement-open strong { overflow: hidden; color: #eec36d; font-size: 1.03rem; text-overflow: ellipsis; white-space: nowrap; }
.announcement-open small { overflow: hidden; color: #9f927d; text-overflow: ellipsis; white-space: nowrap; }
.announcement-date,
.announcement-status { text-align: center; }
.announcement-status { color: #7fd78e; }

.announcement-manage {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.announcement-manage button {
  padding: 5px 7px;
  border: 1px solid #9b7539;
  border-radius: 5px;
  color: #e4c890;
  background: #3d210d;
  cursor: pointer;
}

.announcement-manage button.danger { border-color: #87503a; color: #efb7a2; background: #3d170d; }

[data-admin-only] { display: none; }
.admin-mode [data-admin-only] { display: inline-flex; }
.announcement-header-actions { display: flex; align-items: center; gap: 10px; }
.admin-login-button {
  padding: 10px 14px;
  border: 1px solid #b98331;
  border-radius: 6px;
  color: #ffe4a0;
  background: linear-gradient(#63301a, #321208);
  font-weight: 700;
  cursor: pointer;
}
.announcement-login { padding: 20px; border: 1px solid #a87529; background: #17100a; }
.announcement-login form { display: grid; max-width: 560px; gap: 14px; margin: 18px auto 0; }
.announcement-login label { display: grid; gap: 7px; color: #ecd498; font-weight: 700; }
.announcement-login input { padding: 11px; border: 1px solid #8f6c35; color: #2e1a08; background: #fff7e8; font: inherit; }
.login-message { min-height: 1.4em; margin: 0; color: #efb7a2; }

.announcement-empty { padding: 48px 20px; color: #aa9c84; text-align: center; }

.detail-title-bar { align-items: flex-start; }
.detail-title-bar h3 { margin-top: 6px; color: #eeac43; }

.post-layout {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  min-height: 480px;
}

.post-author {
  padding: 26px 18px;
  border-right: 1px solid rgba(166, 120, 44, 0.42);
  color: #aa9a81;
  background: rgba(18, 14, 10, 0.84);
  text-align: center;
}

.post-author img {
  width: 128px;
  height: 100px;
  object-fit: contain;
  border: 1px solid rgba(204, 151, 58, 0.52);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
}

.post-author strong { display: block; margin-top: 13px; color: #e5ba66; font-size: 1.08rem; }
.post-author > span { color: #776c5b; font-family: Georgia, serif; font-size: 0.68rem; letter-spacing: 0.12em; }
.post-author dl { margin: 20px 0 0; text-align: left; }
.post-author dl div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(154, 112, 42, 0.22); }
.post-author dt { color: #8e806a; }
.post-author dd { margin: 0; color: #d1b87d; }

.post-main { padding: 22px clamp(20px, 3vw, 38px) 35px; }
.post-meta { display: flex; gap: 22px; padding-bottom: 13px; border-bottom: 1px dashed rgba(181, 137, 57, 0.52); color: #9c8e78; font-size: 0.88rem; }
.post-meta b { color: #c99b47; }
.post-summary { margin: 22px 0; color: #e78c3d; font-size: 1.13rem; font-weight: 700; line-height: 1.75; }
.post-body { min-height: 220px; color: #dbcdb4; font-size: 1.06rem; line-height: 2; white-space: pre-wrap; }
.post-body.rich-rendered { white-space: normal; }
.post-body.rich-rendered p { margin: 0 0 1.1em; }
.post-body.rich-rendered .text-align-left,
.rich-editor-area .text-align-left { text-align: left; }
.post-body.rich-rendered .text-align-center,
.rich-editor-area .text-align-center { text-align: center; }
.post-body.rich-rendered .text-align-right,
.rich-editor-area .text-align-right { text-align: right; }
.post-body.rich-rendered .text-color-cream,
.rich-editor-area .text-color-cream { color: #f2e8d5; }
.post-body.rich-rendered .text-color-gold,
.rich-editor-area .text-color-gold { color: #f4d06f; }
.post-body.rich-rendered .text-color-orange,
.rich-editor-area .text-color-orange { color: #ef8b3a; }
.post-body.rich-rendered .text-color-red,
.rich-editor-area .text-color-red { color: #ff6b6b; }
.post-body.rich-rendered .text-color-green,
.rich-editor-area .text-color-green { color: #79d68c; }
.post-body.rich-rendered .text-color-blue,
.rich-editor-area .text-color-blue { color: #70b7ff; }
.post-body.rich-rendered .text-color-purple,
.rich-editor-area .text-color-purple { color: #c99cff; }
.post-body.rich-rendered .text-size-small,
.rich-editor-area .text-size-small { font-size: 0.88rem; }
.post-body.rich-rendered .text-size-normal,
.rich-editor-area .text-size-normal { font-size: 1.06rem; }
.post-body.rich-rendered .text-size-large,
.rich-editor-area .text-size-large { font-size: 1.35rem; }
.post-body.rich-rendered .text-size-huge,
.rich-editor-area .text-size-huge { font-size: 1.7rem; }
.post-body.rich-rendered ul,
.post-body.rich-rendered ol { margin: 0 0 1.1em; padding-left: 1.7em; }
.rich-image {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 7px;
  border: 1px solid rgba(197, 146, 53, 0.58);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.32);
}
.rich-image.align-left { margin-right: auto; margin-left: 0; }
.rich-image.align-center { margin-right: auto; margin-left: auto; }
.rich-image.align-right { margin-right: 0; margin-left: auto; }
.rich-image img { display: block; max-width: min(100%, 900px); height: auto; border-radius: 6px; }
.rich-image figcaption { padding: 7px 4px 1px; color: #ae9d82; font-size: 0.82rem; text-align: center; }
.post-signature { margin: 30px 0 0; color: #af8d50; text-align: right; }

.detail-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid rgba(164, 120, 45, 0.42);
  background: rgba(26, 19, 12, 0.62);
}

.detail-actions button.danger { border-color: #92553c; color: #efb9a4; background: #491b0e; }

.announcement-editor { margin-top: 20px; }
.announcement-editor form { display: grid; gap: 14px; padding: 22px; }
.announcement-editor label { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: center; }
.announcement-editor label > span { color: #d3bc8a; }
.announcement-editor input,
.announcement-editor select,
.announcement-editor textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(184, 133, 48, 0.62);
  border-radius: 6px;
  color: #f2e8d5;
  background: rgba(0, 0, 0, 0.72);
  font-family: var(--seal-font);
}

.announcement-editor textarea { resize: vertical; line-height: 1.7; }
.announcement-editor .editor-body-field { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: start; }
.announcement-editor .editor-body-field > span { color: #d3bc8a; }
.rich-editor {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(184, 133, 48, 0.62);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
}
.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid rgba(184, 133, 48, 0.42);
  background: rgba(48, 27, 11, 0.86);
}
.rich-editor-toolbar button {
  padding: 7px 11px;
  border: 1px solid #9e6d26;
  border-radius: 6px;
  color: #f4d99d;
  background: linear-gradient(#61270f, #2d1007);
  cursor: pointer;
  font-family: var(--seal-font);
}
.rich-editor-toolbar select {
  min-height: 34px;
  padding: 6px 28px 6px 10px;
  border: 1px solid #9e6d26;
  border-radius: 6px;
  color: #f4d99d;
  background: #2d1007;
  cursor: pointer;
  font-family: var(--seal-font);
}
.rich-editor-toolbar select:focus { border-color: #efbd5d; outline: 0; }
.rich-editor-toolbar select option { color: #f2e8d5; background: #160d07; }
.rich-editor-toolbar button:hover,
.rich-editor-toolbar button.active { border-color: #efbd5d; color: #fff2be; box-shadow: inset 0 0 0 1px rgba(255, 220, 132, 0.24); }
.rich-editor-toolbar button.danger { border-color: #9e4d37; color: #f2b49f; background: linear-gradient(#571e12, #2b0c08); }
.rich-editor-toolbar .toolbar-label { margin-left: 4px; color: #bba77f; font-size: 0.82rem; }
.rich-editor-toolbar small { flex: 1 1 230px; color: #8f816b; text-align: right; }
.rich-editor-area {
  min-height: 300px;
  padding: 14px;
  outline: 0;
  color: #f2e8d5;
  font-family: var(--seal-font);
  line-height: 1.8;
}
.rich-editor-area:focus { box-shadow: inset 0 0 0 2px rgba(220, 158, 48, 0.2); }
.rich-editor-area p { margin: 0 0 1em; }
.rich-editor-area .rich-image { cursor: pointer; }
.rich-editor-area .rich-image.is-selected { border-color: #ffd069; box-shadow: 0 0 0 2px rgba(255, 190, 66, 0.28), 0 9px 24px rgba(0, 0, 0, 0.32); }
.editor-actions { display: flex; gap: 10px; justify-content: flex-end; }
.editor-actions button.primary { color: #2d1700; background: linear-gradient(#f8d371, #b96c11); }

@media (max-width: 760px) {
  .announcement-categories { grid-template-columns: 1fr; }
  .announcement-list-head { display: none; }
  .announcement-row,
  .owner-mode .announcement-row { grid-template-columns: minmax(0, 1fr) 88px; padding: 0 10px; }
  .announcement-status { display: none; }
  .announcement-manage { grid-column: 1 / -1; justify-content: flex-end; padding-bottom: 9px; }
  .announcement-header-actions { gap: 6px; }
  .admin-login-button { padding: 8px 10px; font-size: .86rem; }
  .post-layout { grid-template-columns: 1fr; }
  .post-author { display: grid; grid-template-columns: 88px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; border-right: 0; border-bottom: 1px solid rgba(166, 120, 44, 0.42); text-align: left; }
  .post-author img { grid-row: 1 / 3; width: 88px; height: 70px; }
  .post-author strong { margin-top: 0; }
  .post-author dl { display: none; }
  .post-meta { flex-direction: column; gap: 5px; }
  .announcement-editor label,
  .announcement-editor .editor-body-field { grid-template-columns: 1fr; gap: 6px; }
  .rich-editor-toolbar small { flex-basis: 100%; text-align: left; }
}

@media (max-width: 480px) {
  .announcement-toolbar,
  .detail-title-bar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .new-post-button,
  .back-list-button { width: 100%; }
  .announcement-row,
  .owner-mode .announcement-row { grid-template-columns: 1fr; }
  .announcement-date { padding-bottom: 8px; text-align: left; }
  .detail-actions { flex-direction: column; }
}
