/* fhc_prompt 提示詞分享 — 前台樣式
 * 所有樣式都包在 .fhcp 之下並使用 fhcp- 前綴，避免與 XOOPS 佈景（Bootstrap 等）衝突。
 * 作者：池富鴻 (FuhongC) https://www.fuhongc.net/  授權：GNU GPL 2.0
 */
.fhcp {
  --fhcp-brand: #4f46e5;
  --fhcp-brand-2: #a5b4fc;
  --fhcp-brand-weak: #eef2ff;
  --fhcp-card: #fff;
  --fhcp-text: #111827;
  --fhcp-muted: #6b7280;
  --fhcp-line: #e5e7eb;
  --fhcp-ok: #059669;
  --fhcp-err: #dc2626;
  --fhcp-warn: #b45309;
  --fhcp-cat: #4f46e5;
  --fhcp-radius: 14px;
  color: var(--fhcp-text);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  box-sizing: border-box;
}
.fhcp *, .fhcp *::before, .fhcp *::after { box-sizing: border-box; }
.fhcp a { color: inherit; }
.fhcp-page { max-width: 1200px; margin: 0 auto; padding: 8px 0 40px; position: relative; }

/* ---------- 頁首 ---------- */
.fhcp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.fhcp-h1 { font-size: 1.75rem; line-height: 1.3; margin: 0 0 6px; color: var(--fhcp-brand); font-weight: 800; }
.fhcp-h2 { font-size: 1.188rem; margin: 0; font-weight: 700; }
.fhcp-h3 { font-size: 1.063rem; margin: 0 0 10px; font-weight: 700; }
.fhcp-sub { color: var(--fhcp-muted); font-size: 0.938rem; max-width: 760px; }
.fhcp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fhcp-crumb { font-size: 0.875rem; color: var(--fhcp-muted); margin-bottom: 6px; }
.fhcp-crumb a { text-decoration: none; }
.fhcp-crumb a:hover { text-decoration: underline; }
.fhcp-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--fhcp-muted); font-size: 0.875rem; align-items: center; }
.fhcp-muted { color: var(--fhcp-muted); font-size: 0.875rem; }
.fhcp-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.fhcp-wrap { flex-wrap: wrap; }
.fhcp-grow { flex: 1; }

