/* ============================================================
   appointment component styles
   prefix: smaluna_appt__
   ============================================================ */

.smaluna_appt__root {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: #333333;
  box-sizing: border-box;
  padding: 24px 16px 48px;
  max-width: 768px;
  min-height: calc(-60px + 100svh);
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* スクロール領域の高さ計算用。
     --slot-h は時間枠1行の高さ。
     --head-h（年月行+日付行の合計）と --month-h（年月行の高さ）は
     描画後に JS が実測して上書きする。ここの値は初期表示用のフォールバック。
     常に5枠だけ見えるよう height = head + slot*5 とする。 */
  --slot-h: 38px;
  --head-h: 77px;
  --month-h: 32px;
}

.smaluna_appt__root *,
.smaluna_appt__root *::before,
.smaluna_appt__root *::after {
  box-sizing: inherit;
  font-weight: inherit;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
}

.smaluna_appt__top-section {
  margin-inline: 0px;
  margin-bottom: 0px;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
}

.smaluna_appt__subject {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
  padding: 0.75rem;
  -webkit-box-align: center;
  align-items: center;
  background: #FFFFFF;
}

.smaluna_appt__subject-label {
  font-size: 14px;
  line-height: 170%;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin: 0;
}

.smaluna_appt__subject-value {
  font-size: 14px;
  line-height: 170%;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  text-align: right;
  margin: 0;
}

/* ===== 初診・再診選択 ===== */
.smaluna_appt__visit-group {
  margin-top: 1px;
  margin-inline: 0px;
  margin-bottom: 0px;
  background: #FFFFFF;
}

.smaluna_appt__visit-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

/* ラジオ input を視覚的に非表示（アクセシビリティ維持） */
.smaluna_appt__visit-label input[type="radio"] {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  width: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  position: absolute;
}

.smaluna_appt__radio-inner {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  flex-direction: row;
  padding: 0.75rem;
}

.smaluna_appt__radio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.smaluna_appt__radio-text {
  font-size: 14px;
  color: #333;
  margin-left: 7px;
}

/* ===== 現在の空き状況バー（左寄せ・スクロール領域の外で常時表示） ===== */
.smaluna_appt__status-bar {
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: #333;
  text-align: center;
}

.smaluna_appt__status-text {
  font-weight: 400;
  font-size: 10px;
}

/* ===== カレンダースクロール領域（常に5枠分の高さに固定） ===== */
.smaluna_appt__cal-scroll {
  /* sticky なヘッダー2行 + 枠5行分の高さに固定。中の96枠は縦スクロール。 */
  height: calc(var(--head-h) + var(--slot-h) * 5);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ===== カレンダーテーブル ===== */
.smaluna_appt__cal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* 時刻列を固定幅にし、残り7列を均等割りする */
.smaluna_appt__cal-table col,
.smaluna_appt__th-empty-wide,
.smaluna_appt__td-time {
  width: 42px;
}

/* ヘッダー: 年月行 / 日付行を sticky 固定 */
.smaluna_appt__cal-table thead th {
  position: sticky;
  z-index: 2;
}
.smaluna_appt__cal-table thead tr:first-child th {
  top: 0;
}
.smaluna_appt__cal-table thead tr:nth-child(2) th {
  /* 年月行の実高さ分だけ下げて2段目（日付行）を固定（JS が --month-h を実測）。 */
  top: var(--month-h);
}

.smaluna_appt__th-empty-wide {
  background: #F2F2F2;
  border-top-width: 0px;
  border-left-width: 1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
  border-color: #E0E0E0;
  border-style: solid;
  /* 時刻列はヘッダー左上で縦横とも固定 */
  position: sticky;
  left: 0;
  z-index: 3;
}

.smaluna_appt__th-month {
  background: #fff;
  padding: 0.25rem 0.3rem;
  /* text-align: start; */
  border-color: #E0E0E0;
  border-style: solid;
  border-width: 0px 1px 1px 0px;
}

.smaluna_appt__th-month-text {
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0;
  color: #6F6D6C;
  font-weight: 500;
  margin: 0;
  /* 狭い列（例: 5/31 始まりで「2026年5月」が1列分しか無い場合）でも
     文字が切れないよう、年/月の区切りで自然に折り返す。
     高さは JS が --month-h/--head-h を実測して追従するためレイアウトは崩れない。 */
  white-space: normal;
  overflow-wrap: anywhere;
}

.smaluna_appt__th-date {
  text-align: center;
  padding: 4px 1px 6px;
  background: #fff;
  border-style: solid;
  border-color: #E0E0E0;
  border-width: 0px 1px 1px 0px;
}

.smaluna_appt__date-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.smaluna_appt__date-day {
  font-size: 11px;
  line-height: 130%;
  letter-spacing: 0;
  font-weight: 700;
  color: #4A5568;
}

.smaluna_appt__date-weekday {
  font-size: 10px;
  line-height: 130%;
  letter-spacing: 0;
  font-weight: 700;
  color: #4A5568;
}

.smaluna_appt__date-day--sat { color: #4a90d9; }
.smaluna_appt__date-weekday--sat { color: #4a90d9; }
.smaluna_appt__date-day--sun { color: #e05252; }
.smaluna_appt__date-weekday--sun { color: #e05252; }

/* 時間ラベル列（横スクロール時も左端で固定） */
.smaluna_appt__td-time {
  height: var(--slot-h);
  background-color: #96A2F3;
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
  letter-spacing: 0;
  padding: 0 2px;
  font-size: 11px;
  color: #FFFFFF;
  border-color: #E0E0E0;
  border-width: 0px 1px 1px;
  border-style: solid;
  position: sticky;
  left: 0;
  z-index: 1;
}

.smaluna_appt__td-time--first {
  font-weight: 700;
}

/* スロットセル */
.smaluna_appt__td-slot {
  height: var(--slot-h);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  border-color: #E0E0E0;
  border-width: 0px 1px 1px 0px;
  border-style: solid;
}

.smaluna_appt__td-slot--circle { background-color: #FFFFFF; }
.smaluna_appt__td-slot--triangle { background-color: #FFFFFF; }
.smaluna_appt__td-slot--dash { background-color: #F2F2F2; opacity: 0.4; }
.smaluna_appt__td-slot--cross { background-color: #F2F2F2; opacity: 0.4; }

/* スロットボタン共通 */
.smaluna_appt__slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--slot-h);
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s;
  text-decoration: none;
}

.smaluna_appt__slot-btn svg {
  width: 15px;
  height: 15px;
}

/* 空きなしスロット */
.smaluna_appt__slot-btn--empty {
  background: transparent;
  cursor: default;
}

/* ===== 狭幅デバイス（〜393px 目安）向け微調整 ===== */
@media (max-width: 400px) {
  .smaluna_appt__root {
    --slot-h: 34px;
    padding: 12px 6px 24px;
  }
  .smaluna_appt__th-empty-wide,
  .smaluna_appt__td-time {
    width: 38px;
  }
  .smaluna_appt__td-time {
    font-size: 10px;
  }
  .smaluna_appt__slot-btn svg {
    width: 14px;
    height: 14px;
  }
}
