/* 115 高風險職訓報名前台 — 主樣式
 *
 * 設計策略：B 工安現代（外觀）+ C 親切實用（內頁圓角與手感）
 * 所有色彩、圓角、陰影、字級集中於 :root 內的 design tokens，
 * 未來要換風格只需改這裡即可，不用動 HTML/JS。
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* ===== 色彩系統 ===== */
  --brand: #0057B8;
  --brand-dark: #003d82;
  --brand-darker: #002a5c;
  --brand-soft: #EFF5FC;

  --safety: #F58220;
  --safety-dark: #D66A10;
  --safety-soft: #FFF4E5;

  --warn: #FACC15;

  --ink: #0F172A;
  --ink-mid: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-soft: #EDF0F4;
  --bg: #F4F6FA;
  --card: #FFFFFF;

  --success: #10B981;
  --success-bg: #ECFDF5;
  --danger: #DC2626;

  /* ===== 圓角（來自 C 的柔和感）===== */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  /* ===== 陰影 ===== */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 2px 8px rgba(15,23,42,.06);
  --shadow-md: 0 8px 20px rgba(15,23,42,.08);
  --shadow-lg: 0 16px 32px rgba(15,23,42,.10);

  /* ===== Safe area（iOS 瀏海）===== */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ===== 頂部工安警示條（B 風格）===== */
.stripe {
  height: 5px;
  background: repeating-linear-gradient(
    45deg,
    var(--safety) 0 12px,
    #1a1a1a 12px 24px
  );
}

/* ===== Header ===== */
header {
  background: var(--card);
  padding: 12px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: calc(12px + var(--safe-top));
}
.header-content {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.brand-logo::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid var(--safety);
  border-radius: 3px;
}
.brand-logo span {
  font-size: 13px;
  font-weight: 900;
  color: white;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}
.brand-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1pt;
}
.brand-text strong {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: 2pt;
  margin-top: 2px;
  font-weight: 700;
}
.year-badge {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ===== Hero（B 風格：深藍漸層 + 警示條紋 + 黃色強調）===== */
.hero {
  background:
    linear-gradient(135deg, rgba(0,61,130,.95) 0%, rgba(0,87,184,.88) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g fill='none' stroke='white' stroke-width='.5' opacity='.08'><path d='M0 0l60 60M60 0L0 60'/></g></svg>");
  color: white;
  padding: 48px 24px 64px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: -40px;
  right: -40px;
  height: 80px;
  background: repeating-linear-gradient(-45deg,
    var(--safety) 0 18px,
    #1a1a1a 18px 36px);
  transform: rotate(-3deg);
  opacity: .12;
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--safety);
  color: white;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(245,130,32,.4);
}
.hero-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.hero h1 {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 1.5pt;
  margin-bottom: 12px;
}
.hero h1 em {
  font-style: normal;
  color: var(--warn);
  font-weight: 900;
}
.hero-sub {
  font-size: 14px;
  opacity: .9;
  line-height: 1.85;
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: rgba(0,0,0,.25);
  border-left: 4px solid var(--safety);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}
.hero-stat { flex: 1; min-width: 90px; }
.hero-stat .v {
  font-size: 28px;
  font-weight: 900;
  color: var(--warn);
  line-height: 1;
}
.hero-stat .l {
  font-size: 11px;
  opacity: .85;
  letter-spacing: 2pt;
  margin-top: 4px;
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cta {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  transition: all .2s;
  letter-spacing: 1pt;
}
.cta-primary {
  background: var(--safety);
  color: white;
  box-shadow: 0 6px 16px rgba(245,130,32,.4);
}
.cta-primary:hover {
  background: var(--safety-dark);
  transform: translateY(-1px);
}
.cta-ghost {
  background: transparent;
  color: white;
  border: 1.5px solid rgba(255,255,255,.7);
}
.cta-ghost:hover {
  background: white;
  color: var(--brand-dark);
  border-color: white;
}

/* ===== Progress bar（步驟進度）===== */
.progress {
  background: white;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.steps {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  position: relative;
}
.steps::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.step {
  position: relative;
  z-index: 1;
  text-align: center;
  flex: 1;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all .2s;
}
.step.done .step-num {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.step.active .step-num {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 0 0 4px rgba(0,87,184,.12);
}
.step-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 1px;
}
.step.active .step-label {
  color: var(--brand);
  font-weight: 700;
}

/* ===== Main container ===== */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px calc(80px + var(--safe-bottom));
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: 1px;
}
.card .sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.75;
}

/* ===== 小區段（4 步驟介紹）===== */
.mini-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.mini-step {
  text-align: center;
  padding: 12px 4px;
  background: var(--brand-soft);
  border-radius: var(--radius);
}
.mini-step .n {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  margin-bottom: 6px;
  font-family: 'Noto Sans TC', sans-serif;
}
.mini-step .t {
  font-size: 12.5px;
  font-weight: 700;
}

/* ===== Course tabs（自動換行、縮短標籤，不用橫滑）===== */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 14px;
  margin-bottom: 16px;
}
.cat-tab {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 13px;
  color: var(--ink-mid);
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
}
.cat-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.cat-tab.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,87,184,.2);
}
.cat-tab .count {
  font-size: 11px;
  opacity: .7;
  margin-left: 3px;
  font-weight: 500;
}
.cat-tab.active .count { opacity: .85; }

