/* ==================================================================
   page-cert.css  獲證查詢 cert.asp（Agent L）
   只用 transform / opacity 動畫；無 backdrop-filter / SVG filter。
   ================================================================== */
.cert-wrap { max-width: 980px; padding-top: 0; padding-bottom: 96px; }

/* 查詢卡：上移壓在頁首下緣 */
.cert-search { position: relative; z-index: 2; margin-top: -40px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.cert-form { box-shadow: none; }
.cert-form .btn { flex: none; }
.cert-hint { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* 訊息 */
.cert-msg { margin-top: 24px; padding: 14px 18px; border-radius: var(--radius-lg); border: 1px solid #f1c7cb; background: #fdf1f2; color: #8f1d27; font-size: 15px; line-height: 1.6; }
.cert-msg.is-info { margin-top: 0; margin-bottom: 18px; border-color: #ecd9b4; background: #fdf7ea; color: #7a5310; }
.cert-count { margin-top: 36px; }
.cert-muted { color: var(--muted); }

/* 狀態色 */
.cert-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border-radius: 999px; font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.cert-badge svg { width: 18px; height: 18px; flex: none; }
.cert-badge.is-ok { background: #e6f4ec; color: #1d6b43; }
.cert-badge.is-warn { background: #fdf2dc; color: #8a5a07; }
.cert-badge.is-bad { background: #fbe9ea; color: #a3222d; }

/* 結果卡 */
.cert-list { display: grid; gap: 20px; }
.cert-card { position: relative; padding: 26px 28px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.cert-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #2f8f5b; }
.cert-card.is-warn::before { background: #d39a2c; }
.cert-card.is-bad::before { background: #c8323e; }
.cert-card-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cert-no { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cert-no span { color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.cert-no strong { font-family: var(--font-head); font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cert-co { margin-top: 14px; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.3; overflow-wrap: anywhere; }
.cert-co small { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; font-weight: 500; letter-spacing: 0; }
.cert-st-d { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 15px; line-height: 1.6; }
.cert-st-d.is-ok { background: #f1f8f4; color: #1d5b3b; }
.cert-st-d.is-warn { background: #fdf7ea; color: #6f4a08; }
.cert-st-d.is-bad { background: #fdf1f2; color: #8f1d27; }
.cert-dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.cert-dl > div { min-width: 0; }
.cert-dl .is-wide { grid-column: 1 / -1; }
.cert-dl dt { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cert-dl dd { margin: 0; color: var(--ink); font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cert-dl dd.is-bad { color: #a3222d; font-weight: 600; }
.cert-accr { display: inline-block; padding: 2px 10px; border: 1.5px solid var(--ink); border-radius: var(--radius); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.cert-asof { margin-top: 20px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* 查無資料 */
.cert-empty { margin-top: 36px; padding: 40px 32px; border: 1px dashed var(--line-2); border-radius: var(--radius-lg); background: var(--bg-alt); text-align: center; }
.cert-empty-ic { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.cert-empty-ic svg { width: 26px; height: 26px; }
.cert-empty h2 { margin-top: 16px; font-size: 22px; overflow-wrap: anywhere; }
.cert-empty p { max-width: 62ch; margin: 10px auto 0; color: var(--ink-2); line-height: 1.7; }
.cert-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.cert-actions .btn { height: 46px; }

/* 尚未查詢：說明 + 狀態圖例 */
.cert-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; margin-top: 36px; }
.cert-why, .cert-side { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cert-why { background: var(--bg-alt); }
.cert-why-ic { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: var(--radius); background: var(--brand-tint); color: var(--brand); }
.cert-why-ic svg { width: 24px; height: 24px; }
.cert-why h2, .cert-side h2 { font-size: 20px; margin-top: 14px; }
.cert-side h2 { margin-top: 0; }
.cert-why p { margin-top: 10px; color: var(--ink-2); line-height: 1.7; }
.cert-why p.cert-muted { color: var(--muted); font-size: 14px; }
.cert-legend { display: grid; gap: 14px; margin-top: 16px; }
.cert-legend li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.cert-legend .cert-badge { justify-self: start; }
.cert-legend p { color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }

/* 泰文 / 高棉文不使用大寫字距 */
html[data-lang="th"] .cert-no span, html[data-lang="km"] .cert-no span { letter-spacing: 0; text-transform: none; }

@media (max-width: 860px) {
  .cert-intro { grid-template-columns: minmax(0, 1fr); }
  .cert-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cert-search { margin-top: -28px; padding: 14px; }
  .cert-form { padding: 6px 6px 6px 12px; gap: 8px; }
  .cert-form > span { display: none; }
  .cert-form input { font-size: 16px; height: 44px; }
  .cert-form .btn { height: 44px; padding: 0 16px; }
  .cert-card { padding: 20px 18px 18px; }
  .cert-empty { padding: 32px 18px; }
  .cert-why, .cert-side { padding: 22px 18px; }
  .cert-legend li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cert-actions .btn { width: 100%; }
}

/* 頁首 topbar 的「獲證查詢」入口（header.asp） */
[data-theme="classic"] .topbar-cert { display: inline-flex; align-items: center; gap: 6px; margin-left: 18px; font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
[data-theme="classic"] .topbar-cert svg { width: 14px; height: 14px; }
[data-theme="classic"] .topbar-cert:hover { text-decoration: underline; }
