@import url(common.css);

input:-webkit-autofill {
    box-shadow: 0 0 0px 1000px white inset !important;
    -webkit-text-fill-color: black !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

.lower-contents-title {
  margin: 30px 0;
  h2 {
    margin-bottom: 20px;
  }
  p {
    margin: 0;
  }
  a {
    border-bottom: 1px solid red;
    color: red;
  }
}

.contact-form-wrapper {
  background: linear-gradient(
    to bottom,
    rgb(211, 237, 251) 85%,
    rgb(255, 254, 247) 100%
  );
  padding: 7vh 0;
  border-radius: 20px;
}

/* --- 全体のコンテナ --- */
.wpcf7 {
  max-width: 800px;
  margin: 0 auto; /* 中央寄せ */
  text-align: left; /* 左揃え */
}

/* --- レイアウト --- */
.form-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5em;
  flex-wrap: wrap;
  width: 100%;
}

.form-label {
  width: 180px; /* ラベル幅を統一 */
  font-weight: bold;
  margin-bottom: 0.5em;
  line-height: 1.4;
  flex-shrink: 0; /* 縮小しないように */
  margin-right: 1em; /* ラベルと入力欄の間隔 */
}

.form-label.is-required::after {
  content: "必須";
  background: #e74c3c;
  color: white;
  font-size: 0.75rem;
  font-weight: normal;
  padding: 3px 8px;
  border-radius: 3px;
  margin-left: 0.5em;
  vertical-align: middle;
  display: inline-block;
  white-space: nowrap; /* 改行しない */
}

.form-field {
  flex: 1;
  min-width: 300px; /* 最小幅を統一 */
  max-width: 500px; /* 最大幅を制限 */
}

/* --- ラジオボタン（四角・チェックマーク式） --- */
.form-field .wpcf7-form-control-wrap {
  display: block;
  width: 100%;
}

.form-field .wpcf7-radio {
  display: flex;
  flex-direction: column; /* 項目を縦に並べる */
  gap: 0.75em;
  flex-wrap: wrap;
}

/* Contact Form 7が生成するラジオボタンのスタイル */
.wpcf7-radio .wpcf7-list-item {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5em; /* 四角と項目名の間隔 */
}

.wpcf7-radio .wpcf7-list-item label{
  display: flex;
  flex-direction: row-reverse;
}

.wpcf7-radio .wpcf7-list-item-label {
  display: flex;
  align-items: center;
  gap: 0.5em; /* 四角と項目名の間隔 */
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.4;
  margin: 0;
  width: 100%;
}

/* 四角のラジオボタン（チェックボックス風） */
.wpcf7-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid #ccc;
  border-radius: 3px; /* 四角にするため角を少し丸める */
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
  flex-shrink: 0;
  background: #fff;
  order: 1; /* 四角を最初に表示 */
}

/* ラベルテキストを四角の右側に配置 */
.wpcf7-radio .wpcf7-list-item-label span {
  order: 2; /* テキストを2番目に表示 */
}

.wpcf7-radio input[type="radio"]:hover {
  border-color: #0073aa;
}

.wpcf7-radio input[type="radio"]:checked {
  border-color: #0073aa;
  background-color: #0073aa;
}

/* チェックマーク */
.wpcf7-radio input[type="radio"]:checked::before {
  content: "✓";
  display: block;
  color: #fff;
  font-size: 0.9rem;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

.wpcf7-radio input[type="radio"]:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* --- 入力フィールド --- */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 0.75em;
  border: 1px solid rgb(220, 221, 221);
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
  background-color: #fff;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus {
  border-color: rgb(0, 160, 233);
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* プレースホルダーのスタイル */
input::placeholder,
textarea::placeholder {
  color: #999;
  font-size: 0.9rem;
}

/* --- 送信ボタン --- */
.form-submit {
  text-align: center;
  margin-top: 2em;
}

.form-submit input[type="submit"] {
  background: rgb(0, 160, 233);
  color: #fff;
  border: none;
  padding: 1em 2.5em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  min-width: 150px;
}

.form-submit input[type="submit"]:hover {
  background: rgb(0, 160, 233);
  transform: translateY(-1px);
}

.form-submit input[type="submit"]:active {
  transform: translateY(0);
}

/* --- Contact Form 7のエラーメッセージ --- */
.wpcf7-not-valid-tip {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 0.25em;
  display: block;
}

.wpcf7-validation-errors {
  background: #ffe6e6;
  border: 1px solid #e74c3c;
  border-radius: 4px;
  padding: 1em;
  margin-bottom: 1em;
  color: #c0392b;
}

.wpcf7-mail-sent-ok {
  background: #e8f5e8;
  border: 1px solid #27ae60;
  border-radius: 4px;
  padding: 1em;
  margin-bottom: 1em;
  color: #27ae60;
}

/* --- スマホ対応 --- */
@media screen and (max-width: 768px) {
  .wpcf7 {
    padding: 0 1em;
  }

  .form-row {
    flex-direction: column;
    margin-bottom: 1.25em;
    p {
      margin-bottom: 5px;
    }
  }

  .form-label {
    width: 100%;
    margin-bottom: 0.5em;
    margin-right: 0;
  }

  .form-field {
    min-width: 100%;
    max-width: 100%;
  }

  .wpcf7-radio {
    flex-direction: column; /* スマホでも縦に並べる */
    gap: 0.75em;
    align-items: flex-start;
  }

  .form-submit input[type="submit"] {
    width: 100%;
    max-width: 300px;
  }
}

/* --- 追加の視覚的改善 --- */
@media screen and (min-width: 769px) {
  .form-row:hover .form-label {
    color: #0073aa;
    transition: color 0.2s ease;
  }

  /* ラベルの幅を統一するための追加調整 */
  .form-label {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  }

  .form-label.is-required {
    align-items: center;
  }

  /* ラジオボタンの項目を縦に並べる */
  .wpcf7-radio {
    max-width: 100%;
  }

  .wpcf7-radio .wpcf7-list-item {
    width: 100%; /* 各項目の幅を100%に */
    justify-content: flex-start; /* 左揃え */
  }
}
