/* ==========================================
   入校申込フォーム（確認画面付き）
   米沢ドライビングスクール お問い合わせフォームのデザインに合わせています
   テーマの /assets/cf7-confirm.css に設置
   ※すべて .ef の中だけに効くので、他のフォームには影響しません
========================================== */

.ef {
  --ef-white:   var(--color-white, #fff);
  --ef-text:    var(--color-text, #222);
  --ef-heading: var(--color-heading, #222);
  --ef-primary: var(--color-primary, #222);
  --ef-accent:  var(--color-accent, #d50024);
  --ef-muted:   var(--color-text-muted, #777);
  --ef-border:  #e6e5e5;
  --ef-font-heading: var(--font-heading, "Zen Kaku Gothic Antique", sans-serif);
  --ef-font-base:    var(--font-base, "Noto Sans JP", sans-serif);
  color: var(--ef-text);
}

.ef [hidden] { display: none !important; }

/* ---------- 外枠（カード） ----------
   お問い合わせページの .contact-form-card と同じ枠をフォーム自体に付けます。
   カードの背景色は --ef-card-bg で変更できます。 */
.wpcf7:has(.ef) {
  --ef-card-bg: #ffffff;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 40px 40px;
  border: 1px solid #e6e5e5;
  border-radius: 16px;
  background-color: var(--ef-card-bg);
  box-sizing: border-box;
}
/* すでにテーマのカード内に置いた場合は二重にしない */
.contact-form-card .wpcf7:has(.ef) {
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.wpcf7:has(.ef) .wpcf7-form { margin: 0; }
@media (max-width: 768px) {
  .wpcf7:has(.ef) { padding: 24px 18px 28px; }
}

.ef-step-input,
.ef-step-confirm {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.ef-step[hidden] { display: none !important; }

/* ---------- 項目 ---------- */
.ef-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ef-label {
  margin: 0;
  font-family: var(--ef-font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ef-heading);
}
.ef-required {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ef-accent);
}
.ef-note {
  margin-left: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ef-muted);
}
.ef .wpcf7-form-control-wrap { display: block; width: 100%; }

/* ---------- テキスト入力・セレクト ---------- */
.ef input[type="text"],
.ef input[type="email"],
.ef input[type="tel"],
.ef input[type="number"],
.ef select,
.ef textarea {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--ef-border);
  border-radius: 10px;
  background-color: var(--ef-white);
  color: var(--ef-text);
  font-family: var(--ef-font-base);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.ef textarea { min-height: 180px; resize: vertical; }
.ef input:focus,
.ef select:focus,
.ef textarea:focus {
  outline: none;
  border-color: var(--ef-primary);
  box-shadow: 0 0 0 3px rgba(83, 76, 66, .12);
}
.ef ::placeholder { color: #aaa; }

/* セレクト（矢印） */
.ef select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: 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='%23222' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

/* 入校希望時期（年・月を横並び） */
.ef-period {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 200px));
  gap: 12px;
}

/* 年齢 */
.ef-age {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ef-font-heading);
  font-size: 15px;
  font-weight: 700;
}
.ef-age .wpcf7-form-control-wrap { width: 120px; }

/* 郵便番号 */
.ef-zip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ef-zip-mark {
  font-family: var(--ef-font-heading);
  font-size: 15px;
  font-weight: 700;
}
.ef-zip .wpcf7-form-control-wrap { width: 200px; }

/* ---------- チェックボックス・ラジオ ---------- */
.ef .wpcf7-checkbox,
.ef .wpcf7-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}
.ef .wpcf7-list-item { margin: 0; }
.ef .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ef-font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ef-primary);
  cursor: pointer;
}
.ef .wpcf7-list-item input[type="radio"],
.ef .wpcf7-list-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--ef-primary);
  background-color: var(--ef-white);
  box-sizing: border-box;
  cursor: pointer;
}
.ef .wpcf7-list-item input[type="radio"] { border-radius: 50%; }
.ef .wpcf7-list-item input[type="checkbox"] { border-radius: 4px; }

.ef .wpcf7-list-item input[type="radio"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--ef-primary);
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s;
}
.ef .wpcf7-list-item input[type="radio"]:checked::after { transform: translate(-50%, -50%) scale(1); }

.ef .wpcf7-list-item input[type="checkbox"]:checked { background-color: var(--ef-primary); }
.ef .wpcf7-list-item input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--ef-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s;
}
.ef .wpcf7-list-item input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }

.ef .wpcf7-list-item input:focus-visible {
  outline: 2px solid var(--ef-primary);
  outline-offset: 2px;
}

/* ---------- 画像認証 ---------- */
.ef-captcha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.ef-captcha img,
.ef .wpcf7-captchac {
  display: block;
  width: auto;
  height: 40px;
  border-radius: 6px;
  background: var(--ef-white);
}
.ef-captcha .wpcf7-form-control-wrap { flex: 1 1 180px; max-width: 240px; }

/* ---------- エラー ---------- */
.ef-error,
.ef .wpcf7-not-valid-tip {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ef-accent);
}

/* ---------- 確認画面 ---------- */
.ef-confirm-lead {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
}
.ef-confirm-list {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 14px 24px;
  margin: 0;
  padding: 24px 26px;
  border: 1px solid var(--ef-border);
  border-radius: 14px;
  background-color: var(--ef-white);
}
.ef-confirm-list dt {
  font-family: var(--ef-font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ef-heading);
}
.ef-confirm-list dd {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ef-text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- ボタン ---------- */
.ef-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
.ef .ef-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 280px;
  min-height: 52px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  background-color: var(--ef-primary);
  color: var(--ef-white);
  font-family: var(--ef-font-heading);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .15s, opacity .15s, background-color .15s;
}
.ef .ef-btn:hover { opacity: .9; transform: translateY(1px); }

.ef .ef-btn-back {
  min-width: 200px;
  border: 1px solid var(--ef-primary);
  background-color: transparent;
  color: var(--ef-primary);
}
.ef .ef-btn-back:hover { opacity: 1; background-color: rgba(83, 76, 66, .08); }

/* ---------- 送信結果メッセージ・スピナー ---------- */
.wpcf7-form:has(.ef) .wpcf7-response-output {
  margin: 8px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--ef-border, #e6e5e5);
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
  line-height: 1.7;
}
.wpcf7-form.sent:has(.ef) .wpcf7-response-output { border-color: #7a9e7e; color: #2f5d34; }
.wpcf7-form.invalid:has(.ef) .wpcf7-response-output,
.wpcf7-form.failed:has(.ef) .wpcf7-response-output { border-color: #e2a3a8; color: #d50024; }
.wpcf7-form:has(.ef) .wpcf7-response-output:empty { display: none; }
.ef .wpcf7-spinner { display: block; margin: 5px auto; }

/* ---------- スマホ ---------- */
@media (max-width: 768px) {
  .ef .ef-btn { width: 100%; min-width: 0; }
}
@media (max-width: 600px) {
  .ef-confirm-list { grid-template-columns: 1fr; gap: 6px 0; padding: 20px; }
  .ef-confirm-list dd { margin-bottom: 8px; }
}


/* ==========================================
   【既存のお問い合わせページの表示修正】
   hidden属性がテーマCSSの display 指定で打ち消され、
   入力画面に「確認ボタン2つ・空の確認欄・内容を修正する」が
   同時に表示されているため、hidden を優先させます。
========================================== */
.contact-page .wpcf7 [hidden] { display: none !important; }
