/* ============================================
   JDM Guide Tokyo — booking.css
   予約ページ専用スタイル
   ※ CSS変数は style.css から継承（再定義しない）
   ============================================ */

/* ------------------------------------------
   1. ページレイアウト
   ------------------------------------------ */

.booking-page {
  min-height: 100vh;
  padding-top: var(--nav-height);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Noto Sans JP', 'DM Sans', sans-serif;
}

.booking-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ------------------------------------------
   2. 戻るリンク
   ------------------------------------------ */

.booking-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 2rem;
  transition: color 0.3s var(--ease-cinema);
}

.booking-back::before {
  content: '←';
  font-size: 1rem;
  transition: transform 0.3s var(--ease-cinema);
}

.booking-back:hover {
  color: var(--text-secondary);
}

.booking-back:hover::before {
  transform: translateX(-3px);
}

/* ------------------------------------------
   3. ページヘッダー
   ------------------------------------------ */

.booking-page-header {
  text-align: center;
  margin-bottom: 0.75rem;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.booking-page-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

/* ------------------------------------------
   4. プログレスステッパー（ステップ 1/3〜3/3）
   ------------------------------------------ */

.booking-progress {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 0 1rem;
  position: relative;
  overflow: visible;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-width: 72px;
}

.progress-step::before {
  content: attr(data-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.4s var(--ease-cinema);
}

.progress-step span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.4s var(--ease-cinema);
}

.progress-step.is-active::before {
  border-color: var(--accent-red);
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 23, 68, 0.35);
}

.progress-step.is-active span {
  color: var(--text-primary);
}

.progress-step.is-completed::before {
  content: '✓';
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}

.progress-step.is-completed span {
  color: var(--text-secondary);
}

.progress-line {
  flex: 1;
  height: 2px;
  background: var(--border-subtle);
  align-self: center;
  margin-top: -10px;
  position: relative;
  min-width: 40px;
  max-width: 120px;
}

.progress-line.is-completed {
  background: #22c55e;
}

/* ------------------------------------------
   5. カレンダー
   ------------------------------------------ */

.tour-calendar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 2rem;
}

/* カレンダー内部 — JS (TourCalendar) が生成するクラスに合わせる */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.cal-month-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s var(--ease-cinema);
}

.cal-nav:hover:not(:disabled) {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(255, 23, 68, 0.08);
}

.cal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cal-weekend {
  color: var(--accent-red);
  opacity: 0.7;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: default;
  position: relative;
  transition: all 0.25s var(--ease-cinema);
  user-select: none;
  gap: 1px;
  padding: 2px;
}

.cal-day.cal-empty {
  visibility: hidden;
}

.cal-day.is-available {
  color: var(--text-primary);
  cursor: pointer;
  border-color: var(--border-subtle);
  background: var(--bg-elevated);
}

.cal-day.is-available:hover {
  border-color: var(--accent-red);
  background: rgba(255, 23, 68, 0.12);
  color: #fff;
  transform: scale(1.05);
}

.cal-day.is-selected {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(255, 23, 68, 0.3);
}

.cal-day.is-selected:hover {
  background: var(--accent-red-hover);
}

.cal-day.is-few {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.08);
}

.cal-day.is-few:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: var(--accent-orange);
}

.cal-day.is-full {
  color: var(--text-muted);
  opacity: 0.5;
  text-decoration: line-through;
  cursor: not-allowed;
}

.cal-day.is-disabled {
  color: rgba(100, 116, 139, 0.35);
  pointer-events: none;
  opacity: 0.3;
}

.cal-day-num {
  line-height: 1;
}

.cal-day-spots {
  font-size: 0.5625rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.cal-day.is-available .cal-day-spots {
  color: var(--text-muted);
}

.cal-day.is-few .cal-day-spots {
  color: var(--accent-orange);
}

.cal-day.is-selected .cal-day-spots {
  color: rgba(255, 255, 255, 0.8);
}

/* カレンダー凡例 */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.calendar-legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.calendar-legend .legend-available::before {
  background: var(--accent-red);
}

.calendar-legend .legend-few::before {
  background: var(--accent-orange);
}

.calendar-legend .legend-full::before {
  background: var(--text-muted);
  opacity: 0.5;
}

/* ------------------------------------------
   6. 選択サマリー
   ------------------------------------------ */

.date-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 2rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.date-summary .date-label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.date-summary .date-value {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.date-summary .date-spots {
  font-size: 0.8125rem;
  color: var(--accent-gold);
}

/* ------------------------------------------
   7. フォームフィールド
   ------------------------------------------ */

.booking-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.booking-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.booking-field input,
.booking-field select,
.booking-field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: 'Noto Sans JP', 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.3s var(--ease-cinema), box-shadow 0.3s var(--ease-cinema);
  -webkit-appearance: none;
  appearance: none;
}

.booking-field input::placeholder,
.booking-field textarea::placeholder {
  color: var(--text-muted);
}

.booking-field input:focus,
.booking-field select:focus,
.booking-field textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.booking-field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ------------------------------------------
   8. ゲスト人数セレクター
   ------------------------------------------ */

.guest-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-cinema);
}

.guest-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(255, 23, 68, 0.08);
}

.guest-btn.is-active {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.3);
}

/* ------------------------------------------
   9. 料金表示
   ------------------------------------------ */

