/* ============================================================
   Studio DOWHA Reserve — Frontend Styles（1ページ縦スクロール型）
   ============================================================ */

/* テーマの [hidden] 上書き対策 */
#sdr-reserve-app [hidden] { display: none !important; }

/* ── ベース ──────────────────────────────────────────────── */
.sdr-reserve {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: #1a1a1a;
  padding-bottom: 80px;
}

/* ── 2カラムレイアウト ──────────────────────────────────── */
.sdr-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (max-width: 860px) {
  .sdr-layout    { grid-template-columns: 1fr; row-gap: 0; }
  /* メインとサイドバーの中身を親グリッドに直接並べ、
     空き状況カレンダーを「① スタジオを選択」の直後・予約サマリーを最下部に配置する */
  .sdr-main,
  .sdr-sidebar   { display: contents; }
  .sdr-main > *  { order: 3; }
  #sdr-sec1      { order: 1; }
  .sdr-gcal-card { order: 2; margin: 24px 0 0; }
  .sdr-side-card:not(.sdr-gcal-card) { order: 10; margin-top: 32px; }
}

/* ── セクション ──────────────────────────────────────────── */
.sdr-section {
  padding: 32px 0;
  border-bottom: 1px solid #e5e7eb;
  transition: opacity 0.3s;
}

.sdr-section:last-child { border-bottom: none; }

