.pre-cf7{
  margin: 10px auto;
  font-size:1rem ;
  color: #666;
  display: block;
  width: fit-content;
  span{
    font-size: 1.3rem;
    color: var(--orange);
  }
}

.wpcf7 {
  max-width: 850px;
  padding: 50px 10%;
  background-color: rgb(248, 248, 248);
  border-radius: 20px;
  margin: 0 auto;
}

.cf7-form {
  width: 100%;
}

.cf7-grid {
  /* display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; */
}

.cf7-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.cf7-field--full {
  /* grid-column: 1 / -1; */
}

.cf7-school {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  /* width: 405px; */
  max-width: 100%;
}

.cf7-school .cf7-field {
  margin-bottom: 0;
}

.cf7-school .cf7s-1 {
  flex: 0 0 124px;
}

.cf7-school .cf7s-2 {
  flex: 1;
  min-width: 0;
}

.cf7-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.5;
}

.req,
.opt {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.req {
  background: #d32f2f;
  color: #fff;
  transition: all .2s;
}

.opt {
  background: #f1f1f1;
  color: #666;
}

.cf7-input,
.cf7-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
}

.cf7-textarea {
  min-height: 180px;
  resize: vertical;
}

.cf7-school .cf7-textarea {
  min-height: 52px;
}

.cf7-actions {
  margin-top: 24px;
}

.cf7-submit {
  appearance: none;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

label:has(.wpcf7-list-item-label) {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;

  input {
    cursor: pointer;
    width: 15px;
  }
}

.wpcf7-list-item-label {
  font-size: 1.1rem;
}

.wpcf7-acceptance {
  .wpcf7-list-item-label {
    font-size: 0.9rem;
  }
}

.wpcf7-select {
  cursor: pointer;
}

.wpcf7-form-control-wrap {
  width: 100%;
  padding-bottom: 30px;
  position: relative;

  .wpcf7-not-valid-tip {
    position: absolute;
    bottom: 0;
    left: 0;
    font-size: 1.1rem;
    white-space: nowrap;
  }
}

.wpcf7-form-control-wrap:has(.wpcf7-acceptance) {
  padding-bottom: 0;
}

.wpcf7-acceptance {
  margin: 0 auto;
  display: block;
  width: fit-content;
  .wpcf7-list-item-label {
    color: #d32f2f;
    font-size: 1rem;
  }
}

.cf7-privacy {
  a {
    width: fit-content;
    display: block;
    margin: 10px auto;
    transition: all 0.3s;
    font-size: 12px;
    padding-bottom: 2px;
    border-bottom: 1px solid #999;
    color: #666;
    &:hover {
      opacity: 0.7;
    }
  }
}

.cf7-input::placeholder,
.cf7-textarea::placeholder {
  color: #bbbbbb;
  font-size: 1rem;
}

.wpcf7-submit {
  display: block;
  margin: 0 auto;
  background-color: var(--orange);
  color: var(--navy);
  font-size: 1.3rem;
  border: 2px solid var(--orange);
  transition: all 0.3s;
  &:hover {
    background-color: white;
  }
  &:disabled {
    background-color: #999;
    border: 2px solid #999;
    color: #666;
  }
}

/* テキスト・メール・電話：入力されたら */
.cf7-field:has(input[aria-required="true"]:not(:placeholder-shown)) .req,
.cf7-field:has(textarea[aria-required="true"]:not(:placeholder-shown)) .req {
  background: #f1f1f1;
  color: #999;
}

/* 学年：最初の選択肢「-」以外が選ばれたら */
.cf7-field:has(select[name="grade"] option:not(:first-child):checked) .req {
  background: #f1f1f1;
  color: #999;
}

/* お問い合わせ区分：1つでもチェックされたら */
.cf7-field:has(input[name="inquiry-type[]"]:checked) .req {
  background: #f1f1f1;
  color: #999;
}

p:has(.wpcf7-spinner){
  margin-top: 40px;
  position: relative;

  .wpcf7-spinner{
    position: absolute;
    bottom:calc(100% + 10px) ;
    left: calc(50% - 12px);
    margin: 0;
  }
}

@media (max-width: 767px) {
  .wpcf7 {
    padding: 30px 5%;
  }
  .cf7-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cf7-field--full {
    grid-column: auto;
  }

  .cf7-school {
    display: block;
    margin-bottom: 0;
  }

  .cf7-school .cf7-field {
    width: 100%;
    margin-bottom: 20px;
  }

  .cf7-input,
  .cf7-textarea {
    font-size: 16px;
  }
}
