/*
  患者ポータル（Web予約）のスタイル。患者がスマートフォンで使う前提（片手・大きめの文字と押しやすいボタン）。
  色・余白・角丸はここのトークンだけを使う。アクセントは医院向けの画面と同じ色相。
*/
:root {
    color-scheme: light;
    --accent: #00838f;
    --accent-text: #ffffff;
    --surface: #ffffff;
    --page: #f3f5f6;
    --text: #1b1b1b;
    --text-secondary: #5f6368;
    --line: #c9cfd3;
    --error-surface: #fde7e9;
    --error-text: #8a1c1c;
    --success-surface: #dff6dd;
    --success-text: #0e5a0e;
    --danger: #b3261e;
    --danger-text: #ffffff;
    --saturday: #1565c0;
    --sunday: #c62828;
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-24: 24px;
    --radius-control: 6px;
    --radius-surface: 10px;
    --font-body: 1rem;
    --font-caption: 0.875rem;
    --font-title: 1.25rem;
    --control-min-height: 48px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --accent: #4fc3cf;
        --accent-text: #0b1f22;
        --surface: #1f2224;
        --page: #17191a;
        --text: #e8eaed;
        --text-secondary: #a9b0b5;
        --line: #3c4246;
        --error-surface: #442726;
        --error-text: #ffb4ab;
        --success-surface: #1e3a1e;
        --success-text: #a6e3a1;
        --danger: #f2b8b5;
        --danger-text: #601410;
        --saturday: #90caf9;
        --sunday: #ef9a9a;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --accent: #4fc3cf;
    --accent-text: #0b1f22;
    --surface: #1f2224;
    --page: #17191a;
    --text: #e8eaed;
    --text-secondary: #a9b0b5;
    --line: #3c4246;
    --error-surface: #442726;
    --error-text: #ffb4ab;
    --success-surface: #1e3a1e;
    --success-text: #a6e3a1;
    --danger: #f2b8b5;
    --danger-text: #601410;
    --saturday: #90caf9;
    --sunday: #ef9a9a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
    font-size: var(--font-body);
    line-height: 1.6;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: var(--space-12) var(--space-16);
}

.site-title {
    font-weight: 600;
}

.site-main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-16);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-surface);
    padding: var(--space-24) var(--space-16);
}

h1 {
    font-size: var(--font-title);
    margin: 0 0 var(--space-12);
}

p {
    margin: 0 0 var(--space-12);
}

.lead {
    color: var(--text-secondary);
}

.caption {
    color: var(--text-secondary);
    font-size: var(--font-caption);
}

.notice {
    border-radius: var(--radius-control);
    padding: var(--space-12);
}

.notice.error {
    background: var(--error-surface);
    color: var(--error-text);
}

.notice.success {
    background: var(--success-surface);
    color: var(--success-text);
}

.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
    margin-bottom: var(--space-16);
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.field-label {
    font-weight: 600;
    padding: 0;
}

/* 文字の入力欄（BlazorのInputTextはtype属性を付けないので、typeの無いinputも含める） */
input:not([type]),
input[type="text"],
input[type="tel"],
input[type="email"] {
    min-height: var(--control-min-height);
    width: 100%;
    padding: var(--space-8) var(--space-12);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    /* iOSで拡大されないよう16px以上 */
    font-size: max(1rem, 16px);
}

input:not([type]):focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.birth {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-8);
}

.birth label {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
}

/* 年・月・日の欄は、横の「年」「月」「日」の文字ぶんだけ縮める（幅100%のままだと文字が枠の外へはみ出す） */
.birth input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.birth span {
    flex: none;
}

.button,
.button-primary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-min-height);
    padding: var(--space-8) var(--space-16);
    border-radius: var(--radius-control);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

.button-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--danger-text);
}

.button:focus-visible,
.button-primary:focus-visible,
.button-danger:focus-visible,
.button-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.button-link {
    background: none;
    border: 0;
    padding: var(--space-8) 0;
    color: var(--accent);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.patient {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-8);
    margin-bottom: var(--space-16);
}

.patient-name {
    font-weight: 600;
}

.appoint-list {
    list-style: none;
    margin: 0 0 var(--space-16);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.appoint {
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    padding: var(--space-12);
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.appoint-date {
    font-weight: 600;
}

.appoint-confirm {
    margin-bottom: var(--space-16);
}

.actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.signout {
    border-top: 1px solid var(--line);
    padding-top: var(--space-8);
}

/* 新患の予約（メニュー・日時・情報・確認コード） */
h2 {
    font-size: var(--font-body);
    margin: var(--space-16) 0 var(--space-8);
}

.card-spaced {
    margin-bottom: var(--space-16);
}

.step {
    color: var(--text-secondary);
    font-size: var(--font-caption);
    margin-bottom: var(--space-4);
}

.summary {
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: var(--space-8);
}

.choice-list {
    list-style: none;
    margin: 0 0 var(--space-16);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.choice-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-12);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    color: var(--text);
    text-decoration: none;
}

.choice-item:hover,
.choice-item:focus-visible {
    border-color: var(--accent);
}

.choice-title {
    font-weight: 600;
}

.choice-guide {
    white-space: pre-line;
}

.optional {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: var(--font-caption);
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-24);
}

.radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-8);
    min-height: var(--control-min-height);
}

.radio input {
    width: 20px;
    height: 20px;
}

.resend {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-16);
}

/* 新患の予約の日時（1週間分の表。列＝日にち、行＝時刻） */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.week-nav .button {
    min-height: 40px;
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-caption);
}

.week-range {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    text-align: center;
}

[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

.slot-grid-wrap {
    margin-bottom: var(--space-8);
}

.slot-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--font-caption);
}

.slot-grid th,
.slot-grid td {
    border: 1px solid var(--line);
    text-align: center;
    padding: 0;
}

.slot-grid thead th {
    position: sticky;
    top: 0;
    background: var(--page);
    padding: var(--space-4) 0;
    font-weight: 600;
    line-height: 1.3;
}

.slot-grid .slot-time {
    width: 3.2em;
    background: var(--page);
    font-weight: 400;
    color: var(--text-secondary);
}

.slot-day,
.slot-weekday {
    display: block;
}

.slot-weekday {
    font-weight: 400;
}

.slot-saturday {
    color: var(--saturday);
}

.slot-sunday {
    color: var(--sunday);
}

.slot-grid td {
    height: 40px;
}

.slot-none {
    color: var(--text-secondary);
    background: var(--page);
}

.slot-full {
    color: var(--text-secondary);
}

.slot-open a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 40px;
    color: var(--accent);
    font-size: var(--font-body);
    font-weight: 600;
    text-decoration: none;
}

.slot-open a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.slot-selected {
    background: var(--accent);
}

.slot-selected a {
    color: var(--accent-text);
}

.confirm-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    margin: var(--space-16) 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
