/* 春休みプラン一覧（学校 × 入校日 × 部屋タイプ）の部品。
   3つのUI案（カード型 / 一覧表型 / タイムライン型）で共通に使う。
   色は guide-common.css の :root 変数を再利用し、同じ色を別名で再定義しない。
   JS が動いているとき（.is-enhanced）だけ is-extra の日程を畳む。無効なら全日程が読める。 */

/* top-renewal.css の overflow:hidden は sticky の基準をページ本体に閉じ込める。
   clip は見た目のはみ出しを切りつつ、スクロールコンテナを作らない。 */
.season-spring-page { overflow: visible; overflow: clip; }

/* ---------- 絞り込みバー ---------- */

.sp-filter {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 18px 0 20px;
  padding: 14px 16px 12px;
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(45, 52, 54, 0.06);
}

.sp-filter__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.sp-filter__field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sp-filter__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--guide-muted);
}

.sp-filter select {
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--guide-border);
  border-radius: 10px;
  background: var(--guide-soft);
  color: var(--guide-ink);
  font-size: 0.95rem;
}

.sp-filter__reset {
  min-height: 42px;
  padding: 6px 14px;
  border: 1px solid var(--guide-border);
  border-radius: 10px;
  background: #fff;
  color: var(--guide-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.sp-filter__reset:hover { border-color: var(--guide-orange); color: var(--guide-orange-deep); }

.sp-filter__result {
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--guide-muted);
}

.sp-filter__result strong {
  font-size: 1.25rem;
  color: var(--guide-orange-deep);
}

.sp-filter__cond { margin-left: 6px; }

@media (min-width: 768px) {
  .sp-filter__grid { grid-template-columns: 1fr 1.4fr 1.4fr 1fr auto; }
}

/* ---------- 6期間の代表プラン切替 ---------- */

.sp-period-switch__sentinel {
  display: block;
  height: 1px;
  margin-top: 17px;
}

.sp-period-switch {
  position: static;
  top: var(--header-h, 60px);
  z-index: 15;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(45, 52, 54, 0.06);
  overflow-anchor: none;
}

.sp-period-switch__spacer {
  display: block;
  height: 0;
  overflow-anchor: none;
}

.sp-period-switch.is-stuck {
  position: sticky;
  box-shadow: 0 8px 22px rgba(45, 52, 54, 0.14);
}

.sp-period-switch__summary {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sp-period-switch__toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 30px 6px 11px;
  border: 1px solid var(--guide-border);
  border-radius: 10px;
  background: var(--guide-soft);
  color: var(--guide-ink);
  text-align: left;
  cursor: pointer;
}

.sp-period-switch__toggle span {
  color: var(--guide-muted);
  font-size: 0.72rem;
}

.sp-period-switch__toggle strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-period-switch__toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
}

.sp-period-switch__toggle[aria-expanded="true"] {
  border-color: var(--guide-orange);
  background: #fff7f3;
}

.sp-period-switch__toggle[aria-expanded="true"]::after {
  transform: translateY(-20%) rotate(-135deg);
}

.sp-period-switch.is-stuck .sp-period-switch__summary { display: grid; }
.sp-period-switch.is-stuck .sp-period-switch__panel { display: none; }
.sp-period-switch.is-stuck .sp-period-switch__panel.is-open { display: block; margin-top: 10px; }