.booking-price {
  text-align: center;
  padding: 1.25rem;
  margin-bottom: 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.booking-price .price-breakdown {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.booking-price .price-total {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

/* ------------------------------------------
   10. キャンセルポリシーカード
   ------------------------------------------ */

.cancel-policy {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cancel-policy-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.cancel-policy-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.cancel-policy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 0.8125rem;
}

.cancel-policy-item .policy-timing {
  color: var(--text-secondary);
}

.cancel-policy-item .policy-refund {
  font-weight: 600;
  color: var(--text-primary);
}

.cancel-policy-item .policy-refund.is-full {
  color: #22c55e;
}

.cancel-policy-item .policy-refund.is-partial {
  color: var(--accent-orange);
}

.cancel-policy-item .policy-refund.is-none {
  color: var(--accent-red);
}

.cancel-agree {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.cancel-agree input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  transition: all 0.25s var(--ease-cinema);
}

.cancel-agree input[type="checkbox"]:checked {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.cancel-agree input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.cancel-agree input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ------------------------------------------
   11. 送信セクション
   ------------------------------------------ */

.booking-submit {
  text-align: center;
  margin-bottom: 2rem;
}

.booking-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 2rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-red), #d50032);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-cinema);
  box-shadow:
    0 4px 24px rgba(255, 23, 68, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.booking-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-cinema);
}

.booking-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px rgba(255, 23, 68, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.booking-submit-btn:hover::before {
  transform: translateX(100%);
}

.booking-submit-btn:active {
  transform: translateY(0);
}

.booking-submit-btn:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.booking-submit-btn:disabled::before {
  display: none;
}

.booking-secure {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.booking-methods {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.booking-methods span {
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-elevated);
}

/* ------------------------------------------
   12. 予約完了（成功表示）
   ------------------------------------------ */

.booking-success {
  display: none;
  text-align: center;
  padding: 3rem 1.5rem;
}

.booking-success.is-visible {
  display: block;
  animation: fadeInUp 0.6s var(--ease-cinema) both;
}

.booking-success .success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  border: 2px solid #22c55e;
  font-size: 2rem;
  color: #22c55e;
  animation: scaleIn 0.5s var(--ease-cinema) 0.2s both;
}

.booking-success .success-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
}

.booking-success .success-message {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto;
}

.booking-success .success-details {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: left;
}

.booking-success .success-details dt {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.booking-success .success-details dd {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
}

.booking-success .success-details dd:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------
   12b. キャンセル通知
   ------------------------------------------ */

.booking-notice {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.booking-notice.is-warning {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid var(--accent-orange);
  color: var(--accent-orange);
}

/* ------------------------------------------
   13. ステップセクション表示制御
   ------------------------------------------ */

.booking-step-section {
  display: none;
}

.booking-step-section[hidden] {
  display: none;
}

.booking-step-section.is-active {
  display: block;
  animation: fadeInUp 0.5s var(--ease-cinema) both;
}

/* ------------------------------------------
   14. アニメーション
   ------------------------------------------ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ------------------------------------------
   15. レスポンシブ対応
   ------------------------------------------ */

/* タブレット以下 */
@media (max-width: 768px) {
  .booking-container {
    padding: 1.5rem 1rem 3rem;
  }

  .tour-calendar {
    padding: 1.125rem;
    border-radius: 12px;
  }

  .cal-grid {
    gap: 3px;
  }

  .cal-day {
    min-height: 44px;
    min-width: 0;
    font-size: 0.875rem;
    border-radius: 8px;
  }

  .guest-btn {
    width: 48px;
    height: 48px;
  }

  .cancel-policy-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* モバイル */
@media (max-width: 480px) {
  .booking-container {
    padding: 1rem 0.75rem 3rem;
  }

  .booking-page-header {
    font-size: 1.375rem;
  }

  .progress-step {
    min-width: 56px;
  }

  .progress-step::before {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .progress-step span {
    font-size: 0.625rem;
  }

  .cal-day {
    min-height: 44px;
    font-size: 0.8125rem;
  }

  .cal-day-spots {
    font-size: 0.5rem;
  }

  .cal-weekday {
    font-size: 0.625rem;
    height: 28px;
  }

  .booking-field input,
  .booking-field select,
  .booking-field textarea {
    font-size: 1rem; /* 16px — iOSのズーム防止 */
    padding: 0.875rem 1rem;
  }

  .booking-price .price-total {
    font-size: 1.375rem;
  }

  .booking-submit-btn {
    font-size: 0.875rem;
    padding: 0.875rem 1.5rem;
  }

  .booking-methods {
    flex-wrap: wrap;
  }

  .date-summary {
    flex-direction: column;
    text-align: center;
  }

  .calendar-legend {
    gap: 0.625rem;
    font-size: 0.6875rem;
  }
}

/* 大画面でのタッチターゲット確保 */
@media (pointer: coarse) {
  .cal-day {
    min-height: 48px;
  }

  .cal-nav {
    width: 44px;
    height: 44px;
  }

  .guest-btn {
    width: 56px;
    height: 56px;
  }

  .cancel-agree input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
}

/* ローディングスピナー (Stripe Checkout リダイレクト中) */
.booking-submit-btn.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.booking-submit-btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* プリファード・モーション対応 */
@media (prefers-reduced-motion: reduce) {
  .booking-step-section.is-active,
  .booking-success.is-visible,
  .booking-success .success-icon {
    animation: none;
  }

  .cal-day,
  .booking-submit-btn,
  .cal-nav,
  .guest-btn,
  .booking-back::before {
    transition: none;
  }
}
