/* 謝政興泌尿科線上預約。色票取自官網主題 urokingdom-2026。 */
:root {
	--primary: #1f2c5c; --primary-dark: #16213f; --accent: #4f6bb0; --accent-soft: #edf1f9;
	--teal: #28808a; --teal-soft: #e9f6f8; --bg: #f4f6fa; --card: #fff; --text: #1e293b; --muted: #64748b;
	--border: #e2e8f0; --line: #06c755; --danger: #c0392b; --danger-soft: #fdecec; --few: #e8a33d;
	--radius: 16px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
	--font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; font-size: 16px; }
body.has-bar { padding-bottom: 84px; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* ---------- 頂欄 ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); min-width: 0; }
.brand img { flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 17px; white-space: nowrap; }
.brand small { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.topbar-actions { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--primary); font-size: 14px; font-weight: 600; background: #fff; white-space: nowrap; }
.chip svg { width: 16px; height: 16px; fill: currentColor; }
.chip-line { background: var(--line); border-color: var(--line); color: #fff; }

/* ---------- 開頭 ---------- */
.page { padding: 28px 0 40px; }
.intro h1 { margin: 0 0 4px; font-size: 30px; color: var(--primary); letter-spacing: .02em; }
.intro p { margin: 0 0 14px; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.facts li { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-weight: 600; }

/* ---------- 步驟 ---------- */
.stepper { display: flex; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: s; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 600; padding-top: 10px; border-top: 3px solid var(--border); }
.stepper li span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--border); color: var(--muted); font-size: 13px; }
.stepper li.is-current { color: var(--primary); border-top-color: var(--primary); }
.stepper li.is-current span { background: var(--primary); color: #fff; }
.stepper li.is-done { color: var(--teal); border-top-color: var(--teal); }
.stepper li.is-done span { background: var(--teal); color: #fff; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.loading-card { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); }
.mine { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 16px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); text-decoration: none; }

/* ---------- 第一步：月曆＋時段 ---------- */
.picker { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { margin: 0; font-size: 18px; color: var(--primary); }
.cal-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; color: var(--primary); }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-cell { aspect-ratio: 1 / 1; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 12px; border: 0; background: transparent; padding: 0; }
.cal-d { font-size: 16px; font-weight: 600; line-height: 1.1; }
.cal-sub { font-size: 10px; line-height: 1.1; }
.cal-cell.is-out .cal-d { color: #cbd5e1; font-weight: 400; }
.cal-cell.is-closed .cal-d, .cal-cell.is-full .cal-d { color: #94a3b8; font-weight: 400; }
.cal-cell.is-closed .cal-sub, .cal-cell.is-full .cal-sub { color: #94a3b8; }
.cal-cell.is-open { background: var(--accent-soft); color: var(--primary); cursor: pointer; transition: background .15s, transform .15s; }
.cal-cell.is-open .cal-sub { color: var(--teal); font-weight: 600; }
.cal-cell.is-few .cal-sub { color: #b26a00; }
.cal-cell.is-open:hover { background: #dfe6f5; }
.cal-cell.is-selected, .cal-cell.is-selected:hover { background: var(--primary); color: #fff; }
.cal-cell.is-selected .cal-sub { color: #cdd6ef; }
.cal-cell:focus-visible, .slot:focus-visible, .btn:focus-visible, .seg-btn:focus-visible { outline: 3px solid #9fb3e6; outline-offset: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-open { background: var(--accent-soft); border: 1px solid #c7d2ec; }
.dot-few { background: var(--few); }
.dot-off { background: #e2e8f0; }

.times-title { margin: 0 0 6px; font-size: 20px; color: var(--primary); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.times-title small { font-size: 13px; color: var(--muted); font-weight: 400; }
.period { margin-top: 14px; }
.period h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.period h3 small { font-weight: 400; font-size: 12px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot { height: 46px; border-radius: 10px; border: 1.5px solid var(--border); background: #fff; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--primary); transition: border-color .15s, background .15s; }
.slot:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.slot.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot:disabled { background: #f1f5f9; border-color: #f1f5f9; color: #b8c2d1; text-decoration: line-through; cursor: not-allowed; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); }
.next-desktop { margin-top: 22px; }

/* ---------- 按鈕 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; transition: background .15s, opacity .15s; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-ghost { border-color: var(--border); color: var(--primary); background: #fff; font-size: 14px; min-height: 42px; padding: 0 14px; }
.btn-line { background: var(--line); color: #fff; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- 手機底部操作列 ---------- */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(15, 23, 42, .08); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.actionbar-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actionbar-text { display: flex; flex-direction: column; line-height: 1.3; }
.actionbar-text small { color: var(--muted); font-size: 12px; }
.actionbar-text strong { color: var(--primary); font-size: 17px; }
.actionbar .btn { min-width: 120px; }

/* ---------- 第二步：表單 ---------- */
.form { max-width: 560px; margin: 0 auto; }
.summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); margin-bottom: 20px; }
.summary div { display: flex; flex-direction: column; }
.summary small { color: var(--muted); font-size: 12px; }
.summary strong { color: var(--primary); font-size: 17px; }
.summary span { color: var(--primary); }
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input { width: 100%; height: 52px; padding: 0 14px; border: 1.5px solid var(--border); border-radius: 12px; font: inherit; font-size: 17px; background: #fff; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 107, 176, .18); }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-btn { display: flex; flex-direction: column; align-items: center; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.seg-btn strong { font-size: 16px; color: var(--primary); }
.seg-btn small { font-size: 12px; color: var(--muted); }
.seg-btn.is-on { border-color: var(--primary); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.consent { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; cursor: pointer; font-size: 15px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.captcha { margin-bottom: 16px; }
.fine { margin: 12px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- 第三步：完成 ---------- */
.done { max-width: 560px; margin: 0 auto; text-align: center; }
.done h2 { margin: 6px 0 4px; color: var(--primary); font-size: 24px; }
.done-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--teal-soft); display: grid; place-items: center; }
.done-icon svg { width: 36px; height: 36px; fill: var(--teal); }
.ticket { display: flex; text-align: left; margin: 20px 0; border: 1.5px dashed #c7d2ec; border-radius: 14px; overflow: hidden; }
.ticket-date { flex: none; width: 96px; background: var(--primary); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 6px; }
.ticket-m { font-size: 13px; opacity: .8; }
.ticket-d { font-size: 38px; font-weight: 800; line-height: 1.05; }
.ticket-w { font-size: 13px; opacity: .8; }
.ticket-info { margin: 0; padding: 14px 16px; display: grid; grid-template-columns: 44px 1fr; gap: 4px 10px; font-size: 15px; }
.ticket-info dt { color: var(--muted); }
.ticket-info dd { margin: 0; font-weight: 600; }
.is-cancelled .ticket { opacity: .55; }
.is-cancelled .ticket-date { background: #94a3b8; }
.cal-add { margin: 8px 0 4px; }
.cal-add .label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.cal-add-btns { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.done-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- 須知與位置 ---------- */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.info { padding: 18px 22px; }
.info h2, .info summary { font-size: 16px; font-weight: 700; color: var(--primary); margin: 0 0 8px; }
.info summary { cursor: pointer; }
.info ul { margin: 6px 0 0; padding-left: 1.2em; }
.info li { margin-bottom: 6px; font-size: 15px; }
.info p { margin: 6px 0; font-size: 15px; }
.foot { padding: 8px 0 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 響應式 ---------- */
@media (min-width: 900px) {
	.actionbar { display: none !important; }
	body.has-bar { padding-bottom: 0; }
}
@media (max-width: 899px) {
	body:not([data-step="1"]) .intro { display: none; }
	.picker { grid-template-columns: 1fr; gap: 24px; }
	.times { border-top: 1px solid var(--border); padding-top: 20px; }
	.next-desktop { display: none; }
	.info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.page { padding-top: 18px; }
	.intro h1 { font-size: 24px; }
	.card { padding: 18px 14px; border-radius: 14px; }
	.chip-text { display: none; }
	.chip { padding: 0 11px; }
	.brand strong { font-size: 15px; }
	.cal-grid { gap: 3px; }
	.cal-cell { border-radius: 10px; }
	.cal-d { font-size: 15px; }
	.stepper li { font-size: 13px; }
	.ticket-date { width: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
