/* Apple 風格：黑、灰、白，簡約留白 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "PingFang TC", "Noto Sans TC", sans-serif;
  color: #1d1d1f;
  background: #fbfbfd;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  background: #fff; border-bottom: 1px solid #e5e5e7;
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.brand { color: #1d1d1f; text-decoration: none; font-weight: 600; font-size: 17px; }
.nav { display: flex; align-items: center; gap: 12px; }
.user-info { color: #6e6e73; font-size: 14px; }

/* Footer */
.site-footer { margin-top: 80px; padding: 32px 0; border-top: 1px solid #e5e5e7; color: #86868b; text-align: center; }

/* Typography */
h1 { font-size: 32px; font-weight: 600; margin: 40px 0 16px; letter-spacing: -0.02em; }
h3 { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.muted { color: #86868b; font-size: 14px; }

/* Card */
.card {
  background: #fff; border: 1px solid #e5e5e7; border-radius: 16px;
  padding: 32px; margin: 24px 0;
}
.card-narrow { max-width: 420px; margin: 80px auto; }

/* Course grid */
.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin-top: 24px;
}
.course-card {
  background: #fff; border: 1px solid #e5e5e7; border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.course-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); transform: translateY(-2px); }
.course-card__meta { display: flex; gap: 8px; margin-bottom: 12px; }
.course-card__title { margin-bottom: 12px; }
.course-card__info { list-style: none; padding: 0; margin: 0 0 16px; font-size: 14px; }
.course-card__info li { padding: 4px 0; color: #424245; }
.course-card__actions { margin-top: auto; display: flex; gap: 8px; }

.tag {
  display: inline-block; padding: 4px 10px; background: #1d1d1f; color: #fff;
  border-radius: 12px; font-size: 12px; font-weight: 500;
}
.tag-ghost { background: transparent; color: #6e6e73; border: 1px solid #d2d2d7; }

/* Form */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], textarea, select {
  width: 100%; padding: 10px 14px; border: 1px solid #d2d2d7; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #1d1d1f; box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* Button */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 10px;
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s; font-family: inherit;
}
.btn-primary { background: #1d1d1f; color: #fff; }
.btn-primary:hover { background: #000; }
.btn-secondary { background: #f5f5f7; color: #86868b; cursor: not-allowed; }
.btn-ghost { background: transparent; color: #1d1d1f; border-color: #d2d2d7; }
.btn-ghost:hover { background: #f5f5f7; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.alert-info { background: #f0f0f2; color: #1d1d1f; }
.alert-error, .alert-danger { background: #ffe5e5; color: #c1272d; }
.alert-success { background: #e5f5ea; color: #0a7c2f; }

.link-back { color: #6e6e73; text-decoration: none; font-size: 14px; }
.link-back:hover { color: #1d1d1f; }

/* Stage 2 additions */
.nav-link { color: #1d1d1f; text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 6px; }
.nav-link:hover { background: #f5f5f7; }

.page-header { margin: 40px 0 24px; }
.page-header h1 { margin: 0 0 4px; }

.filter-bar {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e5e5e7; border-radius: 12px;
  padding: 16px 20px; margin: 16px 0 32px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: #6e6e73; font-weight: 500; }
.filter-group select { min-width: 160px; }

.month-group { margin-bottom: 40px; }
.month-title {
  font-size: 20px; font-weight: 600; margin: 24px 0 16px;
  padding-bottom: 8px; border-bottom: 1px solid #e5e5e7;
}

.course-card--link { text-decoration: none; color: inherit; cursor: pointer; }
.btn-fake { display: inline-block; }

.empty-state { text-align: center; padding: 48px 24px; }

.tag-danger { background: #c1272d; color: #fff; }
.tag-warn { background: #ff9500; color: #fff; }

.course-detail { max-width: 720px; margin: 24px 0 60px; }
.course-detail__meta { display: flex; gap: 8px; margin-bottom: 16px; }
.course-detail__title { font-size: 36px; margin: 0 0 32px; letter-spacing: -0.02em; }
.course-detail__info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 24px;
  background: #fff; border: 1px solid #e5e5e7; border-radius: 16px;
  padding: 24px 28px; margin-bottom: 24px;
}
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-label { font-size: 12px; color: #86868b; font-weight: 500; }
.info-value { font-size: 15px; color: #1d1d1f; }
.course-detail__desc {
  background: #fff; border: 1px solid #e5e5e7; border-radius: 16px;
  padding: 24px 28px; margin-bottom: 24px;
}
.course-detail__desc h3 { margin-top: 0; }
.course-detail__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.course-summary p { margin: 6px 0; }

/* Stage 3 additions - Registration form */
.course-summary-card { background: #f5f5f7; }
.course-summary-header { display: flex; gap: 8px; }
.course-summary-list { list-style: none; padding: 0; margin: 0; }
.course-summary-list li { padding: 4px 0; font-size: 14px; }

.registration-form .card { margin-bottom: 20px; }
.registration-form h3 { margin: 0 0 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.req { color: #c1272d; margin-left: 3px; }

.attendees-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.attendees-header .muted { margin: 0; }

.attendee-row {
  display: grid;
  grid-template-columns: 32px 1fr 40px;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: #fbfbfd;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  margin-bottom: 12px;
}
.attendee-number {
  width: 28px; height: 28px;
  background: #1d1d1f; color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  margin-top: 26px;
}
.attendee-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-remove-attendee {
  background: transparent; border: 1px solid #e5e5e7; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer;
  color: #86868b; font-size: 14px; margin-top: 24px;
  transition: all 0.15s;
}
.btn-remove-attendee:hover { background: #ffe5e5; color: #c1272d; border-color: #ffcccc; }

#btn-add-attendee { margin-top: 8px; }
#btn-add-attendee:disabled { opacity: 0.4; cursor: not-allowed; }

.form-actions {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 24px;
}

/* Success page */
.success-page { max-width: 640px; margin: 40px auto; text-align: center; }
.success-icon {
  width: 72px; height: 72px; margin: 0 auto 16px;
  background: #0a7c2f; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 600;
}
.success-info { list-style: none; padding: 0; margin: 0; }
.success-info li { padding: 6px 0; font-size: 15px; }
.attendee-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.attendee-table th, .attendee-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f2;
  font-size: 14px;
}
.attendee-table th { background: #f5f5f7; color: #6e6e73; font-weight: 500; }

@media (max-width: 640px) {
  .field-row, .attendee-fields { grid-template-columns: 1fr; }
}

/* Stage 3.5 - Attendee card 改為卡片式（因為欄位變多） */
.attendee-card {
  background: #fbfbfd;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.attendee-card__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.attendee-number {
  width: 28px; height: 28px;
  background: #1d1d1f; color: #fff;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.attendee-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
}
.attendee-grid .field { margin-bottom: 0; }
.attendee-grid .field--wide { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .attendee-grid { grid-template-columns: 1fr; }
}

/* 刪除此位按鈕 */
.btn-remove-row {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: #c1272d;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-remove-row:hover {
  background: #c1272d;
  color: #fff;
  border-color: #c1272d;
}

/* ═══════════════════════════════════════════
   UX 大改（15 項）
   ═══════════════════════════════════════════ */

/* 麵包屑 */
.breadcrumbs {
  margin: 24px 0 0;
  font-size: 13px;
  color: #86868b;
}
.breadcrumbs a {
  color: #6e6e73;
  text-decoration: none;
}
.breadcrumbs a:hover { color: #1d1d1f; text-decoration: underline; }
.breadcrumbs__sep {
  margin: 0 8px;
  color: #d2d2d7;
}
.breadcrumbs__current {
  color: #1d1d1f;
  font-weight: 500;
}

/* 按鈕小尺寸 */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
.btn-block { width: 100%; }

/* 課程卡片內的標題連結 */
.course-card__title { margin-bottom: 12px; }
.course-card__title-link {
  color: inherit; text-decoration: none;
}
.course-card__title-link:hover { color: #06c; }

/* 課程卡片不再整張可點：hover 效果只做輕微陰影 */
.course-card {
  transition: box-shadow 0.2s;
}
.course-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

/* 課程列表底部的引導 */
.empty-hint {
  text-align: center;
  margin: 48px 0 0;
  padding: 24px;
  border-top: 1px solid #e5e5e7;
}
.empty-hint p { margin: 0; }

/* 密碼欄位 + 顯示密碼按鈕 */
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #6e6e73;
}
.password-toggle:hover { background: #f5f5f7; }

/* 「刪除此位」按鈕改中性風格（第 13 項） */
.btn-remove-row {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: #86868b;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-remove-row:hover {
  background: #ffe5e5;
  color: #c1272d;
  border-color: transparent;
}

/* 次要文字連結（成功頁用） */
.link-secondary {
  color: #06c;
  text-decoration: none;
  font-size: 14px;
}
.link-secondary:hover { text-decoration: underline; }

/* 課程詳情頁 - 主要動作放大、次要縮小、成群顯示 */
.course-detail__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}
.course-detail__actions .btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   課程列表 - 條列式（v2）
   ═══════════════════════════════════════════ */
.course-table-wrap {
  overflow-x: auto;
  margin: 16px 0 32px;
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
}
.course-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.course-table thead {
  background: #f5f5f7;
}
.course-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #6e6e73;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #e5e5e7;
}
.course-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f2;
  vertical-align: middle;
}
.course-table tbody tr:last-child td {
  border-bottom: none;
}
.course-table tbody tr:hover {
  background: #fafafa;
}

/* 欄寬 */
.course-table .col-title    { width: auto; }
.course-table .col-date     { width: 160px; white-space: nowrap; }
.course-table .col-region   { width: 100px; }
.course-table .col-slots    { width: 120px; text-align: center; }
.course-table .col-action   { width: 120px; text-align: right; }

/* 課程名稱連結 */
.course-title-link {
  color: #1d1d1f;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  margin-right: 8px;
}
.course-title-link:hover {
  color: #06c;
  text-decoration: underline;
}

/* 場次課標籤 */
.tag-session {
  background: #8250df;
  color: #fff;
  font-size: 11px;
  margin-left: 4px;
}

/* 剩餘名額欄置中對齊粗體 */
.col-slots b {
  font-size: 17px;
  color: #0a7c2f;
}

/* 手機優化 */
@media (max-width: 720px) {
  .course-table {
    font-size: 14px;
  }
  .course-table th,
  .course-table td {
    padding: 10px 8px;
  }
  .course-table .col-region {
    width: auto;
  }
  .course-table .col-date {
    width: auto;
  }
}

/* 條列式課程 - 動作按鈕群 */
.action-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.action-btns .btn {
  white-space: nowrap;
  min-width: 100px;
  text-align: center;
}

/* 報名頁的 CSV 引導區塊 */
.csv-hint-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  margin: 24px 0 16px;
  background: #f0f4ff;
  border: 1px solid #d1dcff;
  border-radius: 12px;
  flex-wrap: wrap;
}
.csv-hint-card b {
  color: #1d1d1f;
  margin-right: 8px;
}

/* 報名頁 - 截止時間提示卡片 */
.deadline-alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  margin: 24px 0 12px;
  background: linear-gradient(90deg, #fff8e1, #fffdf3);
  border: 1px solid #ffd54f;
  border-radius: 12px;
  flex-wrap: wrap;
}
.deadline-info b {
  display: block;
  font-size: 13px;
  color: #6e6e73;
  margin-bottom: 4px;
}
.deadline-time {
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
}
.ext-tag {
  display: inline-block;
  background: #ff9500;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
  vertical-align: middle;
}


/* ═══════════════════════════════════════════
   設備寄送卡片
   ═══════════════════════════════════════════ */
.shipping-card { border-left: 4px solid #8250df; }
.shipping-notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}
.shipping-notice--apple { background: #f0f0f2; color: #1d1d1f; }
.shipping-notice--warn  { background: #fff4e5; color: #8b4a00; }
.shipping-notice--muted { background: #f5f5f7; color: #6e6e73; }

.shipping-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #fafafa;
  border: 1px solid #e5e5e7; border-radius: 8px;
  cursor: pointer; user-select: none;
}
.shipping-check input { width: 18px; height: 18px; cursor: pointer; }
.shipping-check:hover { background: #f0f0f2; }

.shipping-address-box {
  margin-top: 12px; padding: 14px 16px;
  background: #f5f5f7; border-radius: 8px;
  border: 1px solid #e5e5e7;
}
.shipping-address-title {
  font-weight: 600; margin-bottom: 8px;
  color: #1d1d1f; font-size: 14px;
}
.shipping-address-list {
  list-style: none; padding: 0; margin: 0 0 8px;
  font-size: 14px;
}
.shipping-address-list li { padding: 3px 0; }
.shipping-address-list b { color: #6e6e73; font-weight: 500; margin-right: 6px; }