/* ---------- 按鈕 ---------- */
.fhcp-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--fhcp-line); background: #fff; color: var(--fhcp-text) !important; border-radius: 9px;
  padding: 7px 14px; font-size: 0.938rem; line-height: 1.4; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .08s;
}
.fhcp-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.fhcp-btn:active { transform: scale(.97); }
.fhcp-btn.dark { background: var(--fhcp-brand); border-color: var(--fhcp-brand); color: #fff !important; }
.fhcp-btn.dark:hover { filter: brightness(.92); }
.fhcp-btn.dark.done { background: var(--fhcp-ok); border-color: var(--fhcp-ok); }
.fhcp-btn.danger { background: #fff1f2; border-color: #fecdd3; color: #9f1239 !important; }
.fhcp-btn.on { color: #e11d48 !important; border-color: #fecdd3; background: #fff1f2; }
.fhcp-btn.small { padding: 4px 10px; font-size: 0.813rem; }
.fhcp-btn.big { padding: 10px 26px; font-size: 1rem; font-weight: 700; }
.fhcp-btn:disabled { opacity: .5; cursor: not-allowed; }
.fhcp-icon { appearance: none; border: 1px solid var(--fhcp-line); background: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 0.938rem; line-height: 1; color: var(--fhcp-muted) !important; display: inline-flex; align-items: center; justify-content: center; padding: 0; text-decoration: none !important; }
.fhcp-icon:hover { background: var(--fhcp-brand-weak); color: var(--fhcp-brand) !important; }
.fhcp-icon.on { color: #e11d48 !important; border-color: #fecdd3; background: #fff1f2; }
.fhcp-btn:focus-visible, .fhcp-icon:focus-visible, .fhcp-tile:focus-visible, .fhcp-chip:focus-visible, .fhcp-input:focus-visible { outline: 3px solid var(--fhcp-brand-2); outline-offset: 2px; }

/* ---------- 搜尋 ---------- */
.fhcp-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--fhcp-line); border-radius: 999px; padding: 6px 6px 6px 18px; margin: 4px 0 16px; }
.fhcp-search:focus-within { border-color: var(--fhcp-brand-2); }
.fhcp-search input[type=search] { flex: 1; border: 0; outline: 0; font-size: 1rem; background: transparent; min-width: 0; padding: 6px 0; color: var(--fhcp-text); }
.fhcp-search .fhcp-btn { border-radius: 999px; }

/* ---------- 分類磚 ---------- */
.fhcp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.fhcp-tile { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--fhcp-line); border-left: 5px solid var(--fhcp-cat); text-decoration: none !important; transition: transform .12s, box-shadow .12s; }
.fhcp-tile:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.07); }
.fhcp-tile .ico { font-size: 1.375rem; line-height: 1; }
.fhcp-tile .nm { flex: 1; min-width: 0; font-weight: 600; font-size: 0.938rem; line-height: 1.3; overflow-wrap: anywhere; }
.fhcp-tile .ct { font-size: 0.813rem; color: var(--fhcp-muted); background: #f3f4f6; border-radius: 999px; padding: 0 8px; }
.fhcp-tile.on { background: var(--fhcp-cat); border-color: var(--fhcp-cat); color: #fff !important; }
.fhcp-tile.on .ct { background: rgba(255,255,255,.25); color: #fff; }
.fhcp-catintro { margin: 0 0 10px; }

/* ---------- 篩選 ---------- */
.fhcp-filters { margin-bottom: 10px; }
.fhcp-frow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.fhcp-flabel { font-size: 0.875rem; color: var(--fhcp-muted); min-width: 88px; }
.fhcp-more summary { cursor: pointer; color: var(--fhcp-brand); font-size: 0.875rem; margin: 6px 0; }
.fhcp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.fhcp-chips.big { margin: 4px 0 14px; }
.fhcp-chip { display: inline-block; font-size: 0.813rem; padding: 2px 10px; border-radius: 999px; background: #f3f4f6; color: #374151 !important; text-decoration: none !important; border: 1px solid transparent; line-height: 1.6; }
.fhcp-chip.aud { background: #ecfdf5; color: #065f46 !important; }
.fhcp-chip.tool { background: #eff6ff; color: #1e40af !important; }
.fhcp-chip.tag { background: #fff; border-color: var(--fhcp-line); }
.fhcp-chip.link { background: #fff; border-color: var(--fhcp-line); font-size: 0.875rem; padding: 3px 12px; }
.fhcp-chip.link:hover { border-color: var(--fhcp-brand-2); }
.fhcp-chip.link.on { background: var(--fhcp-brand); border-color: var(--fhcp-brand); color: #fff !important; }

.fhcp-resultbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-size: 0.938rem; }
.fhcp-sorts { display: flex; gap: 4px; flex-wrap: wrap; background: var(--fhcp-brand-weak); padding: 3px; border-radius: 10px; }
.fhcp-sorts a { padding: 3px 10px; border-radius: 8px; font-size: 0.875rem; text-decoration: none !important; color: var(--fhcp-brand) !important; }
.fhcp-sorts a.on { background: #fff; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- 卡片 ---------- */
.fhcp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.fhcp-card { min-width: 0; display: flex; flex-direction: column; background: var(--fhcp-card); border: 1px solid var(--fhcp-line); border-top: 4px solid var(--fhcp-cat); border-radius: var(--fhcp-radius); padding: 12px 14px; transition: box-shadow .15s; }
.fhcp-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.fhcp-card.fhcp-dim { opacity: .6; }
.fhcp-card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-height: 22px; }
.fhcp-catlabel { font-size: 0.813rem; color: var(--fhcp-cat) !important; font-weight: 700; text-decoration: none !important; }
.fhcp-card-title { font-size: 1.063rem; line-height: 1.4; margin: 6px 0 8px; font-weight: 700; }
.fhcp-card-title a { text-decoration: none !important; }
.fhcp-card-title a:hover { color: var(--fhcp-brand) !important; }
.fhcp-card .fhcp-pre { flex: 1; }
.fhcp-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--fhcp-line); }
.fhcp-stat { font-size: 0.813rem; color: var(--fhcp-muted); }
.fhcp-badge { display: inline-block; font-size: 0.75rem; padding: 0 8px; border-radius: 6px; background: #f3f4f6; color: #374151; line-height: 1.8; }
.fhcp-badge.warn { background: #fef3c7; color: #92400e; }
.fhcp-badge.ok { background: #d1fae5; color: #065f46; }
.fhcp-badge.err { background: #fee2e2; color: #991b1b; }
.fhcp-badge.star, .fhcp-badge.fill { background: transparent; padding: 0 2px; }

/* ---------- 提示詞文字 ---------- */
.fhcp-pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Noto Sans Mono CJK TC", "Microsoft JhengHei", monospace;
  font-size: 0.875rem; line-height: 1.7; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 10px; padding: 10px 12px; color: #1f2937;
}
.fhcp-clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; max-height: 9.5em; }
.fhcp-prompt { font-size: 0.969rem; background: #fbfbff; border-color: #e0e7ff; max-height: 70vh; overflow: auto; }
.fhcp-pre mark { border-radius: 4px; padding: 0 2px; }
.fhcp-pre mark.fhcp-blank { background: #fef3c7; color: #92400e; }
.fhcp-pre mark.fhcp-filled { background: #d1fae5; color: #065f46; font-weight: 700; }

/* ---------- 內容頁 ---------- */
.fhcp-box { background: #fff; border: 1px solid var(--fhcp-line); border-radius: var(--fhcp-radius); padding: 14px 16px; margin: 0 0 14px; }
.fhcp-box > summary { cursor: pointer; }
.fhcp-box[open] > summary { margin-bottom: 10px; }
.fhcp-box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fhcp-filler { border-color: #fde68a; background: #fffdf5; }
.fhcp-fill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 12px; margin: 10px 0; }
.fhcp-fill span { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 2px; }
.fhcp-text { font-size: 0.969rem; }
.fhcp-tip { margin: 6px 0 12px; }
.fhcp-report { margin: 10px 0; font-size: 0.875rem; }
.fhcp-report summary { cursor: pointer; color: var(--fhcp-muted); }
.fhcp-report .fhcp-input { max-width: 420px; }
.fhcp-manage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; margin: 14px 0; border: 1px dashed #c7d2fe; border-radius: 12px; background: var(--fhcp-brand-weak); }
.fhcp-manage form { display: inline; margin: 0; }
.fhcp-related-title { margin: 24px 0 12px; }

/* ---------- 表單 ---------- */
.fhcp-form { background: #fff; border: 1px solid var(--fhcp-line); border-radius: var(--fhcp-radius); padding: 16px 18px; }
.fhcp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fhcp-form-grid .full { grid-column: 1 / -1; }
.fhcp-label { display: block; font-weight: 700; font-size: 0.938rem; margin-bottom: 4px; }
.fhcp-label .req { color: var(--fhcp-err); }
.fhcp-input { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.938rem; background: #fff; color: var(--fhcp-text); font-family: inherit; }
.fhcp-input.inline { width: auto; }
.fhcp-input.mono { font-family: ui-monospace, Menlo, Consolas, "Microsoft JhengHei", monospace; font-size: 0.906rem; line-height: 1.7; }
textarea.fhcp-input { resize: vertical; }
.fhcp-hint { font-size: 0.813rem; color: var(--fhcp-muted); margin-top: 4px; }
.fhcp-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fhcp-checks label, .fhcp-check { display: inline-flex; gap: 6px; align-items: center; font-size: 0.938rem; cursor: pointer; }
.fhcp-managebox { background: var(--fhcp-brand-weak); border-radius: 10px; padding: 10px 12px; }
.fhcp-captcha input[type=text] { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; }

/* ---------- 訊息、提示 ---------- */
.fhcp-msg { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; background: #f0f9ff; border: 1px solid #bae6fd; font-size: 0.938rem; }
.fhcp-msg.info { background: #f5f3ff; border-color: #ddd6fe; }
.fhcp-msg.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.fhcp-empty { text-align: center; padding: 40px 10px; color: var(--fhcp-muted); background: #fff; border: 1px dashed var(--fhcp-line); border-radius: var(--fhcp-radius); }
.fhcp-empty .fhcp-btn { margin-top: 12px; }
.fhcp-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.938rem; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.fhcp-toast.err { background: #b91c1c; }
.fhcp-toast[hidden] { display: none; }
.fhcp-nav { margin: 18px 0; text-align: center; }

/* ---------- 表格（我的提示詞、後台） ---------- */
.fhcp-tablewrap { overflow-x: auto; border: 1px solid var(--fhcp-line); border-radius: 12px; margin: 10px 0 20px; }
.fhcp-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; background: #fff; }
.fhcp-table th, .fhcp-table td { border-bottom: 1px solid var(--fhcp-line); padding: 8px 10px; vertical-align: middle; text-align: left; }
.fhcp-table th { background: var(--fhcp-brand-weak); white-space: nowrap; }
.fhcp-table .nowrap { white-space: nowrap; }
.fhcp-table tr.dim td { opacity: .55; }
.fhcp-page > .fhcp-h2 { margin: 22px 0 6px; }

/* ---------- 區塊 ---------- */
.fhcp-block-list { list-style: none; margin: 0; padding: 0; }
.fhcp-block-list li { padding: 4px 0; border-bottom: 1px dashed #e5e7eb; }
.fhcp-bextra { color: #6b7280; }

@media (max-width: 720px) {
  .fhcp-h1 { font-size: 1.438rem; }
  .fhcp-form-grid { grid-template-columns: 1fr; }
  .fhcp-grid { grid-template-columns: minmax(0, 1fr); }
  .fhcp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fhcp-tile { padding: 8px 10px; }
  .fhcp-flabel { min-width: 100%; }
}
@media print {
  .fhcp-actions, .fhcp-search, .fhcp-filters, .fhcp-card-foot, .fhcp-manage, .fhcp-report, .fhcp-toast { display: none !important; }
  .fhcp-clamp { -webkit-line-clamp: unset; max-height: none; }
}
