/* ============================================================
   AINav 原型共用樣式 (Prototype shared styles)
   所有 mock 流程頁、intent/private/nurse-onboarding 共用此檔
   沿用 deliverables/design/design.md 的設計 token
   ============================================================ */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --card2: #eef2f7;
  --surface: #f0f4f8;
  --text: #1a2332;
  --text2: #5a6a7a;
  --text3: #8a96a4;
  --primary: #0f6b5e;
  --primary-light: #e8f4f1;
  --primary-dark: #0a4e45;
  --accent: #d4860a;
  --accent-light: #fef6e8;
  --blue: #2563a8;
  --blue-light: #e8f0fa;
  --red: #c4382a;
  --green: #2a8a5a;
  --purple: #6a4ca8;
  --border: rgba(15,107,94,0.12);
  --shadow-card: 0 2px 12px rgba(26,35,50,0.06);
  --shadow-hover: 0 4px 20px rgba(26,35,50,0.10);
  --shadow-email: 0 8px 32px rgba(26,35,50,0.08);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --fs-hero: 2.5rem;
  --fs-h1: 2rem;
  --fs-h2: 1.5rem;
  --fs-h3: 1.25rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-caption: 0.75rem;
  /* Risk colour scale for countdown */
  --risk-minimal: #0d9488;
  --risk-low: #16a34a;
  --risk-medium: #d97706;
  --risk-high: #ea580c;
  --risk-critical: #dc2626;
  --gradient-hero: linear-gradient(135deg, #071f1b 0%, #0a4e45 25%, #0f6b5e 50%, #147a6a 75%, #1a8a7a 100%);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-blur: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: var(--fs-body); line-height: 1.75; color: var(--text);
  background-color: var(--bg); -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: "Noto Serif TC", serif; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ========== Demo banner (top of every mock page) ========== */
.demo-banner {
  background: linear-gradient(90deg, #1a2332 0%, #0a4e45 100%);
  color: rgba(255,255,255,0.92);
  padding: 10px 20px;
  font-size: var(--fs-caption);
  letter-spacing: 0.05em;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 50;
}
.demo-banner strong {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.demo-banner a {
  color: #ffd580;
  margin-left: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.demo-banner a:hover { color: #ffecc4; }

/* ========== Demo reset button (floating bottom-right) ========== */
.demo-reset {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(26,35,50,0.9);
  color: #fff;
  border-radius: 999px;
  font-size: var(--fs-caption);
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.demo-reset:hover {
  background: #1a2332;
  color: #fff;
  transform: translateY(-2px);
}
.demo-reset svg { width: 14px; height: 14px; }

/* ========== Common container / layout ========== */
.page-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 120px;
}
.page-header {
  text-align: center;
  margin-bottom: 40px;
}
.page-header .eyebrow {
  display: inline-block;
  padding: 4px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.page-header h1 {
  font-size: var(--fs-h1);
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.4;
}
.page-header p {
  font-size: var(--fs-body);
  color: var(--text2);
  max-width: 640px;
  margin: 0 auto;
}

/* ========== Cards ========== */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-h3);
  margin-bottom: 16px;
  color: var(--text);
}
.card-title .badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  font-size: 0.95rem;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
  border: 2px solid transparent;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}
.btn-primary:hover { color: #fff; box-shadow: 0 6px 20px rgba(15,107,94,0.3); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--card2); color: var(--text); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #b36e05 100%);
  color: #fff;
}
.btn-accent:hover { color: #fff; box-shadow: 0 6px 20px rgba(212,134,10,0.3); }
.btn-danger {
  background: var(--risk-critical);
  color: #fff;
}
.btn-danger:hover { color: #fff; background: #b91c1c; }
.btn svg { width: 16px; height: 16px; }

/* ========== Form ========== */
.form-row { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-input,
.form-select {
  width: 100%;
  padding: 12px 14px;
  font-size: var(--fs-body);
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,107,94,0.12);
}
.form-hint { font-size: var(--fs-caption); color: var(--text3); margin-top: 4px; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ========== Email frame (Gmail-style mock) ========== */
.email-frame {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-email);
  overflow: hidden;
  border: 1px solid var(--border);
}
.email-toolbar {
  background: #f2f4f7;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text2);
}
.email-toolbar-left { display: flex; align-items: center; gap: 10px; }
.email-toolbar-left svg { width: 16px; height: 16px; }
.email-toolbar-right { display: flex; gap: 6px; opacity: 0.6; }
.email-toolbar-right span {
  width: 10px; height: 10px; border-radius: 50%; background: #cbd3dd;
}
.email-subject {
  padding: 22px 28px 6px;
  font-family: "Noto Serif TC", serif;
  font-size: var(--fs-h2);
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
}
.email-meta {
  padding: 6px 28px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.email-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: "Noto Serif TC", serif;
  flex-shrink: 0;
}
.email-sender-line { font-size: var(--fs-small); color: var(--text); font-weight: 600; }
.email-sender-line .time { color: var(--text3); font-weight: 400; margin-left: 8px; }
.email-recipient-line { font-size: var(--fs-caption); color: var(--text3); }
.email-body {
  padding: 28px;
  color: var(--text);
  line-height: 1.85;
}
.email-body p { margin-bottom: 14px; }
.email-body p.intro { color: var(--text2); font-size: var(--fs-small); }
.email-body .email-highlight {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  margin: 18px 0;
  font-size: var(--fs-small);
  color: var(--primary-dark);
}
.email-body .field-list {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 18px 0;
  font-size: var(--fs-small);
}
.email-body .field-list dt {
  color: var(--text3);
  font-weight: 500;
  margin-top: 8px;
}
.email-body .field-list dt:first-child { margin-top: 0; }
.email-body .field-list dd {
  color: var(--text);
  font-weight: 600;
  margin: 2px 0 10px;
}
.email-cta {
  margin: 26px 0 12px;
  text-align: center;
}
.email-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-caption);
  color: var(--text3);
  background: #fafbfc;
}

/* ========== Countdown clock ========== */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(15,107,94,0.08);
  border: 1.5px solid var(--risk-minimal);
  border-radius: 999px;
  font-family: "Noto Serif TC", serif;
  color: var(--risk-minimal);
  transition: background 0.5s, border-color 0.5s, color 0.5s;
}
.countdown.level-medium {
  background: rgba(217,119,6,0.08);
  border-color: var(--risk-medium);
  color: var(--risk-medium);
}
.countdown.level-high {
  background: rgba(234,88,12,0.10);
  border-color: var(--risk-high);
  color: var(--risk-high);
}
.countdown.level-critical {
  background: rgba(220,38,38,0.10);
  border-color: var(--risk-critical);
  color: var(--risk-critical);
  animation: countdownPulse 1.2s ease-in-out infinite;
}
@keyframes countdownPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
  50% { box-shadow: 0 0 0 8px rgba(220,38,38,0.15); }
}
.countdown .cd-icon {
  width: 16px; height: 16px;
  animation: clockTick 2s ease-in-out infinite;
}
@keyframes clockTick {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(6deg); }
}
.countdown .cd-digits {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.countdown .cd-label {
  font-size: var(--fs-caption);
  font-weight: 500;
  opacity: 0.8;
  font-family: "Noto Sans TC", sans-serif;
  letter-spacing: 0.05em;
}

/* ========== Risk banner / callout ========== */
.callout {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 24px;
}
.callout h4 {
  font-size: var(--fs-body);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.callout p { font-size: var(--fs-small); line-height: 1.8; margin: 0; }
.callout-info {
  background: var(--primary-light);
  border-color: rgba(15,107,94,0.2);
  color: var(--primary-dark);
}
.callout-warn {
  background: #fff7ed;
  border-color: rgba(234,88,12,0.25);
  color: #9a3412;
}
.callout-critical {
  background: #fef2f2;
  border-color: rgba(220,38,38,0.25);
  color: #991b1b;
}

/* ========== Collapsible (details/summary) ========== */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  margin-bottom: 16px;
  overflow: hidden;
}
.collapsible summary {
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::after {
  content: '＋';
  color: var(--primary);
  font-size: 1.1rem;
  transition: transform 0.2s;
}
.collapsible[open] summary::after {
  content: '－';
}
.collapsible summary:hover { background: var(--surface); }
.collapsible .collapsible-body {
  padding: 0 24px 22px;
  color: var(--text2);
  line-height: 1.85;
  font-size: var(--fs-small);
}

/* ========== Timeline ========== */
.timeline {
  position: relative;
  margin: 24px 0;
  padding-left: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary) 0%, var(--accent) 100%);
}
.timeline-item {
  position: relative;
  padding-bottom: 18px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--primary);
}
.timeline-item.accent::before {
  border-color: var(--accent);
}
.timeline-month {
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.timeline-title {
  font-size: var(--fs-body);
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}
.timeline-desc {
  font-size: var(--fs-small);
  color: var(--text2);
}

/* ========== Success-state (post-form) ========== */
.success-state {
  display: none;
  text-align: center;
  padding: 60px 24px;
}
.success-state.visible {
  display: block;
  animation: fadeInUpSmall 0.6s ease-out both;
}
@keyframes fadeInUpSmall {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.success-checkmark {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}
.success-checkmark svg { width: 36px; height: 36px; color: var(--primary); }
.success-state h2 { font-size: var(--fs-h2); margin-bottom: 12px; }
.success-state p { color: var(--text2); max-width: 440px; margin: 0 auto 28px; }

/* ========== Chip / status pill ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--card2);
  color: var(--text2);
  border-radius: 999px;
  font-size: var(--fs-caption);
  font-weight: 500;
}
.chip.chip-success { background: #dcfce7; color: #14532d; }
.chip.chip-warn { background: #fef3c7; color: #78350f; }
.chip.chip-danger { background: #fee2e2; color: #7f1d1d; }
.chip.chip-info { background: var(--blue-light); color: #1a4a80; }

/* ========== Scroll animations ========== */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}
[data-animate-delay="1"] { transition-delay: 0.08s; }
[data-animate-delay="2"] { transition-delay: 0.16s; }
[data-animate-delay="3"] { transition-delay: 0.24s; }
[data-animate-delay="4"] { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  [data-animate] { opacity: 1 !important; transform: none !important; }
}