.course-item {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .2s;
  background: white;
}
.course-item:hover {
  border-color: var(--brand);
  transform: translateX(2px);
}
.course-item.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 4px 12px rgba(0,87,184,.12);
}
.course-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 8px;
}
.course-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  flex: 1;
}
.course-session {
  font-size: 12px;
  color: var(--brand);
  font-weight: 900;
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  letter-spacing: .5px;
}
.course-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.course-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag-night {
  display: inline-block;
  background: #1F2937;
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: 4px;
  letter-spacing: 1px;
}

/* ===== 剩餘名額徽章 ===== */
.seat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .5px;
  margin-left: auto;
}
.seat-open {
  background: var(--success-bg);
  color: #065F46;
}
.seat-open::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.seat-low {
  background: #FFF4E5;
  color: #8B4E00;
}
.seat-low::before {
  content: "⚡";
  font-size: 10px;
}
.seat-full {
  background: #FEE2E2;
  color: #991B1B;
}
.seat-full::before {
  content: "✕";
  font-weight: 900;
}
.seat-closed {
  background: #F3F4F6;
  color: #6B7280;
}
.seat-closed::before {
  content: "🔒";
  font-size: 10px;
}
.seat-loading {
  background: #F3F4F6;
  color: var(--muted);
  font-weight: 500;
}
.seat-loading::before {
  content: "⌛";
  font-size: 10px;
}

/* 額滿 / 關閉的課程卡片 */
.course-item.disabled {
  opacity: .6;
  cursor: not-allowed;
  background: #FAFAFA;
}
.course-item.disabled:hover {
  border-color: var(--line);
  transform: none;
}
.course-item.disabled .course-name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(0,0,0,.2);
}

/* ===== Qualification checkboxes ===== */
.qual-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qual-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  background: white;
}
.qual-item:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.qual-item.checked {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.qual-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: white;
  font-weight: 900;
  transition: all .2s;
}
.qual-item.checked .qual-check {
  background: var(--brand);
  border-color: var(--brand);
}
.qual-item.checked .qual-check::after {
  content: "✓";
  font-size: 15px;
}
.qual-content { flex: 1; }
.qual-label {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.qual-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.qual-files {
  font-size: 11px;
  color: var(--brand);
  margin-top: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.qual-files span {
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
}

/* ===== Upload（B 配色 + C 圓角）===== */
.upload-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: #FCFDFE;
}
.upload-group-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.upload-group-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.file-list:empty { display: none; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--success-bg);
  border: 1px solid #C6E5D0;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.file-item .icon {
  color: var(--success);
  font-size: 16px;
  font-weight: 900;
}
.file-item .name {
  flex: 1;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.file-item .size {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.file-item .remove {
  color: var(--danger);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11.5px;
  transition: background .15s;
}
.file-item .remove:hover {
  background: rgba(220,38,38,.1);
}

.upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 20px 14px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  width: 100%;
}
.upload-btn:hover {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-soft);
}
.upload-btn.dragover {
  border-color: var(--safety);
  background: var(--safety-soft);
}
.upload-btn .ub-icon { font-size: 24px; }
.upload-btn .ub-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
}
.upload-btn .ub-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.upload-btn input[type="file"] { display: none; }
.upload-btn-single { margin-top: 4px; }