.sdr-section--locked {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.sdr-section--locked .sdr-section-body { display: none; }
.sdr-section--locked .sdr-lock-msg     { display: block; }

.sdr-lock-msg {
  display: none;
  padding: 14px 18px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  margin-top: 16px;
}

/* セクションヘッダー */
.sdr-section-hd {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

/* タイトルエリアをセクション幅いっぱいに広げる */
.sdr-section-hd > div {
  flex: 1;
  min-width: 0;
}

.sdr-section-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin-bottom: 15px;
  border-radius: 50%;
  background: #d1d5db;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.sdr-section--done .sdr-section-num { background: #22c55e; }

.sdr-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 10px;
  padding: 10px 16px;
  background: #fdf8ef;
  border-left: 4px solid #c8a45c;
  border-radius: 0 4px 4px 0;
}

.sdr-section-desc {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* ── スタジオカード ─────────────────────────────────────── */
.sdr-studio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) { .sdr-studio-cards { grid-template-columns: 1fr; } }

.sdr-studio-card {
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sdr-studio-card:hover { border-color: #9ca3af; }

.sdr-studio-card--selected {
  border-color: #1a1a1a;
  box-shadow: 0 0 0 2px rgba(26,26,26,0.08);
}

.sdr-studio-card__name    { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.sdr-studio-card__address { font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.sdr-studio-card__check   { font-size: 12px; color: #1a1a1a; font-weight: 700; opacity: 0; transition: opacity 0.2s; }
.sdr-studio-card--selected .sdr-studio-card__check { opacity: 1; }

/* ── プランカード ───────────────────────────────────────── */
.sdr-plan-grid {
  display: grid;
  grid-template-columns: repeat( auto-fit, minmax( 260px, 1fr ) );
  gap: 14px;
}

.sdr-plan-card {
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.sdr-plan-card:hover { border-color: #9ca3af; }
.sdr-plan-card--selected { border-color: #1a1a1a; background: #f9fafb; }

/* バッジ（即時予約／承認制）は右上に重ねて置き、説明文はカード幅いっぱいに使う */
.sdr-plan-card__inner  { display: block; }
.sdr-plan-card__info   { flex: 1; }
.sdr-plan-card__name   { font-weight: 700; font-size: 14px; display: block; margin-bottom: 4px; padding-right: 72px; }
.sdr-plan-card__desc   { font-size: 12px; color: #6b7280; display: block; line-height: 1.5; margin-bottom: 6px; }
.sdr-plan-card__hours  { font-size: 11px; color: #9ca3af; display: block; }
.sdr-plan-card__review,
.sdr-plan-card__instant { position: absolute; top: 16px; right: 14px; }
.sdr-plan-card__review  { font-size: 11px; color: #b45309; background: #fef3c7; padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.sdr-plan-card__instant { font-size: 11px; color: #065f46; background: #d1fae5; padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }

.sdr-field-hint { font-size: 12px; color: #b45309; background: #fef3c7; padding: 6px 10px; border-radius: 4px; margin: 4px 0 8px; }

/* ── カレンダー ─────────────────────────────────────────── */
.sdr-calendar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  max-width: 380px;
  margin-bottom: 24px;
}

.sdr-cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.sdr-cal-title { font-weight: 700; font-size: 16px; }

.sdr-cal-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.sdr-cal-btn:hover { background: #f3f4f6; }

.sdr-cal-wk {
  display: grid;
  grid-template-columns: repeat( 7, 1fr );
  text-align: center;
  margin-bottom: 6px;
}

.sdr-cal-wk span { font-size: 11px; font-weight: 600; color: #9ca3af; padding: 4px 0; }
.sdr-cal-wk span.sun { color: #ef4444; }
.sdr-cal-wk span.sat { color: #3b82f6; }

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

.sdr-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: background 0.15s;
}

.sdr-cal-day:hover:not([disabled]):not(.sdr-cal-day--empty) { background: #f3f4f6; }
.sdr-cal-day--selected  { background: #1a1a1a !important; color: #fff !important; font-weight: 700; }
.sdr-cal-day--past      { color: #d1d5db; cursor: not-allowed; }
.sdr-cal-day--blocked   { color: #d1d5db; cursor: not-allowed; text-decoration: line-through; }
.sdr-cal-day--empty     { cursor: default; }
.sdr-cal-day--sun:not(.sdr-cal-day--past) { color: #ef4444; }
.sdr-cal-day--sat:not(.sdr-cal-day--past) { color: #3b82f6; }

.sdr-cal-label {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  min-height: 20px;
}

/* ── 開始時間・利用時間のプルダウン（PCは横並び、スマホは縦並び） ── */
.sdr-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}
@media (max-width: 480px) { .sdr-time-row { grid-template-columns: 1fr; gap: 12px; } }

.sdr-time-row .sdr-select {
  -webkit-appearance: none;
  appearance: none;
  height: 50px;
  padding-right: 40px;
  color: #1a1a1a;
  cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231a1a1a' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 16px center;
}
.sdr-time-row .sdr-select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.sdr-reserve .sdr-time-legend {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6b7280;
}
.sdr-mark-ok { color: #16a34a; font-weight: 700; }
.sdr-mark-ng { color: #dc2626; font-weight: 700; }

.sdr-reserve .sdr-time-msg {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #ef4444;
}

.sdr-loading { color: #6b7280; font-size: 14px; padding: 20px 0; text-align: center; }

/* ── フォームフィールド ─────────────────────────────────── */
.sdr-field      { margin-bottom: 18px; }
.sdr-field-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .sdr-field-row { grid-template-columns: 1fr; } }

.sdr-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.sdr-required {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.sdr-input,
.sdr-select,
.sdr-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  /* iOS Safari は入力欄のフォントが16px未満だとフォーカス時に自動ズームするため16pxに */
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.sdr-input:focus,
.sdr-select:focus,
.sdr-textarea:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26,26,26,0.1);
}

.sdr-input.is-error { border-color: #ef4444; }

.sdr-hint { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ── プランエラー ───────────────────────────────────────── */
.sdr-plan-error {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  color: #dc2626;
  font-size: 14px;
  margin-top: 8px;
}

/* ── お支払い ───────────────────────────────────────────── */
.sdr-pay-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a1a;
  color: #fff;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.sdr-pay-total-bar__label  { font-size: 14px; font-weight: 600; }
.sdr-pay-total-bar__amount { font-size: 22px; font-weight: 700; color: #fbbf24; }

/* Stripe カード入力 */
.sdr-payment-section       { margin-bottom: 24px; }
.sdr-payment-section__title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

.sdr-card-fields   { display: flex; flex-direction: column; gap: 16px; }
.sdr-card-field    { display: flex; flex-direction: column; gap: 6px; }

.sdr-card-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) { .sdr-card-field-row { grid-template-columns: 1fr; } }

.sdr-card-element {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.2s;
}

.sdr-card-element.StripeElement--focus   { border-color: #1a1a1a; box-shadow: 0 0 0 3px rgba(26,26,26,0.1); }
.sdr-card-element.StripeElement--invalid { border-color: #ef4444; }

.sdr-card-error { color: #ef4444; font-size: 12px; min-height: 16px; }

/* キャンセルポリシー */
.sdr-policy { margin-bottom: 20px; }
.sdr-policy__title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.sdr-policy-table {
  width: 100%;
  font-size: 13px;
}

.sdr-policy-row {
  display: flex;
  width: 100%;
  border-bottom: 1px solid #e5e7eb;
}

.sdr-policy-row:last-child { border-bottom: none; }

.sdr-policy-row span {
  flex: 1;
  padding: 10px 14px;
  box-sizing: border-box;
}

.sdr-policy-row:first-child span { font-weight: 600; color: #6b7280; background: #f9fafb; }
.sdr-policy-row:nth-child(even) span { background: #f9fafb; }

/* 同意チェック */
.sdr-agree-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  cursor: pointer;
}
.sdr-agree-label a { color: #2563eb; }

/* 決済エラー */
.sdr-pay-error {
  margin-top: 12px;
  color: #ef4444;
  font-size: 14px;
  min-height: 20px;
}

/* 安全表示 */
.sdr-pay-secure {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 10px;
  text-align: center;
}

/* ── ボタン ──────────────────────────────────────────────── */
.sdr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, opacity 0.2s;
  text-decoration: none;
}

.sdr-btn--primary    { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.sdr-btn--primary:hover:not(:disabled) { background: #374151; }

/* お支払いへ進むボタンを中央揃え */
#sdr-info-next { display: block; margin: 24px auto 0; }

.sdr-btn--ghost      { background: transparent; color: #1a1a1a; border-color: #d1d5db; }
.sdr-btn--ghost:hover { background: #f3f4f6; }

.sdr-btn--danger      { background: #dc2626; color: #fff !important; border-color: #dc2626; }
.sdr-btn--danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }

.sdr-btn--pay        { background: #1a1a1a; color: #fff; border-color: #1a1a1a; width: 100%; max-width: 400px; }
.sdr-btn--pay:hover:not(:disabled) { background: #374151; }

.sdr-btn:disabled    { opacity: 0.4; cursor: not-allowed; }

/* スピナー */
.sdr-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sdrSpin 0.7s linear infinite;
}
@keyframes sdrSpin { to { transform: rotate(360deg); } }

/* ── サイドバー ─────────────────────────────────────────── */
.sdr-sidebar {
  position: sticky;
  top: 105px;
  align-self: start; /* grid 内で sticky を有効にするために必要 */
  /* 画面の高さが足りない場合もカレンダーの下端まで見られるよう、サイドバー内でスクロール */
  max-height: calc(100vh - 125px);
  overflow-y: auto;
}

.sdr-side-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.sdr-gcal-card { margin-top: 16px; }

.sdr-gcal-note {
  padding: 8px 16px 4px;
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
}

/* テーマの .dowha-page-content p の下余白（16px）を打ち消す */
.sdr-gcal-card .sdr-gcal-note { margin: 0; }
.sdr-gcal-card .sdr-gcal-note:last-of-type { padding-bottom: 10px; }

.sdr-gcal-note--scope {
  padding-top: 12px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
}
.sdr-gcal-note--scope + .sdr-gcal-note { padding-top: 2px; }

.sdr-gcal-frame-wrap {
  overflow: hidden;
  border-radius: 0 0 10px 10px;
}

.sdr-gcal-frame-wrap iframe { display: block; }

.sdr-side-head {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
}

.sdr-side-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.sdr-side-rows {
  padding: 8px 0;
}

.sdr-side-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

.sdr-side-row:last-child { border-bottom: none; }

.sdr-side-row__lbl { color: #6b7280; flex-shrink: 0; }
.sdr-side-row__val { font-weight: 600; text-align: right; word-break: break-all; }

.sdr-side-breakdown {
  padding: 10px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.sdr-side-bd-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  padding: 3px 0;
}

.sdr-side-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #f9fafb;
  border-top: 2px solid #1a1a1a;
  font-weight: 700;
  font-size: 14px;
}

.sdr-side-total__price {
  font-size: 20px;
  color: #1a1a1a;
}

/* ── 完了モーダル ───────────────────────────────────────── */
.sdr-done-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.sdr-done-overlay--show {
  display: flex;
}

.sdr-done-box {
  background: #ffffff !important;
  color: #1a1a1a !important;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  animation: sdrPop 0.4s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

@keyframes sdrPop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.sdr-done-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #dcfce7;
  color: #22c55e;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.sdr-done-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; color: #1a1a1a; }
.sdr-done-msg   { font-size: 14px; color: #4b5563; line-height: 1.7; margin-bottom: 10px; }

.sdr-done-num {
  display: inline-block;
  margin: 12px 0 24px;
  padding: 8px 20px;
  background: #f3f4f6;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 24px;
}

.sdr-done-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* 予約ページ（PC）：本文幅 860px だとサイドバーを除いたメイン列が狭く、
   プランカードの説明文が1行7〜8文字で折り返していたため、このページだけ本文幅を広げる */
@media (min-width: 861px) {
  .dowha-page-body:has(#sdr-reserve-app) { max-width: 1100px; }
}
