/* =========================================================
 * 한스헬스케어 예약 페이지 공통 스타일
 * 모바일 우선, Bootstrap 5 위에 덮어쓰는 방식
 * ========================================================= */

:root {
    --brand: #41BB19;          /* 사이트 브랜드 녹색 */
    --brand-dark: #2B7F10;     /* 버튼 배경 (흰 글자 대비 확보) */
    --brand-ink: #236A0C;      /* 강조 글자 */
    --brand-tint: #F2F8EF;     /* 페이지 바탕, 선택 배경 */
    --surface: #FFFFFF;
    --ink: #1F2A1C;
    --muted: #6B7568;
    --line: #DCE6D7;
    --line-strong: #C3D2BC;
    --danger: #D0342C;
    --danger-tint: #FDF1F0;
    --radius: 14px;
    --radius-sm: 10px;
    --focus: 0 0 0 3px rgba(65, 187, 25, 0.35);
    --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
            "Malgun Gothic", "Noto Sans KR", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--brand-tint);
    word-break: keep-all;
}

a { color: var(--brand-ink); }

[hidden] { display: none !important; }

/* ---------- 헤더 ---------- */
.site-header {
    background: var(--surface);
    border-top: 4px solid var(--brand);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--brand-ink);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.header-call {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    min-height: 40px;
}
.header-call i { color: var(--brand-dark); }
.header-call:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- 페이지 ---------- */
.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 0;
}

.intro { padding: 4px 4px 20px; }
.intro__title {
    font-size: 1.625rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
}
.intro__lead {
    color: var(--muted);
    margin: 0;
    max-width: 36em;
}

