/**
 * Contact Form 7 カスタムCSS
 * 既存のデザインシステムに合わせたスタイリング
 */

/* =================================
   Contact Form 7 基本スタイル
   ================================= */

/* フォーム全体のコンテナ */
.contact-form .wpcf7 {
  max-width: 100%;
}

/* Contact Form 7のデフォルトmarginをリセット */
.contact-form .wpcf7 p {
  margin: 0 !important;
}

.contact-form .wpcf7 form {
  margin: 0;
}

/* Contact Form 7の自動生成brタグを無効化 */
.contact-form .wpcf7 br {
  display: none;
}

/* Contact Form 7のspan要素の余白も制御 */
.contact-form .wpcf7 span.wpcf7-form-control-wrap {
  display: block;
  margin: 0;
  padding: 0;
}

/* より具体的にContact Form 7のwrapperを制御 */
.contact-form .form__group .wpcf7-form-control-wrap {
  margin: 0 !important;
  padding: 0 !important;
}

/* ===================================
   フォーム要素のスタイリング
   =================================== */

/* 入力フィールド */
.contact-form .wpcf7 input[type="text"],
.contact-form .wpcf7 input[type="email"],
.contact-form .wpcf7 input[type="tel"],
.contact-form .wpcf7 textarea,
.contact-form .wpcf7 select {
  width: 100%;
  padding: 7px 16px; /* 上下paddingを7pxに調整 */
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
  background-color: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

/* フォーカス状態 */
.contact-form .wpcf7 input:focus,
.contact-form .wpcf7 textarea:focus,
.contact-form .wpcf7 select:focus {
  outline: none;
  border-color: #009092;
  box-shadow: 0 0 0 3px rgba(0, 144, 146, 0.1);
}

/* テキストエリア */
.contact-form .wpcf7 textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

/* ラベル */
.contact-form .form__group label {
  display: block;
  font-weight: 700;
  font-size: 16px;
  color: #133b45;
  margin-bottom: 0; /* gridのgapに任せる */
  line-height: 1.5;
}

/* フォームコントロールwrapper */
.contact-form .wpcf7 .wpcf7-form-control-wrap {
  position: relative;
  display: block;
  margin-bottom: 0; /* 重複margin削除 */
}

/* フォームグループの統一余白（元デザインに合わせる） */
.contact-form .form__group {
  display: grid;
  gap: 6px; /* 元デザインと同じ狭い間隔 */
  margin-bottom: 32px; /* フィールド間の余白 */
}

/* 最後のフォームグループの余白削除 */
.contact-form .form__group:last-child {
  margin-bottom: 0;
}

/* チェックボックス・ラジオボタン */
.contact-form .wpcf7 input[type="checkbox"],
.contact-form .wpcf7 input[type="radio"] {
  width: auto;
  margin-right: 8px;
  transform: scale(1.2);
}

.contact-form .wpcf7 .wpcf7-list-item {
  margin: 0 0 8px 0;
}

.contact-form .wpcf7 .wpcf7-list-item label {
  font-weight: 500;
}

/* 送信ボタン */
.contact-form .wpcf7 input[type="submit"] {
  background: linear-gradient(135deg, #133b45 0%, #0c5f6b 100%);
  color: white;
  border: none;
  padding: 8px 48px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 24px auto 0 auto;
  box-shadow: 0 4px 12px rgba(19, 59, 69, 0.3);
  display: block;
  text-align: center;
}

.contact-form .wpcf7 input[type="submit"]:hover {
  background: linear-gradient(135deg, #0c2b33 0%, #0a4d57 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(19, 59, 69, 0.4);
}

/* 送信ボタンを無効状態にする */
.contact-form .wpcf7 input[type="submit"]:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===================================
   エラー・成功メッセージ
   =================================== */

/* 個別フィールドエラー */
.contact-form .wpcf7 .wpcf7-not-valid-tip {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 4px;
  display: block;
}

/* 全体エラーメッセージ */
.contact-form .wpcf7 .wpcf7-validation-errors {
  color: #e74c3c;
  background: #fdf2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  font-weight: 500;
}

/* 送信完了メッセージ */
.contact-form .wpcf7 .wpcf7-mail-sent-ok {
  color: #155724;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  font-weight: 500;
}

/* エラー状態の入力フィールド */
.contact-form .wpcf7 .wpcf7-not-valid {
  border-color: #e74c3c !important;
  background-color: #fdf2f2;
}

/* スピナー（送信中）を非表示に */
.contact-form .wpcf7 .wpcf7-spinner {
  display: none !important;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
  .contact-form .wpcf7 input[type="text"],
  .contact-form .wpcf7 input[type="email"],
  .contact-form .wpcf7 input[type="tel"],
  .contact-form .wpcf7 textarea,
  .contact-form .wpcf7 select {
    padding: 9px 16px; /* SP時も上下paddingを調整 */
    font-size: 16px; /* iOS zoom防止 */
  }

  .contact-form .wpcf7 input[type="submit"] {
    width: 100%;
    padding: 6px;
  }
}

/* フォーカス表示の強化（アクセシビリティ） */
.contact-form .wpcf7 input:focus-visible,
.contact-form .wpcf7 textarea:focus-visible,
.contact-form .wpcf7 select:focus-visible {
  outline: 2px solid #009092;
  outline-offset: 2px;
}

/* ========================================
   見積り内容のカード型選択肢スタイル
   ======================================== */

/* fieldsetの基本スタイル */
.contact-form .form__fieldset {
  border: none;
  margin: 0 0 32px 0;
  padding: 0;
}

.contact-form .form__legend {
  font-weight: 700;
  color: #133b45;
  margin-bottom: 0;
  padding: 0;
  width: 100%;
}

.contact-form .form__hint {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* カードコンテナ */
.contact-form .form__fieldset--card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 24px;
  border: 1px solid #e9ecef;
}

/* 各選択肢グループ */
.contact-form .choice {
  margin-bottom: 32px;
}

.contact-form .choice:last-child {
  margin-bottom: 0;
}

/* 選択肢のラベル */
.contact-form .choice__label {
  font-size: 1rem;
  font-weight: 600;
  color: #133b45;
  margin-bottom: 12px;
  display: block;
}

/* Flexboxレイアウト - 2×2で4つの項目を配置 */

/* Contact Form 7のラジオボタンを2×2で配置 */
.contact-form .wpcf7 .wpcf7-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%; /* 親要素の幅に合わせる */
}

.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 12px 16px; /* input欄と高さを揃える */
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin: 0;
  flex: 1 1 calc(50% - 8px); /* 2列にして余白を考慮 */
  min-width: 120px; /* 最小幅を確保 */
}

/* ホバー時のスタイル */
.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item:hover {
  border-color: #009092;
  background: #f8fffe;
  transform: translateY(-2px);
}

/* ラジオボタン本体は非表示 */
.contact-form .wpcf7 .wpcf7-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

/* ラベルのスタイル */
.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  margin: 0;
  line-height: 1.4;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* 選択時のスタイル */
.contact-form
  .wpcf7
  .wpcf7-radio
  .wpcf7-list-item:has(input[type="radio"]:checked) {
  background: linear-gradient(135deg, #009092 0%, #133b45 100%);
  border-color: #009092;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 144, 146, 0.3);
}

.contact-form
  .wpcf7
  .wpcf7-radio
  .wpcf7-list-item:has(input[type="radio"]:checked)
  label {
  color: white;
  font-weight: 600;
}

/* フルセット項目のスタイル */
.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item {
  flex: 1 1 100%; /* フルセットは1行で全幅 */
  background: linear-gradient(135deg, #133b45 0%, #009092 100%);
  color: white;
  border-color: #133b45;
}

.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item:hover {
  background: linear-gradient(135deg, #0f2d35 0%, #007a7c 100%);
}

.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item label {
  color: white;
}

.contact-form .choice-card--span2 {
  grid-column: span 2;
}

.contact-form .choice-card--fullset {
  background: linear-gradient(135deg, #133b45 0%, #009092 100%);
  color: white;
  border-color: #133b45;
}

.contact-form .choice-card--fullset:hover {
  background: linear-gradient(135deg, #0f2d35 0%, #007a7c 100%);
}

/* 注釈 */
.contact-form .choice-card__note {
  font-size: 0.8rem;
  color: #666;
  margin-left: 4px;
}

.contact-form
  .wpcf7
  .wpcf7-radio
  .wpcf7-list-item:has(input[type="radio"]:checked)
  .choice-card__note {
  color: rgba(255, 255, 255, 0.8);
}

/* レスポンシブ対応 - SP時もPC時と同じ2×2レイアウトを維持 */
@media screen and (max-width: 768px) {
  .contact-form .form__fieldset--card {
    padding: 16px;
  }

  /* SP時はフォントサイズを小さくして自然に縮む */
  .contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
    font-size: 12px;
  }
}

/* より小さい画面での追加調整 */
@media screen and (max-width: 480px) {
  .contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
    font-size: 11px;
  }
}

/* ===========================================
   チェックボックス（複数選択）のスタイリング - シンプル版
   =========================================== */
/* choice-grid内のチェックボックスを2列で配置 */
.contact-form .choice-grid .wpcf7-checkbox {
  display: contents; /* 親のgridに直接参加 */
  margin: 0;
  padding: 0;
}

.contact-form .choice-grid .wpcf7-checkbox .wpcf7-list-item {
  margin: 0;
  padding: 8px 0;
  display: flex;
  align-items: center;
}

/* "その他"項目を全幅表示 */
.contact-form .choice-grid .wpcf7-checkbox .wpcf7-list-item:last-child {
  grid-column: 1 / -1;
}

/* チェックボックス本体のスタイル */
.contact-form .choice-grid .wpcf7-checkbox input[type="checkbox"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  accent-color: #009092;
}

/* PC時のチェックボックス上部マージン */
@media screen and (min-width: 769px) {
  .contact-form .choice-grid .wpcf7-checkbox input[type="checkbox"] {
    margin-top: 5px;
  }
}

/* ラベルのスタイル */
.contact-form .choice-grid .wpcf7-checkbox label {
  font-size: 15px;
  line-height: 1.4;
  color: #333;
  cursor: pointer;
  margin: 0;
  display: flex;
  align-items: center;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
  .contact-form .choice-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .contact-form .wpcf7-checkbox label {
    font-size: 14px;
  }
}

/* アニメーション無効化設定に対応 */
@media (prefers-reduced-motion: reduce) {
  .contact-form .wpcf7 * {
    transition: none !important;
    transform: none !important;
  }
}
.contact-form .wpcf7 .wpcf7-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%; /* 親要素の幅に合わせる */
}

.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 12px 16px; /* input欄と高さを揃える */
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin: 0;
  flex: 0 0 calc(50% - 8px); /* 50%幅からgapの半分を引く */
}

.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item:hover {
  border-color: #009092;
  box-shadow: 0 2px 8px rgba(0, 144, 146, 0.1);
}

/* ラジオボタンを隠す */
.contact-form .wpcf7 .wpcf7-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* ラベルのスタイル */
.contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
  font-size: 15px; /* PC時のサイズ */
  font-weight: 500;
  color: #333;
  line-height: 1.2;
  display: block;
  cursor: pointer;
  margin: 0;
  padding: 0;
  width: 100%;
  white-space: nowrap; /* 折り返さない */
}

/* 選択状態のスタイル */
.contact-form
  .wpcf7
  .wpcf7-radio
  .wpcf7-list-item:has(input[type="radio"]:checked) {
  background: #009092;
  color: white;
  border-color: #009092;
}

.contact-form
  .wpcf7
  .wpcf7-radio
  .wpcf7-list-item:has(input[type="radio"]:checked)
  label {
  color: white;
}

/* フルセット用の2列ぶち抜き - Contact Form 7のname属性で判定 */
.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item {
  grid-column: span 2; /* 2列ぶち抜き */
  background: linear-gradient(135deg, #133b45 0%, #009092 100%);
  color: white;
  border-color: #133b45;
}

.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item:hover {
  background: linear-gradient(135deg, #0f2d35 0%, #007a7c 100%);
}

.contact-form .wpcf7 .wpcf7-radio[data-name="fullset"] .wpcf7-list-item label {
  color: white;
}

/* 旧クラス名との互換性も保持 */

/* レスポンシブ対応 - SP時もPC時と同じ2×2レイアウトを維持 */
@media screen and (max-width: 768px) {
  .contact-form .form__fieldset--card {
    padding: 16px;
  }

  /* SP時はフォントサイズを小さくして自然に縮む */
  .contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
    font-size: 12px;
  }
}

/* より小さい画面での追加調整 */
@media screen and (max-width: 480px) {
  .contact-form .wpcf7 .wpcf7-radio .wpcf7-list-item label {
    font-size: 11px;
  }
} /* ===========================================
   チェックボックス（複数選択）のスタイリング - シンプル版
   =========================================== */

/* ===========================================
   同意チェックボックス（acceptance）のスタイリング
   =========================================== */

/* 同意チェックボックスは横並びを維持 */
.contact-form .form__consent .checkline {
  display: flex; /* gridを無効化してflexを使用 */
  align-items: flex-start;
  gap: 8px;
}

.contact-form .form__consent .checkline .wpcf7-acceptance {
  display: contents; /* wrapperを透明化 */
}

.contact-form .form__consent .checkline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 5px 5px 0 0;
  flex-shrink: 0;
  accent-color: #009092;
}

.contact-form .form__consent .checkline label {
  line-height: 1.6;
  font-size: 15px;
  color: #333;
  cursor: pointer;
  margin: 0;
}

.contact-form .form__consent .checkline a {
  color: #009092;
  text-decoration: underline;
}

.contact-form .form__consent .checkline a:hover {
  text-decoration: none;
}

/* アニメーション無効化設定に対応 */
@media (prefers-reduced-motion: reduce) {
  .contact-form .wpcf7 * {
    transition: none !important;
    transform: none !important;
  }
}
