/* ============================================================
   style.css  ·  全域樣式
   主題色由 PHP get_theme_style() 輸出 :root override
   ============================================================ */

/* ── 變數預設值（salmon 主題） ── */
:root {
  font-size: 16px;
  --bg:        #0c0d0c;
  --bg2:       #161716;
  --bg3:       #1e1f1e;
  --area:      #2c2d2c;
  --border:    #2e2f2e;
  --shell:     #c6c7bd;
  --shell-dim: #c6c7bd;

  /* 主題色（由 get_theme_style() 覆寫） */
  --theme:    #E5C3B3;
  --theme-d:  #b89180;
  --theme-bg: #251c18;

  /* 強調色（等候/被動狀態） */
  --accent:    #90CDF4;
  --accent-bg: #0d1e2a;

  /* 情緒按鈕六色 */
  --r-like:      #DECA4B;
  --r-resonate:  #C8DD5A;
  --r-noted:     #81E6D9;
  --r-curious:   #90CDF4;
  --r-passing:   #7090A8;
  --r-followup:  #FFB3D9;

  /* Bootstrap 覆寫 */
  --bs-body-bg:           var(--bg);
  --bs-body-color:        var(--shell);
  --bs-border-color:      var(--border);
  --bs-card-bg:           var(--bg2);
  --bs-card-border-color: var(--border);
  --bs-link-color:        var(--theme);
  --bs-link-hover-color:  #f0d5c8;
}

/* ── 基礎 ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--shell);
  font-size: 1rem;
  line-height: 1.6;
  font-family: 'Segoe UI', 'PingFang TC', 'Noto Sans TC', sans-serif;
  min-height: 100vh;
}

a { color: var(--theme); }
a:hover { color: var(--bs-link-hover-color); }

/* 最小字體保護：0.9rem */
small, .small, .text-small { font-size: 0.9rem; }

/* ── NAV ── */
.site-nav {
  background: #0f100f;
  border-bottom: 1px solid var(--border);
}

