/* ==========================================================
   ご購入手続き（入力画面） checkout.php

   進行状況・見出し・セクションの枠・金額・ボタンは、
   確認画面と共通の style_confirm.css を使います。
   このファイルには、入力欄など入力画面だけの指定を置きます。
   （色の変数 --cf-* も style_confirm.css で定義しています）

   構成
     1. メッセージ
     2. 入力欄
     3. 選択肢（お届け先・請求書送付先・お支払い方法）
     4. 別のお届け先の入力欄
     5. 金額とボタン
     6. エラー表示のモーダル
     7. スマホ表示（640px以下）
========================================================== */


/* ==========================================================
   1. メッセージ
========================================================== */
.checkout-flash {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--cf-shu);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff;
  color: var(--cf-shu);
  font-weight: bold;
}


/* ==========================================================
   2. 入力欄
========================================================== */

/* ラベルを左、入力欄を右に置く */
.checkout-field {
  display: grid;
  grid-template-columns: 10.5em minmax(0, 1fr);
  align-items: start;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--cf-line);
}

.checkout-field:first-child {
  padding-top: 0;
}

.checkout-field:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.checkout-field > label {
  padding-top: 10px;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.5;
}

/* 必須・任意の印 */
.checkout-req,
.checkout-opt {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: normal;
  line-height: 1.7;
  vertical-align: 2px;
}

.checkout-req {
  background: var(--cf-shu);
  color: #fff;
}

.checkout-opt {
  border: 1px solid var(--cf-line);
  background: #fff;
  color: var(--cf-sub);
}

.checkout-field input,
.checkout-field textarea {
  width: 100%;
  padding: 10px 12px;
  box-sizing: border-box;
  border: 1px solid #b9ae9b;
  border-radius: 6px;
  background: #fff;
  color: var(--cf-text);
  font-family: inherit;
  font-size: 16px; /* 16px未満だと、iPhoneで入力時に画面が拡大される */
  line-height: 1.5;
}

.checkout-field textarea {
  min-height: 96px;
  resize: vertical;
}

.checkout-field input::placeholder,
.checkout-field textarea::placeholder {
  color: #a59c8f;
}

.checkout-field input:focus,
.checkout-field textarea:focus {
  border-color: var(--cf-green);
  outline: 2px solid var(--cf-gold);
  outline-offset: 1px;
}

/* 短い入力欄 */
.checkout-field input.checkout-input-zip {
  max-width: 9em;
}

.checkout-field input.checkout-input-tel {
  max-width: 14em;
}

/* 入力欄の下の補足 */
.checkout-hint {
  grid-column: 2;
  margin: 0;
  font-size: 13px;
  color: var(--cf-sub);
}


/* ==========================================================
   3. 選択肢（お届け先・請求書送付先・お支払い方法）
========================================================== */
.checkout-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* 2つを横に並べる */
.checkout-choices-2 {
  grid-template-columns: 1fr 1fr;
}

.checkout-choice {
  position: relative;
  display: block;
  cursor: pointer;
}

/* ラジオボタン本体は隠し、キーボード操作は残す */
.checkout-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.checkout-choice-body {
  display: block;
  height: 100%;
  padding: 12px 14px 12px 44px;
  box-sizing: border-box;
  border: 1px solid #b9ae9b;
  border-radius: 6px;
  background: #fff;
}

/* 丸い選択マーク */
.checkout-choice-body::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 15px;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 2px solid #b9ae9b;
  border-radius: 50%;
  background: #fff;
}

.checkout-choice input:checked + .checkout-choice-body {
  border-color: var(--cf-green);
  box-shadow: inset 0 0 0 1px var(--cf-green);
  background: #f4f8f1;
}

.checkout-choice input:checked + .checkout-choice-body::before {
  border-color: var(--cf-green);
  background: radial-gradient(circle, var(--cf-green) 0 45%, #fff 50%);
}

.checkout-choice input:focus-visible + .checkout-choice-body {
  outline: 3px solid var(--cf-gold);
  outline-offset: 2px;
}

.checkout-choice-title {
  display: block;
  font-size: 17px;
  font-weight: bold;
  line-height: 1.5;
}

.checkout-choice-fee {
  margin-left: 8px;
  font-size: 14px;
  font-weight: normal;
  color: var(--cf-sub);
}

.checkout-choice-desc {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--cf-sub);
}

/* 選べない支払い方法 */
.checkout-choice.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.payment-warning {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--cf-shu);
}

.payment-warning:empty {
  display: none;
}


/* ==========================================================
   4. 別のお届け先の入力欄
========================================================== */
#shippingArea {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--cf-line);
}

.checkout-subtitle {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: bold;
}

.checkout-subtitle small {
  margin-left: 6px;
  font-size: 13px;
  font-weight: normal;
  color: var(--cf-sub);
}


/* ==========================================================
   5. 金額とボタン
========================================================== */
.checkout-bill-note {
  margin: -12px 0 18px;
  font-size: 13px;
  text-align: right;
  color: var(--cf-sub);
}

/* 「カートに戻る」（ボタンをリンクの見た目にする） */
.checkout-back {
  padding: 0;
  border: none;
  background: none;
  color: var(--cf-green);
  font-family: inherit;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.checkout-back:hover {
  color: var(--cf-gold-dark);
}

.checkout-back:focus-visible {
  outline: 3px solid var(--cf-gold);
  outline-offset: 2px;
}


/* ==========================================================
   6. エラー表示のモーダル
========================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none; /* JSが flex に切り替える */
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.modal-box {
  width: 90%;
  max-width: 360px;
  padding: 24px 20px 20px;
  box-sizing: border-box;
  border-top: 4px double #d4a017;
  border-radius: 0 0 8px 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-box p {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.7;
}

.modal-box button {
  padding: 10px 32px;
  border: none;
  border-radius: 6px;
  background: #234d30;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}


/* ==========================================================
   7. スマホ表示（640px以下）
========================================================== */
@media (max-width: 640px) {

  /* ラベルを入力欄の上に置く */
  .checkout-field {
    grid-template-columns: 1fr;
  }

  .checkout-field > label {
    padding-top: 0;
  }

  .checkout-hint {
    grid-column: 1;
  }

  .checkout-choices-2 {
    grid-template-columns: 1fr;
  }
}