/* ══════════════════════════════════════
   字雲社群回饋系統 v2 - style.css
   ══════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans TC', sans-serif;
}

:root {
  --bg:       #ffffff;
  --surface:  #f8f8f8;
  --border:   #ebebeb;
  --text:     #1a1a1a;
  --text-sub: #888888;
  --accent:   #2C3E50;
  --like:     #e74c3c;
  --liked-bg: #fff0f0;
  --tag-bg:   #edf2fb;
  --tag-text: #2980B9;
  --footer-h: 72px;
}

html, body {
  height: auto;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px; /* 給底部固定輸入框留出空間 */
}

/* ── 版面結構 ─────────────────────────── */
#app {
  max-width: 800px;
  margin: 0 auto;
}

/* ── 頁首 ─────────────────────────────── */
#main-header {
  text-align: center;
  padding: 24px 20px 16px;
  flex-shrink: 0;
}

#main-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text);
}

.subtitle {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 4px;
}

/* ── 字雲區 ───────────────────────────── */
#cloud-section {
  padding: 0 16px 8px;
  flex-shrink: 0;
}

#cloud-container {
  position: relative;
  width: 100%;
  height: 260px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

#word-cloud {
  width: 100%;
  height: 100%;
  max-width: 100%;
}

#cloud-empty {
  position: absolute;
  color: var(--text-sub);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  display: none;
}

/* ── 篩選標籤 ─────────────────────────── */
#filter-badge {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #fdf2e9;
  border: 1px solid #f5cba7;
  border-radius: 20px;
  padding: 8px 16px;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1100;
}

#filter-badge.active {
  display: flex;
}

#filter-label {
  font-weight: 700;
  color: #d35400;
}

#clear-filter {
  background: transparent;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
}
#clear-filter:hover {
  background: rgba(41, 128, 185, 0.15);
}

/* ── 留言牆 ───────────────────────────── */
#feed-section {
  padding: 8px 16px 16px;
  height: auto !important;
  overflow: visible !important;
  flex: none !important;
}

/* ── 分頁 ───────────────────────────── */
#feed-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  gap: 16px;
  padding-bottom: 20px;
}
.page-btn {
  background: #f1f2f6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.page-info {
  font-size: 14px;
  color: var(--text-light);
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-top: 8px;
}

.feed-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

#feed-meta {
  font-size: 12px;
  color: var(--text-sub);
}

/* 留言卡片 */
.feed-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
}

.feed-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.feed-card.is-mine {
  border-color: var(--border);
  background: var(--bg);
}

.is-mine-badge {
  font-size: 11px;
  background: #f1c40f;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.card-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-tag {
  font-size: 12px;
  padding: 3px 10px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.card-tag:hover {
  background: #c5d9f5;
}

.card-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.card-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  min-width: 65px;
}

/* 按讚按鈕 */
.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-sub);
  font-weight: 500;
  transition: all 0.15s;
}

.like-btn:hover {
  border-color: var(--like);
  color: var(--like);
  background: var(--liked-bg);
}

.like-btn.liked {
  border-color: var(--like);
  color: var(--like);
  background: var(--liked-bg);
  font-weight: 700;
}

.like-btn .like-icon {
  font-size: 16px;
  transition: transform 0.15s;
}

.like-btn:active .like-icon {
  transform: scale(1.3);
}

/* 刪除按鈕 */
.delete-card-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: #cccccc;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.delete-card-btn:hover {
  color: var(--like);
  background: var(--liked-bg);
}

/* 骨架屏 */
.feed-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-card {
  height: 90px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.5s infinite;
  border-radius: 12px;
}

@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 篩選中隱藏卡片 */
.feed-card.hidden {
  display: none;
}

/* ── 底部輸入列 ───────────────────────── */
#input-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  max-width: 800px;
  margin: 0 auto;
  box-sizing: border-box;
}

#input-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

#keyword-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

#keyword-input:focus {
  border-color: var(--accent);
  background: var(--bg);
}

#submit-btn {
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}

#submit-btn:hover   { opacity: 0.85; }
#submit-btn:active  { transform: scale(0.97); }
#submit-btn:disabled { background: #cccccc; cursor: not-allowed; }

/* ── 吐司通知 ─────────────────────────── */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 200;
  max-width: 90%;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 版本號標籤 (v11) ─────────────────────── */
.version-badge {
  font-size: 0.4em;
  color: var(--accent);
  vertical-align: middle;
  cursor: pointer;
  padding: 4px 8px;
  background: rgba(41, 128, 185, 0.1);
  border-radius: 6px;
  transition: background 0.2s;
}
.version-badge:active {
  background: rgba(41, 128, 185, 0.3);
}

/* ── 旋轉重整按鈕 ─────────────────────── */
#rotate-reload-btn {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 9999;
  cursor: pointer;
  animation: popIn 0.3s ease-out forwards;
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── 橫向字雲微調 ──────── */
@media (orientation: landscape) and (max-height: 500px) {
  #cloud-container { height: 180px; }
  #main-header { padding: 12px 20px 8px; }
  #main-title { font-size: 18px; }
}

/* ── 版權說明 Footer ──────── */
.site-copyright {
  text-align: center;
  margin: 16px 16px 80px; /* 底部留空給 input-footer */
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.8;
}
.site-copyright a {
  color: var(--text-sub);
  text-decoration: none;
}
.site-copyright a:hover {
  text-decoration: underline;
}