.sp-period-switch__label {
  margin: 0 0 8px;
  color: var(--guide-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.sp-period-switch__buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sp-period-switch__panel--region {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--guide-border);
}

.sp-region-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sp-period-switch__button {
  min-width: 0;
  min-height: 40px;
  padding: 7px 5px;
  border: 1px solid var(--guide-border);
  border-radius: 999px;
  background: var(--guide-soft);
  color: var(--guide-ink);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.sp-region-button {
  min-width: 0;
  min-height: 40px;
  padding: 7px 6px;
  border: 1px solid var(--guide-border);
  border-radius: 10px;
  background: var(--guide-soft);
  color: var(--guide-ink);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 640px) {
  .sp-period-switch__buttons { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sp-region-buttons { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 980px) {
  .sp-period-switch { top: 0; }
}

.sp-period-switch__button:hover,
.sp-period-switch__button:focus-visible,
.sp-region-button:hover,
.sp-region-button:focus-visible { border-color: var(--guide-orange); }

.sp-period-switch__button.is-active,
.sp-region-button.is-active {
  border-color: var(--guide-orange);
  background: #fff1eb;
  color: var(--guide-orange-deep);
}

/* ---------- 共通：学校・日程・部屋 ---------- */

.sp-list { margin: 0; }

.sp-region-group + .sp-region-group { margin-top: 30px; }

.sp-region-group__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 22px 0 12px;
  padding: 7px 0 7px 12px;
  border-left: 4px solid var(--guide-gold);
  color: var(--guide-ink);
  font-size: 1.14rem;
  font-weight: 800;
  line-height: 1.4;
}

.sp-region-group__title span {
  color: var(--guide-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.sp-list__empty {
  margin: 20px 0;
  padding: 18px;
  border-radius: 12px;
  background: var(--guide-soft);
  color: var(--guide-muted);
  text-align: center;
}

.sp-list [hidden] { display: none !important; }
.sp-list .is-hidden { display: none !important; }
.sp-list.is-enhanced .sp-day.is-extra { display: none; }
.sp-list.is-enhanced .sp-school.is-open .sp-day.is-extra { display: block; }
.sp-list--table.is-enhanced .sp-school.is-open .sp-day.is-extra { display: table-row; }

.sp-school__pref {
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--guide-soft);
  color: var(--guide-muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.sp-school__name {
  margin: 4px 0 0;
  font-size: 1.12rem;
  line-height: 1.4;
}

.sp-school__name a { color: var(--guide-ink); text-decoration: none; }
.sp-school__name a:hover { color: var(--guide-orange-deep); text-decoration: underline; }

.sp-school__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--guide-muted);
}

.sp-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  padding: 8px 14px;
  border: 1px solid var(--guide-border);
  border-radius: 999px;
  background: #fff;
  color: var(--guide-ink);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.sp-more::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.sp-school.is-open .sp-more::after { transform: translateY(2px) rotate(-135deg); }
.sp-more:hover { border-color: var(--guide-orange); color: var(--guide-orange-deep); }
.sp-list:not(.is-enhanced) .sp-more { display: none; }

.sp-day__rep {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 8px 0 0;
}

.sp-day__rep-room { font-size: 0.88rem; color: var(--guide-muted); }

.sp-day__rep-price {
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--guide-orange-deep);
}

.sp-day__rep-price--unpub { font-size: 1.1rem; color: var(--guide-muted); }
.sp-day__tax { font-size: 0.74rem; color: var(--guide-muted); }

.sp-rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.sp-room {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--guide-border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.8rem;
  line-height: 1.35;
}

.sp-room.is-rep { border-color: var(--guide-orange); background: #fff7f3; }
.sp-room__name { color: var(--guide-muted); }
.sp-room__name small { display: block; font-size: 0.72rem; }
/* 注意事項欄から添える注記（例：女性限定のプラン） */
.sp-room__note { color: #b23a63; }
.sp-room__price { color: var(--guide-ink); font-size: 0.92rem; }
.sp-room.is-rep .sp-room__price { color: var(--guide-orange-deep); }

/* 宿舎の性別区分バッジ（男性専用／女性専用／男女共用） */
.sp-sex {
  display: inline-block;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.sp-sex--men { background: #e8f1fb; color: #2f5e9e; }
.sp-sex--women { background: #fbe8ef; color: #b23a63; }
.sp-sex--both { background: var(--guide-green-pale); color: #2f7a4d; }
.sp-sex[hidden] { display: none; }
.sp-day__rep .sp-sex { margin-right: 2px; }

.sp-day__unpub {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--guide-muted);
}

.sp-day__cta { margin: 12px 0 0; }

/* PCでも「他の部屋タイプ」の次の行に申込CTAを置く。 */
@media (min-width: 768px) {
  .sp-list--timeline .sp-day__cta {
    display: flex;
    width: fit-content;
    max-width: 100%;
  }
}

/* ---------- 案1・案3：学校カード ---------- */

.sp-list--card .sp-school,
.sp-list--timeline .sp-school {
  margin: 0 0 16px;
  padding: 16px 16px 14px;
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(45, 52, 54, 0.05);
  /* 画面外のカードはレイアウトを後回しにする（49校分の初回描画を軽くする） */
  content-visibility: auto;
  contain-intrinsic-size: auto 520px;
}

.sp-days {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.sp-list--card .sp-day,
.sp-list--timeline .sp-day {
  padding: 14px;
  border: 1px solid var(--guide-border);
  border-radius: 12px;
  background: var(--guide-soft);
}

.sp-list--card .sp-day + .sp-day,
.sp-list--timeline .sp-day + .sp-day { margin-top: 8px; }

.sp-list--card .sp-day.is-main,
.sp-list--timeline .sp-day.is-main {
  border-color: var(--guide-orange);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
}

.sp-day__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--guide-ink);
}

.sp-day__period {
  margin: 0 0 8px;
  color: var(--guide-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

/* 入校日 → 卒業予定日 の矢印は要素を増やさず擬似要素で出す */
.sp-day__grad::before {
  content: "→";
  margin-right: 8px;
  color: var(--guide-muted);
}

.sp-day__n {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--guide-gold-pale);
  color: var(--guide-gold-dark);
  font-size: 0.76rem;
}

/* 畳まれる側の日程は控えめに（同じ情報を持つが、代表より小さく） */
.sp-list--card .sp-day.is-extra .sp-day__rep-price,
.sp-list--timeline .sp-day.is-extra .sp-day__rep-price { font-size: 1.15rem; }

.sp-list--card .sp-day.is-extra .sp-room,
.sp-list--timeline .sp-day.is-extra .sp-room { padding: 4px 8px; font-size: 0.76rem; }

.sp-list--card .sp-day.is-extra .sp-day__cta,
.sp-list--timeline .sp-day.is-extra .sp-day__cta { margin-top: 8px; font-size: 0.86rem; padding: 8px 16px; }

/* 案3：部屋タイプは1列。クリックでそのプランを代表にでき、4つ目以降は「他の部屋タイプ」で開く */

.sp-list--timeline .sp-rooms {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.sp-list--timeline .sp-room {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.sp-list--timeline .sp-room:hover,
.sp-list--timeline .sp-room:focus-visible { border-color: var(--guide-orange); }

.sp-list--timeline .sp-room__name { flex: 1 1 auto; min-width: 0; }
.sp-list--timeline .sp-room__price { flex: 0 0 auto; font-size: 1rem; }
.sp-list--timeline .sp-room.is-rep .sp-room__price { font-size: 1.1rem; }
.sp-list--timeline.is-enhanced .sp-room.is-more { display: none; }
.sp-list--timeline.is-enhanced .sp-day.is-rooms-open .sp-room.is-more { display: flex; }

.sp-rooms-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  padding: 5px 12px;
  border: 1px solid var(--guide-border);
  border-radius: 999px;
  background: #fff;
  color: var(--guide-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.sp-rooms-more:hover { border-color: var(--guide-orange); color: var(--guide-orange-deep); }
.sp-list:not(.is-enhanced) .sp-rooms-more,
.sp-day.is-rooms-open .sp-rooms-more { display: none; }

/* ---------- 案2：一覧表 ---------- */

.sp-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  background: #fff;
}

.sp-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.sp-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 8px;
  border-bottom: 2px solid var(--guide-border);
  background: var(--guide-soft);
  color: var(--guide-muted);
  font-size: 0.78rem;
  text-align: left;
  white-space: nowrap;
}

.sp-table .sp-school__row th {
  padding: 12px 10px 8px;
  border-top: 6px solid var(--guide-soft);
  background: #fff;
  text-align: left;
}

.sp-table .sp-school__row .sp-school__name {
  display: inline-block;
  margin: 0 10px 0 6px;
  font-size: 1.02rem;
  color: var(--guide-ink);
  text-decoration: none;
}

.sp-table .sp-school__row .sp-school__name:hover { color: var(--guide-orange-deep); text-decoration: underline; }
.sp-table .sp-school__row .sp-school__meta { display: inline; margin: 0 8px 0 0; }
.sp-table .sp-more--inline { margin: 0; padding: 4px 12px; font-size: 0.8rem; }

.sp-table td {
  padding: 8px;
  border-top: 1px solid var(--guide-border);
  vertical-align: top;
}

.sp-table .sp-day.is-main td { background: #fff7f3; }
.sp-table .sp-day.is-main .sp-table__entry { font-weight: 700; }
.sp-table__school { display: none; }
.sp-table__entry, .sp-table__grad { white-space: nowrap; }
.sp-table__n { white-space: nowrap; color: var(--guide-muted); }

.sp-table .sp-room {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.sp-table .sp-room + .sp-room { margin-top: 4px; }
.sp-table .sp-room__price { font-size: 0.9rem; }
.sp-table__none { color: var(--guide-muted); }

.sp-day__cta--small {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--guide-orange);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.sp-day__cta--small:hover { background: var(--guide-orange-deep); }

/* ---------- 未発表校 ---------- */

.sp-unlisted {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.sp-unlisted__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 14px;
  border: 1px dashed var(--guide-border);
  border-radius: 12px;
  background: #fff;
  font-size: 0.88rem;
}

.sp-unlisted__pref {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--guide-soft);
  color: var(--guide-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.sp-unlisted__name { font-weight: 700; color: var(--guide-ink); }
.sp-unlisted__status { color: var(--guide-muted); font-size: 0.8rem; }
.sp-unlisted__cta { margin-left: auto; color: var(--guide-orange-deep); font-size: 0.8rem; white-space: nowrap; }

/* ---------- テストページ用：案の切替 ---------- */

.sp-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.sp-switch a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--guide-border);
  border-radius: 999px;
  color: var(--guide-ink);
  font-size: 0.84rem;
  text-decoration: none;
}

.sp-switch a[aria-current="page"] {
  border-color: var(--guide-orange);
  background: var(--guide-orange);
  color: #fff;
}

.sp-data-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--guide-soft);
  font-size: 0.82rem;
  color: var(--guide-muted);
  line-height: 1.7;
}

.sp-data-note p { margin: 0; }
.sp-data-note p + p { margin-top: 4px; }