.site-nav .navbar-brand {
  color: var(--theme);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.site-nav .nav-link {
  color: var(--shell-dim);
  font-size: 1rem;
  padding: 5px 10px;
}
.site-nav .nav-link:hover  { color: var(--shell); }
.site-nav .nav-link.active {
  color: var(--theme);
  background: var(--theme-bg);
}

.code-badge {
  background: var(--bg3);
  border: 1px solid var(--theme-d);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.9rem;
  color: var(--theme);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

/* ── 卡片 ── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.panel-body { padding: 8px; }

/* ── 區域分隔線 ── */
.section-div {
  font-size: 0.9rem;
  color: var(--shell-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.div-count {
  background: var(--area);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 0.9rem;
  color: var(--shell-dim);
}

/* ── 標籤 ── */
.tag {
  display: inline-block;
  font-size: 0.9rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 7px;
  color: var(--shell-dim);
}

/* ── 狀態點 ── */
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  border: 1px solid transparent;
  display: inline-block;
}
.dot-open    { background: var(--theme);  border-color: var(--theme-d); }
.dot-waiting { background: var(--accent); border-color: var(--accent); }
.dot-done    { background: transparent;   border-color: var(--shell-dim); }

/* ── 派發 badge ── */
.assign-badge {
  font-size: 0.9rem;
  border-radius: 3px;
  padding: 1px 7px;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--shell-dim);
  background: var(--bg3);
}
.assign-badge.mandatory {
  border-color: var(--theme-d);
  color: var(--theme);
  background: var(--theme-bg);
}
.assign-badge.public {
  border-color: rgba(200, 221, 90, .55);
  color: var(--special);
  background: rgba(200, 221, 90, .08);
}

/* ── 情緒按鈕 ── */
.reaction-btn {
  font-size: 0.9rem;
  border-radius: 12px;
  padding: 3px 12px;
  cursor: pointer;
  border: 1px solid;
  background: transparent;
  transition: opacity 0.12s, background 0.12s;
}
.reaction-btn[data-r="like"]     { color: var(--r-like);     border-color: var(--r-like); }
.reaction-btn[data-r="resonate"] { color: var(--r-resonate); border-color: var(--r-resonate); }
.reaction-btn[data-r="noted"]    { color: var(--r-noted);    border-color: var(--r-noted); }
.reaction-btn[data-r="curious"]  { color: var(--r-curious);  border-color: var(--r-curious); }
.reaction-btn[data-r="passing"]  { color: var(--r-passing);  border-color: var(--r-passing); }
.reaction-btn[data-r="followup"] { color: var(--r-followup); border-color: var(--r-followup); }

.reaction-btn.active { opacity: 1; }
.reaction-btn:not(.active) { opacity: 0.35; }
.reaction-btn[data-r="like"].active     { background: rgba(222,202,75,0.12); }
.reaction-btn[data-r="resonate"].active { background: rgba(200,221,90,0.10); }
.reaction-btn[data-r="noted"].active    { background: rgba(129,230,217,0.10); }
.reaction-btn[data-r="curious"].active  { background: rgba(144,205,244,0.10); }
.reaction-btn[data-r="passing"].active  { background: rgba(112,144,168,0.12); }
.reaction-btn[data-r="followup"].active { background: rgba(255,179,217,0.10); }

/* ── 作答回合進度 ── */
.round-track {
  display: flex;
  align-items: flex-start;
  position: relative;
}
.round-track::before {
  content: '';
  position: absolute;
  top: 13px; left: 14px; right: 14px;
  height: 1px;
  background: var(--border);
  z-index: 0;
}
.round-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.round-dot {
  width: 27px; height: 27px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--shell-dim);
}
.round-dot.open    { border-color: var(--theme-d);  background: var(--theme-bg); color: var(--theme); }
.round-dot.waiting { border-color: var(--accent);   background: var(--accent-bg); color: var(--accent); }
.round-dot.done    { border-color: var(--theme-d);  background: var(--theme-bg); color: var(--theme); opacity: 0.55; }

.round-label    { font-size: 0.9rem; color: var(--shell-dim); text-align: center; }
.round-sublabel { font-size: 0.9rem; color: #444; text-align: center; margin-top: -3px; }
.round-sublabel.hi  { color: var(--theme-d); }
.round-sublabel.acc { color: var(--accent); }

/* ── 管理者公告橫幅 ── */
.admin-banner {
  border-left: 8px solid var(--theme);
  background: var(--theme-bg);
  border-radius: 0 5px 5px 0;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--shell);
  line-height: 1.6;
}
.admin-banner-meta { font-size: 0.9rem; color: var(--shell-dim); margin-top: 6px; }

/* ── 留言區 ── */
.comment-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-admin-label {
  font-size: 0.9rem;
  color: var(--theme);
  font-weight: 600;
}
.comment-user-label {
  font-size: 0.9rem;
  color: var(--shell-dim);
}
.comment-time {
  font-size: 0.9rem;
  color: var(--shell-dim);
}

/* ── 表單 ── */
.form-control, .form-select, textarea {
  background: var(--bg3) !important;
  border-color: var(--border) !important;
  color: var(--shell) !important;
  font-size: 1rem;
}
.form-control:focus, .form-select:focus, textarea:focus {
  border-color: var(--theme-d) !important;
  box-shadow: 0 0 0 2px rgba(184,145,128,0.15) !important;
  background: var(--bg3) !important;
}

/* ── 後台全域 Focus Ring（2px 虛線主題色） ── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px dashed var(--theme) !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
}
/* Bootstrap 的 form-control / form-select 用 :focus 而非 :focus-visible */
.form-control:focus,
.form-select:focus {
  outline: 2px dashed var(--theme) !important;
  outline-offset: 2px !important;
  border-color: var(--theme-d) !important;
  box-shadow: none !important;
  background: var(--bg3) !important;
}
textarea { rows: 11; }

/* ── 按鈕 ── */
.btn-theme {
  background: var(--theme-bg);
  border: 1px solid var(--theme-d);
  color: var(--theme);
  font-size: 0.9rem;
}
.btn-theme:hover { background: var(--theme); color: var(--bg); }

/* ── Bootstrap Alert 覆寫 ── */
.alert-app {
  background: var(--area);
  border-color: var(--theme-d);
  color: var(--shell);
  font-size: 0.9rem;
}
.alert-app-danger {
  background: #2a1010;
  border-color: #c05050;
  color: #F08080;
}

/* ── 後台表格 ── */
.table-dark {
  --bs-table-bg: var(--bg2);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--bg3);
}

/* ══════════════════════════════════════════════════════════
   公告清單
   ══════════════════════════════════════════════════════════ */
.ann-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ann-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background .15s, border-left-color .15s;
  border-left: 3px solid transparent;
  position: relative;
}
.ann-card:last-of-type {
  border-bottom: none;
}
.ann-card:hover {
  background: var(--bg3);
  border-left-color: var(--theme);
  text-decoration: none;
}

.ann-card-icon {
  font-size: 1rem;
  color: var(--theme);
  opacity: .75;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-bg, rgba(229,195,179,.12));
  border-radius: 50%;
}

.ann-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ann-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--shell);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ann-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* 公告標籤 — 比普通 .tag 更有色彩 */
.ann-tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(195,165,229,.15);
  border: 1px solid rgba(195,165,229,.35);
  color: #C3A5E5;
  white-space: nowrap;
}

.ann-expires {
  font-size: 0.78rem;
  color: var(--warning, #F08080);
  display: flex;
  align-items: center;
}

.ann-card-arrow {
  font-size: 0.85rem;
  color: var(--shell-dim);
  opacity: .45;
  flex-shrink: 0;
  transition: opacity .15s, transform .15s;
}
.ann-card:hover .ann-card-arrow {
  opacity: .9;
  transform: translateX(3px);
}

/* section-div 右側的「更多公告」小連結 */
.ann-more-link {
  font-size: 0.82rem;
  color: var(--shell-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .12s;
}
.ann-more-link:hover { color: var(--theme); text-decoration: none; }

/* 清單底部的「查看全部」列 */
.ann-more-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 0.88rem;
  color: var(--shell-dim);
  background: var(--area);
  text-decoration: none;
  transition: background .15s, color .15s;
  border-top: 1px solid var(--border);
}
.ann-more-row:hover {
  background: var(--bg3);
  color: var(--theme);
  text-decoration: none;
}
