/* AFS Reservation Form
   色を変えたいときは、下の --afs-accent だけ書き換えれば全体に反映されます。 */

.afs-wrap,
.afs-calendar {
  --afs-accent: #1e3a5f;
  --afs-accent-soft: #eaf0f7;
  --afs-line: #d5dbe3;
  --afs-muted: #5b6472;
  --afs-err: #b3261e;
  --afs-ok: #1f6b4a;
}

.afs-wrap {
  max-width: 720px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.8;
  color: inherit;
}
.afs-wrap *,
.afs-wrap *::before,
.afs-wrap *::after { box-sizing: border-box; }
.afs-wrap [hidden] { display: none !important; }

/* ---------- 詳細・料金・注意点 ---------- */
.afs-info { margin: 0 0 48px; }
.afs-info-block { margin: 0 0 28px; }
.afs-info-title {
  margin: 0 0 10px;
  padding: 0 0 6px;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.5;
  border-bottom: 2px solid var(--afs-accent);
}
.afs-info p { margin: 0 0 8px; }
.afs-info-list { margin: 0 0 8px; padding: 0 0 0 1.2em; }
.afs-info-list li { margin: 0 0 2px; }
.afs-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95em;
}
.afs-info-table th,
.afs-info-table td {
  padding: 10px 12px;
  border: 1px solid var(--afs-line);
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}
.afs-info-table thead th { background: var(--afs-accent-soft); font-weight: 700; }
.afs-info-table tbody th { width: 6.5em; background: #f7f8fa; font-weight: 700; color: #1a1f2b; }
.afs-info-table td { color: inherit; }

/* ---------- フォーム ---------- */
.afs-form { position: relative; }
.afs-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.afs-group { margin: 0 0 40px; }
.afs-group-title {
  margin: 0 0 22px;
  padding: 0 0 6px;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.5;
  border-bottom: 2px solid var(--afs-accent);
}
.afs-row { margin: 0 0 22px; }
.afs-label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
}
.afs-req,
.afs-opt {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  font-size: .72em;
  font-weight: 700;
  line-height: 1.7;
  border-radius: 2px;
  vertical-align: .12em;
}
.afs-req { color: #fff; background: var(--afs-accent); }
.afs-opt { color: var(--afs-muted); background: #eceff3; }

.afs-input,
.afs-select,
.afs-textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* iOSの自動ズーム防止 */
  line-height: 1.5;
  color: #1a1f2b;
  background: #fff;
  border: 1px solid #98a2b1;
  border-radius: 3px;
  box-shadow: none;
}
.afs-textarea { min-height: 140px; resize: vertical; }
.afs-select { appearance: auto; }
.afs-input:focus,
.afs-select:focus,
.afs-textarea:focus {
  outline: 2px solid var(--afs-accent);
  outline-offset: 1px;
  border-color: var(--afs-accent);
}
.afs-date-view { cursor: pointer; background: #fff; }

.has-error > .afs-input,
.has-error > .afs-select,
.has-error > .afs-textarea,
.has-error .afs-choice-fields .afs-input,
.has-error .afs-choice-fields .afs-select { border-color: var(--afs-err); }
.afs-err {
  margin: 6px 0 0;
  font-size: .9em;
  color: var(--afs-err);
}

/* ---------- 希望日時 ---------- */
.afs-hint {
  margin: 0 0 12px;
  font-size: .9em;
  color: var(--afs-muted);
}
.afs-choice {
  margin: 0 0 14px;
  padding: 14px 16px 16px;
  border: 1px solid var(--afs-line);
  border-left: 4px solid var(--afs-accent);
  border-radius: 0 3px 3px 0;
}
.afs-choice.has-error { border-color: var(--afs-err); }
.afs-choice-title {
  margin: 0 0 8px;
  font-weight: 700;
}
.afs-choice-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 4.5em; /* 3列目は第1〜第3で同じ固定幅（クリア/空き枠） */
  gap: 10px;
  align-items: center;
}
.afs-clear-spacer { display: block; }
.afs-choice-fields > .afs-date { /* flatpickr が hidden にする元の input */
  min-width: 0;
}
.afs-clear {
  justify-self: end;
  padding: 8px 0;
  font: inherit;
  font-size: .9em;
  color: var(--afs-muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.afs-clear:hover { color: var(--afs-accent); }


/* ---------- 注意書き・確認画面 ---------- */
.afs-notebox {
  margin: 0 0 20px;
  padding: 12px 16px;
  font-size: .92em;
  line-height: 1.8;
  background: var(--afs-accent-soft);
  border-left: 4px solid var(--afs-accent);
}
.afs-confirm-lead { margin: 0 0 18px; }
.afs-confirm-list {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  margin: 0 0 24px;
  border-top: 1px solid var(--afs-line);
}
.afs-confirm-list dt,
.afs-confirm-list dd {
  margin: 0;
  padding: 12px 8px;
  border-bottom: 1px solid var(--afs-line);
  line-height: 1.7;
}
.afs-confirm-list dt { font-weight: 700; }
.afs-confirm-list dd { white-space: pre-line; overflow-wrap: anywhere; }
.afs-confirm-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 12px;
}
.afs-back,
.afs-send {
  min-height: 56px;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
}
.afs-back { color: var(--afs-accent); background: #fff; border: 1px solid var(--afs-accent); }
.afs-back:hover { background: var(--afs-accent-soft); }
.afs-send { color: #fff; background: var(--afs-accent); border: 0; font-size: 17px; }
.afs-send:hover { filter: brightness(1.12); }
.afs-back:disabled,
.afs-send:disabled { opacity: .6; cursor: wait; filter: none; }
.afs-back:focus-visible,
.afs-send:focus-visible { outline: 3px solid var(--afs-accent); outline-offset: 3px; }

/* ---------- 読み込み失敗の警告（JSが正常に動くと隠れる。読み込み待ちで一瞬出ないよう4秒後に表示） ---------- */
.afs-jscheck {
  margin: 0;
  padding: 0 16px;
  font-size: .92em;
  color: var(--afs-err);
  background: #fdf1f0;
  border-left: 4px solid var(--afs-err);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  animation: afs-jscheck-show .01s 4s forwards;
}
@keyframes afs-jscheck-show { to { opacity: 1; max-height: 20em; margin: 16px 0 0; padding: 12px 16px; } }
.afs-debug { margin: 12px 0 0; font: 12px/1.6 monospace; color: var(--afs-muted); word-break: break-all; }

/* ---------- 送信・結果 ---------- */
.afs-submit {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--afs-accent);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
.afs-submit:hover { filter: brightness(1.12); }
.afs-submit:focus-visible { outline: 3px solid var(--afs-accent); outline-offset: 3px; }
.afs-submit:disabled { opacity: .6; cursor: wait; filter: none; }

.afs-errors {
  margin: 0 0 24px;
  padding: 12px 16px;
  color: var(--afs-err);
  background: #fdf1f0;
  border-left: 4px solid var(--afs-err);
}
.afs-done {
  padding: 24px 22px;
  white-space: pre-line;
  background: #f1f8f4;
  border-left: 4px solid var(--afs-ok);
  outline: none;
}

@media (max-width: 520px) {
  .afs-confirm-list { grid-template-columns: 1fr; }
  .afs-confirm-list dt { padding-bottom: 0; border-bottom: 0; color: var(--afs-muted); font-size: .9em; }
  .afs-confirm-list dd { padding-top: 2px; }
  .afs-confirm-actions { grid-template-columns: 1fr; }
  .afs-send { order: -1; }
  .afs-choice-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .afs-clear { grid-column: 1 / -1; justify-self: start; }
  .afs-clear-spacer { display: none; }
  .afs-info-table th,
  .afs-info-table td { padding: 8px; }
  .afs-info-table tbody th { width: 5em; }
}

/* ---------- カレンダー（flatpickr）の見た目 ---------- */
.afs-calendar.flatpickr-calendar {
  font-family: inherit;
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(20, 30, 50, .18);
}
.afs-calendar .flatpickr-day.selected,
.afs-calendar .flatpickr-day.selected:hover,
.afs-calendar .flatpickr-day.today.selected {
  background: var(--afs-accent);
  border-color: var(--afs-accent);
  color: #fff;
}
.afs-calendar .flatpickr-day.today:not(.selected) { border-color: var(--afs-accent); }
.afs-calendar .flatpickr-day:hover:not(.selected):not(.flatpickr-disabled) {
  background: var(--afs-accent-soft);
  border-color: var(--afs-accent-soft);
}
.afs-calendar .flatpickr-day.flatpickr-disabled,
.afs-calendar .flatpickr-day.flatpickr-disabled:hover {
  color: #b9c0ca;
  background: transparent;
  text-decoration: line-through;
  text-decoration-color: #d3d8df;
  cursor: not-allowed;
}
/* 祝日・日曜・土曜の色 */
.afs-calendar .flatpickr-day.afs-holiday:not(.selected):not(.flatpickr-disabled) { color: #c0392b; font-weight: 700; }
.afs-calendar .flatpickr-day:not(.selected):not(.flatpickr-disabled):not(.prevMonthDay):not(.nextMonthDay):nth-child(7n+1) { color: #c0392b; }
.afs-calendar .flatpickr-day:not(.selected):not(.flatpickr-disabled):not(.prevMonthDay):not(.nextMonthDay):nth-child(7n) { color: #2b6cb0; }
.afs-calendar span.flatpickr-weekday:first-child { color: #c0392b; }
.afs-calendar span.flatpickr-weekday:last-child { color: #2b6cb0; }