.notice {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 0.9375rem;
}
.notice--error { background: var(--danger-tint); color: var(--danger); border: 1px solid #F3C9C5; }
.notice--info  { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* ---------- 섹션 패널 ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 16px 8px;
    margin-bottom: 16px;
}
.panel__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}
.step {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 입력 필드 ---------- */
.field { margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
.field__label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.req { color: var(--danger); margin-left: 2px; }
.field__help {
    font-size: 0.8125rem;
    color: var(--muted);
    margin: 6px 0 0;
}
.field__help ul { margin: 0; padding-left: 1.1em; }
.field__error {
    display: none;
    font-size: 0.8125rem;
    color: var(--danger);
    margin: 6px 0 0;
    font-weight: 500;
}
.has-error > .field__error,
.has-error .field__error { display: block; }

.input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font: inherit;
    font-size: 16px;               /* iOS 확대 방지 */
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
input[type="date"].input { line-height: 1.2; }
.input::placeholder { color: #A3AC9F; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.has-error .input { border-color: var(--danger); background: var(--danger-tint); }

.grid-2 { display: grid; grid-template-columns: 1fr; column-gap: 12px; }
@media (min-width: 576px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- 예약날짜 달력 ---------- */
.date-wrap { position: relative; }
.date-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    cursor: pointer;
}
.date-trigger i { color: var(--brand-dark); }
.date-trigger__text.is-empty { color: #A3AC9F; }
.date-trigger[aria-expanded="true"] { border-color: var(--brand); box-shadow: var(--focus); }

.cal {
    position: absolute;
    z-index: 30;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 280px;
    max-width: 360px;
    margin-top: 4px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(31, 42, 28, 0.16);
}
.cal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.cal__title { font-size: 1rem; font-weight: 700; }
.cal__nav {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.cal__nav:disabled { opacity: 0.3; cursor: default; }
.cal__nav:focus-visible { outline: none; box-shadow: var(--focus); }
.cal__week, .cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}
.cal__week { font-size: 0.8125rem; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal__grid { gap: 2px; }
.cal__day {
    aspect-ratio: 1 / 1;
    min-height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.cal__week .is-sun, .cal__day.is-sun { color: var(--danger); }
.cal__week .is-sat, .cal__day.is-sat { color: #2F6FB0; }
.cal__day:hover:not(:disabled) { background: var(--brand-tint); }
.cal__day.is-today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.cal__day.is-selected { background: var(--brand-dark); color: #fff; }
.cal__day:disabled { color: #C9D1C5; cursor: default; }
.cal__day:focus-visible { outline: none; box-shadow: var(--focus); }

/* 숨겨진 선택 입력 (라디오·체크박스) - 키보드 접근은 유지 */
.seg input, .product input, .chip input, .choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* ---------- 두 개 중 선택 (성별, 위내시경) ---------- */
.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
}
.seg { position: relative; margin: 0; cursor: pointer; }
.seg span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-weight: 600;
    background: var(--surface);
    transition: background .15s, border-color .15s, color .15s;
    text-align: center;
}
.seg input:checked + span { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.has-error .seg span { border-color: var(--danger); }

/* ---------- 검진상품 카드 ----------
 * 구조: label.product > input + span.product__card
 * (:has() 미지원 브라우저도 선택 상태가 보이도록 형제 선택자 사용) */
.product-list { display: grid; gap: 10px; }
.product { position: relative; display: block; margin: 0; cursor: pointer; }
.product__card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.product__card::before {
    content: "";
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.product__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.product__name { font-weight: 700; font-size: 1rem; }
.product__desc { font-size: 0.8125rem; color: var(--muted); }
.product__price {
    flex: none;
    font-weight: 800;
    font-size: 1.125rem;
    color: var(--brand-ink);
    letter-spacing: -0.02em;
}
.product input:checked + .product__card {
    border-color: var(--brand-dark);
    background: var(--brand-tint);
    box-shadow: inset 0 0 0 1px var(--brand-dark);
}
.product input:checked + .product__card::before {
    border-color: var(--brand-dark);
    box-shadow: inset 0 0 0 5px var(--brand-dark);
}
.product input:focus-visible + .product__card { box-shadow: var(--focus); }
.has-error .product__card { border-color: var(--danger); }

/* ---------- 선택검진 그룹 ---------- */
.opt-group {
    margin: 16px 0 18px;
    padding: 16px 14px 12px;
    border-radius: var(--radius-sm);
    background: var(--brand-tint);
    border: 1px solid var(--line);
}
.opt-group__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 12px;
}
.opt-group__title { font-weight: 700; font-size: 1rem; }
.opt-group__rule { font-size: 0.875rem; color: var(--muted); }
.opt-group__count {
    margin-left: auto;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 10px;
    font-variant-numeric: tabular-nums;
}
.opt-group.is-complete .opt-group__count {
    color: #fff;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}
.opt-group__full {
    display: none;
    font-size: 0.8125rem;
    color: var(--muted);
    margin: -4px 0 10px;
}
.opt-group.is-complete .opt-group__full { display: block; }
.opt-group.has-error { border-color: var(--danger); background: var(--danger-tint); }
.opt-group__note {
    font-size: 0.8125rem;
    color: var(--brand-ink);
    font-weight: 600;
    margin: -4px 0 10px;
}
.opt-group.is-locked { opacity: 0.55; }
.opt-group.is-locked .opt-group__count::after { content: " (선택 안 함)"; font-weight: 500; }
.opt-either { margin: 16px 0 0; font-size: 0.875rem; }

/* 구조: label.chip > input + span.chip__card > span.chip__box + span.chip__text */
.chips { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 360px) {
    .chips { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
    .panel { padding-left: 12px; padding-right: 12px; }
    .opt-group { padding-left: 8px; padding-right: 8px; }
    .chip__card { padding: 10px 8px; gap: 6px; }
    .chip__box { width: 20px; height: 20px; }
    .chip input:checked + .chip__card .chip__box::after { left: 4px; top: 0; }
    .chip__label { font-size: 0.875rem; overflow-wrap: anywhere; }
}
.chip { position: relative; display: block; margin: 0; cursor: pointer; }
.chip__card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    height: 100%;
    padding: 12px;
    min-height: 48px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, opacity .15s;
}
.chip__box {
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 6px;
    border: 2px solid var(--line-strong);
    background: var(--surface);
    position: relative;
    transition: background .15s, border-color .15s;
}
.chip__text { display: flex; flex-direction: column; min-width: 0; }
.chip__label { font-weight: 600; font-size: 0.9375rem; line-height: 1.4; }
.chip__desc { font-size: 0.8125rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.chip input:checked + .chip__card { border-color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand-dark); }
.chip input:checked + .chip__card .chip__box { background: var(--brand-dark); border-color: var(--brand-dark); }
.chip input:checked + .chip__card .chip__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 7px;
    height: 12px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}
.chip input:focus-visible + .chip__card { box-shadow: var(--focus); }
.chip input:disabled + .chip__card { opacity: 0.45; cursor: not-allowed; }

/* ---------- 택배 정보 ---------- */
.delivery {
    margin: 4px 0 18px;
    padding: 16px 14px 2px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line-strong);
    background: #FAFCF9;
}
.delivery__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.delivery__title i { color: var(--brand-dark); }
.delivery__lead { font-size: 0.8125rem; color: var(--muted); margin: 0 0 14px; }

/* ---------- 목록형 선택 (검진결과) ----------
 * 구조: label.choice > input + span.choice__card */
.choice-list { display: grid; gap: 8px; }
.choice { position: relative; display: block; margin: 0; cursor: pointer; }
.choice__card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, background .15s;
}
.choice__card::before {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
}
.choice__label { flex: 1; font-weight: 600; }
.choice__extra { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.choice input:checked + .choice__card { border-color: var(--brand-dark); background: var(--brand-tint); }
.choice input:checked + .choice__card::before { border-color: var(--brand-dark); box-shadow: inset 0 0 0 4px var(--brand-dark); }
.choice input:focus-visible + .choice__card { box-shadow: var(--focus); }
.has-error .choice__card { border-color: var(--danger); }

/* ---------- 하단 고정 버튼 ---------- */
.action-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 0 -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: saturate(1.2) blur(6px);
    -webkit-backdrop-filter: saturate(1.2) blur(6px);
}
@media (min-width: 760px) {
    .action-bar { margin: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
}

.btn-main, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 12px 20px;
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-main { background: var(--brand-dark); color: #fff; border: 1px solid var(--brand-dark); }
.btn-main:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-main:disabled { background: #A9B8A3; border-color: #A9B8A3; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-main:focus-visible, .btn-ghost:focus-visible { outline: none; box-shadow: var(--focus); }

/* 스팸 방지용 숨김 입력 */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 확인 모달 ---------- */
.confirm-modal .modal-content { border: 0; border-radius: var(--radius); font-family: var(--font); }
.confirm-modal .modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; }
.confirm-modal .modal-title { font-weight: 800; font-size: 1.1875rem; letter-spacing: -0.02em; }
.confirm-modal .modal-body { padding: 16px 20px; }
.confirm-modal .modal-footer {
    border-top: 1px solid var(--line);
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 10px;
}
.confirm-modal .modal-footer > * { margin: 0; }
@media (max-width: 575.98px) {
    .confirm-modal .modal-content { border-radius: 0; }
}
.confirm-lead { color: var(--muted); margin: 0 0 14px; }

.confirm-list { margin: 0; }
.confirm-section {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--brand-ink);
    padding: 14px 0 6px;
    border-bottom: 2px solid var(--brand);
}
.confirm-section:first-child { padding-top: 0; }
.confirm-row {
    display: grid;
    grid-template-columns: 7.5em 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.confirm-row dt { font-weight: 500; color: var(--muted); font-size: 0.9375rem; }
.confirm-row dd { margin: 0; font-weight: 600; white-space: pre-wrap; word-break: break-all; }

/* ---------- 완료 페이지 ---------- */
.done { text-align: center; padding: 32px 20px 24px; }
.done__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.done__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 8px; }
.done__ref {
    display: inline-block;
    margin: 4px 0 0;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--brand-tint);
    font-weight: 700;
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
}
.next-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.next-steps li {
    position: relative;
    padding: 0 0 18px 44px;
    counter-increment: s;
}
.next-steps li::before {
    content: counter(s);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--brand);
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.next-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: 4px;
    width: 2px;
    background: var(--line);
}
.next-steps strong { display: block; }
.next-steps span { color: var(--muted); font-size: 0.9375rem; }
.btn-row { display: grid; gap: 10px; padding-bottom: 32px; }

.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8125rem;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 576px) {
    .page { padding-top: 36px; }
    .intro__title { font-size: 2rem; }
    .panel { padding: 24px 24px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
