/* ============================================================
   exam-dates.css — 考試日期頁（/resources02.aspx）：窄螢幕改卡片、報名狀態標籤、篩選列、下一步按鈕
   作用對象皆為既有元素（不改 HTML）：form.filter-bar[action="/resources02.aspx"] 之後的 .table-wrap .data-table、.callout
   寬度 ≤640px：每一場一張卡（測驗日期最大、類別在右上、下面是報名截止日與地點，右下角是加入行事曆）；>640px 維持表格。
   每一場的「加入行事曆」（.ed-cal）與手機黏底列（.ed-sticky，exam-dates.js 控制出現時機）。
   報名狀態標籤（.ed-tag）由 exam-dates.js 加上；沒有 JS 時卡片照常、只是沒有標籤。
   ============================================================ */

/* ── 報名狀態標籤（所有寬度） ── */
.ed-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: #e6f3fd; color: #0B3D91; font-size: 14px; font-weight: 800; line-height: 1.7; white-space: nowrap; vertical-align: 1px; }
.ed-tag.is-soon { background: #fff3d6; color: #6b4300; }
.ed-tag.is-today { background: #b52b27; color: #fff; }
.ed-tag.is-closed { background: #eef1f5; color: #4a566b; }
.data-table tr.ed-closed td, .data-table tr.ed-done td { color: #4a566b; }

/* ── 加入行事曆（所有寬度）；App 內開的瀏覽器接不住行事曆檔，由 exam-dates.js 在 html 加 ed-inapp 後藏起來 ── */
.ed-cal { display: inline-block; padding: 6px 0; color: #0B3D91; font-size: 14.5px; font-weight: 700; text-decoration: underline; white-space: nowrap; }
.ed-inapp .ed-cal { display: none; }

/* ── 手機黏底列：桌機一律不顯示 ── */
.ed-sticky { display: none; }
/* 寬螢幕：先替「報名截止日」欄留好標籤的寬度，標籤加上去時欄寬不變（不產生版面位移） */
@media (min-width: 641px) {
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table th:nth-child(2) { width: 15.5em; }
}

/* ── 頁首搬下來的說明句，與上一段隔開 ── */
.ed-about { margin-top: 14px; font-size: 15.5px; }

/* ── 這一類的下一步：選了測驗類別才出現的一行（篩選列與第一場之間） ── */
.ed-next { margin: 12px 0 14px; padding: 14px 16px; background: #f4f8fd; border: 1px solid #cfe0f5; border-left: 4px solid #d9a441; border-radius: 10px; }
.ed-next-q { margin: 0 0 4px; color: #0B3D91; font-size: 16px; line-height: 1.65; }
.ed-next-a { margin: 0 0 10px; color: #1d2b44; font-size: 15px; line-height: 1.65; }
.ed-next-btn { display: inline-block; padding: 11px 22px; min-height: 44px; border-radius: 999px; background: #d9a441; color: #24180a; font-weight: 800; text-decoration: none; box-shadow: 0 4px 14px rgba(217,164,65,.4); }
.ed-next-btn:hover { filter: brightness(1.06); }
.ed-next-sub { display: inline-block; margin-left: 14px; padding: 10px 0; color: #0B3D91; font-size: 14.5px; text-decoration: underline; }

@media (max-width: 640px) {
  .ed-next { margin: 10px 0 12px; padding: 10px 12px; }
  .ed-next-q { font-size: 15.5px; }
  .ed-next-a { margin-bottom: 8px; font-size: 14px; line-height: 1.55; }
  .ed-next-btn { display: block; padding: 9px 16px; text-align: center; }
  .ed-next-sub { display: none; }

  /* ── 篩選列：兩個下拉並排，查詢鈕整列 ── */
  .filter-bar[action="/resources02.aspx"] { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 12px; }
  .filter-bar[action="/resources02.aspx"] label { min-width: 0; }
  .filter-bar[action="/resources02.aspx"] select { min-width: 0; width: 100%; min-height: 44px; }
  .filter-bar[action="/resources02.aspx"] .btn { grid-column: 1 / -1; width: 100%; min-height: 44px; margin-top: 0; }

  /* ── 表格 → 卡片 ── */
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap { overflow: visible; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table { display: block; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tbody { display: grid; gap: 10px; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tr {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "date cat" "dl dl" "loc cal"; gap: 2px 10px;
    padding: 12px 14px; background: #fff; border: 1px solid #dce3ee; border-radius: 12px; box-shadow: 0 2px 10px rgba(10,30,70,.06);
  }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tr.ed-closed,
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tr.ed-done { background: #f3f5f8; box-shadow: none; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td { display: block; padding: 0; border: 0; background: none !important; font-size: 15px; line-height: 1.6; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(1) {
    grid-area: cat; align-self: start; padding: 0 10px; border-radius: 999px; background: #0B3D91 !important; color: #fff; font-size: 14px; font-weight: 800; line-height: 1.8;
  }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tr.ed-closed td:nth-child(1),
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table tr.ed-done td:nth-child(1) { background: #4a566b !important; color: #fff; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(3) { grid-area: date; font-size: 19px; line-height: 1.5; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(2) { grid-area: dl; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(4) { grid-area: loc; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(5) { grid-area: cal; align-self: end; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(5)::before { content: none; }
  .ed-cal { padding: 8px 0 2px 10px; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(n+2)::before {
    display: inline-block; margin-right: 8px; color: #4a566b; font-size: 14px; font-weight: 700;
  }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(2)::before { content: "報名截止日"; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(3)::before { content: "測驗日期"; vertical-align: 2px; }
  .filter-bar[action="/resources02.aspx"] ~ .table-wrap .data-table td:nth-child(4)::before { content: "測驗地點"; }

  /* ── 黏底列 ── */
  .ed-sticky:not([hidden]) {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; display: flex; align-items: center; gap: 8px;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px)) 14px; background: #0B3D91; color: #fff; box-shadow: 0 -6px 18px rgba(10,30,70,.22);
  }
  .ed-sticky-t { flex: 1 1 auto; min-width: 0; margin: 0; color: #fff; font-size: 14.5px; line-height: 1.4; }
  .ed-sticky-t strong { color: #ffd98a; }
  .ed-sticky-n { white-space: nowrap; }
  .ed-sticky-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 999px; background: #d9a441; color: #24180a; font-size: 15.5px; font-weight: 800; text-decoration: none; white-space: nowrap; }
  .ed-sticky-x { flex: 0 0 auto; width: 40px; height: 44px; padding: 0; border: 0; background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
  body.ed-sticky-on { padding-bottom: 64px; }
}