/* ===== Form ===== */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-mid);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: .5px;
}
.form-row label .req { color: var(--danger); margin-left: 2px; }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  background: white;
  transition: border .2s, box-shadow .2s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,87,184,.1);
}
.form-row .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}
.form-row .err {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
  font-weight: 600;
}
.form-row.has-error input,
.form-row.has-error select { border-color: var(--danger); }
.form-row.has-error .err { display: block; }

.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-group {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}
.form-group-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--brand);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 4px solid var(--brand);
  letter-spacing: 1px;
}

.honeypot { position: absolute; left: -9999px; }

/* ===== Buttons ===== */
.btn-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.btn {
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  letter-spacing: 1px;
}
.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 4px 12px rgba(0,87,184,.25);
}
.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  background: #BBB;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-accent {
  background: var(--safety);
  color: white;
  box-shadow: 0 4px 12px rgba(245,130,32,.3);
}
.btn-accent:hover {
  background: var(--safety-dark);
  transform: translateY(-1px);
}
.btn-outline {
  background: white;
  color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
  padding-left: 8px;
  padding-right: 8px;
}
.btn-ghost:hover { color: var(--brand); }

/* ===== Notice boxes ===== */
.notice {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.7;
}
.notice-info {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-left: 4px solid var(--brand);
}
.notice-warn {
  background: #FFF8E1;
  color: #7A5A00;
  border-left: 4px solid var(--warn);
}
.notice-ok {
  background: var(--success-bg);
  color: #065F46;
  border-left: 4px solid var(--success);
}

/* ===== Success page ===== */
.success-hero { text-align: center; padding: 32px 20px; }
.success-hero .icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: var(--success);
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(16,185,129,.15);
}
.success-hero h1 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: 1pt;
}
.success-hero .sub { color: var(--muted); font-size: 14px; line-height: 1.8; }
.summary-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 20px;
  font-size: 13px;
}
.summary-box .row {
  display: flex;
  padding: 5px 0;
  gap: 10px;
}
.summary-box .label {
  color: var(--muted);
  min-width: 80px;
  letter-spacing: .5px;
}
.summary-box .val { flex: 1; font-weight: 700; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 100%;
  padding: 26px 22px;
  box-shadow: var(--shadow-lg);
}

/* ===== Loader ===== */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Footer ===== */
footer {
  background: var(--ink);
  color: white;
  padding: 26px 20px;
  text-align: center;
  border-top: 4px solid var(--safety);
}
footer .ft-title {
  font-weight: 900;
  font-size: 14.5px;
  letter-spacing: 3pt;
  margin-bottom: 6px;
}
footer .ft-sub {
  font-size: 11.5px;
  opacity: .7;
  letter-spacing: 1.5pt;
}

/* ===== Mobile tweaks ===== */
@media (max-width: 480px) {
  html { font-size: 15px; }
  .form-2col { grid-template-columns: 1fr; }
  .card { padding: 20px 16px; }
  main { padding: 16px 14px 80px; }
  .hero h1 { font-size: 24px; }
  .hero { padding: 40px 20px 56px; }
  .hero-stats { flex-direction: column; gap: 12px; padding: 14px 16px; }
  .upload-btn { padding: 22px 14px; }
  .upload-btn .ub-icon { font-size: 28px; }
  .mini-step .n { width: 32px; height: 32px; }
  .steps { padding: 0 4px; }
  .step-label { font-size: 10px; letter-spacing: .5px; }
}
