/* ========================================================
   Benny Contact Form 7 Customize
   お問い合わせ・お申込みフォーム カスタムスタイル
   CF7 が出力する .wpcf7-form-control-wrap > .wpcf7-form-control
   > .wpcf7-list-item > label > input + .wpcf7-list-item-label
   構造を前提にスタイリングします。
   ======================================================== */

/* =================================================================
   iqfm-table: 親コンテナ幅に必ず収め、cell内テキストはみ出し時のみ改行
   ※ table-layout:fixed が無いと、長い不可分テキストでテーブル自体が
     親をはみ出す
   ================================================================= */
.iqfm-table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.iqfm-table th,
.iqfm-table td {
    overflow-wrap: break-word;  /* 必要時のみ改行を許可 (はみ出し防止) */
    box-sizing: border-box;
}

/* th だけ keep-all: ラベル「ご用件」が「ご用/件」のように割れないため */
.iqfm-table th {
    word-break: keep-all;
}
.iqfm-table th .iqfm-req_color {
    word-break: normal;
}

/* disabled 状態の input/textarea/select を含む行は ※必須 を非表示
   (ご用件未選択時、ロックされている行のみ ※必須 が消える) */
.iqfm-table tr:has(:disabled) .iqfm-req_color {
    display: none;
}

/* td は通常改行: 長い日本語ラベルがチェックボックス隣で自然に折り返せるように */
.iqfm-table td {
    word-break: normal;
}

/* 入力要素がセル幅を超えないように制御
   (size属性で固定幅指定されたinputがtdをはみ出す/切られるのを防ぐ) */
.iqfm-table td input[type="text"],
.iqfm-table td input[type="email"],
.iqfm-table td input[type="tel"],
.iqfm-table td input[type="number"],
.iqfm-table td textarea,
.iqfm-table td select {
    max-width: 100%;
    box-sizing: border-box;
}

/* textarea は td 幅いっぱいに */
.iqfm-table td textarea {
    width: 100%;
}

/* お申込み日 (年月日) の入力欄は固定50px・1行表示 */
.iqfm-table td input.apply-date-num {
    width: 50px;
    max-width: 50px;
}

/* 複数input分割項目 (お申込み日 / 郵便番号+住所):
   個別のエラーtipを非表示、いずれかが無効なら td 末尾に1個だけ表示。 */
.iqfm-table td .wpcf7-form-control-wrap.app-apply-year .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-apply-month .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-apply-day .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-postal-code1 .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-postal-code2 .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-address .wpcf7-not-valid-tip {
    display: none !important;
}

.iqfm-table td:has(input[name="app-apply-year"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-apply-month"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-apply-day"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-postal-code1"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-postal-code2"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-address"].wpcf7-not-valid)::after {
    content: "必須項目に入力してください。";
    display: block;
    color: #dc3232;
    font-size: 1em;
    margin-top: 4px;
    white-space: normal;
}

/* ご自宅番号 / 携帯番号: tel1 のtipを非表示にして、td 末尾に
   カスタムメッセージを表示 (PHPのカスタム検証メッセージと同じ) */
.iqfm-table td .wpcf7-form-control-wrap.app-home-tel1 .wpcf7-not-valid-tip,
.iqfm-table td .wpcf7-form-control-wrap.app-mobile-tel1 .wpcf7-not-valid-tip {
    display: none !important;
}

.iqfm-table td:has(input[name="app-home-tel1"].wpcf7-not-valid)::after,
.iqfm-table td:has(input[name="app-mobile-tel1"].wpcf7-not-valid)::after {
    content: "ご自宅番号または携帯番号のどちらかをご入力ください。";
    display: block;
    color: #dc3232;
    font-size: 1em;
    margin-top: 4px;
    white-space: normal;
}

/* 排雪料金 / 早割: form-tag wrap を強制インライン化して、
   後ろに置いた価格 <span> が同じ行に続くようにする */
.iqfm-table td .wpcf7-form-control-wrap.fee-basic,
.iqfm-table td .wpcf7-form-control-wrap.fee-basic span,
.iqfm-table td .wpcf7-form-control-wrap.fee-basic label,
.iqfm-table td .wpcf7-form-control-wrap.early-discount,
.iqfm-table td .wpcf7-form-control-wrap.early-discount span,
.iqfm-table td .wpcf7-form-control-wrap.early-discount label {
    display: inline;
}

/* 継続割引: 各年代の右に価格を赤色で挿入 (CSS::after で対象限定) */
.iqfm-table .wpcf7-form-control-wrap.continuation .wpcf7-list-item-label::after {
    color: #d4380d;
    font-weight: bold;
    margin-left: 4px;
}
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="2-3年"]) .wpcf7-list-item-label::after   { content: "(−500)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="4-5年"]) .wpcf7-list-item-label::after   { content: "(−800)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="6-7年"]) .wpcf7-list-item-label::after   { content: "(−1,000)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="8-9年"]) .wpcf7-list-item-label::after   { content: "(−1,200)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="10年"]) .wpcf7-list-item-label::after    { content: "(−1,500)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="11年"]) .wpcf7-list-item-label::after    { content: "(−1,800)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="12-18年"]) .wpcf7-list-item-label::after { content: "(−2,000)"; }
.iqfm-table .wpcf7-form-control-wrap.continuation label:has(input[value="19年以降"]) .wpcf7-list-item-label::after { content: "(−2,500)"; }

/* =================================================================
   td にネストされた .benny-form のはみ出し防止
   (お振込み口座/入金期日 と 合計金額 の box レイアウト用)
   ================================================================= */
.iqfm-table td .benny-form {
    max-width: 100%;
    margin: 0;
    width: 100%;
}

/* CSS Grid内の min-content 由来のはみ出し防止 (定石: min-width:0) */
.benny-form__info,
.benny-form__calc-grid {
    max-width: 100%;
    min-width: 0;
}

.benny-form__info-block,
.benny-form__calc-box {
    min-width: 0;
    overflow: hidden;
}

/* td 内のあらゆる子要素を親幅以内に */
.iqfm-table td * {
    max-width: 100%;
}

.benny-form {
    max-width: 760px;
    margin: 0 auto;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    background: #fff;
    box-sizing: border-box;
}

.benny-form *,
.benny-form *::before,
.benny-form *::after {
    box-sizing: border-box;
}

.benny-form__title {
    background: #2a64a6;
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 16px;
    margin: 0;
}

.benny-form__section {
    border-top: 1px solid #c8d6e5;
    padding: 10px 14px;
}

.benny-form__section:first-of-type {
    border-top: none;
}

.benny-form__section-title {
    background: #eaf2fb;
    border-left: 4px solid #2a64a6;
    padding: 4px 8px;
    margin: 0 0 8px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.benny-form__section-title .num {
    display: inline-block;
    background: #2a64a6;
    color: #fff;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
}

/* =================================================================
   共通: 〇/□ カスタム input スタイル
   ================================================================= */
.benny-form input[type="radio"],
.benny-form input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #2a64a6;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
    margin: 0;
    vertical-align: middle;
    transition: background .15s ease;
}

.benny-form input[type="checkbox"] {
    border-radius: 4px;
}

.benny-form input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: #2a64a6;
    border-radius: 50%;
}

.benny-form input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 6px;
    height: 12px;
    border: solid #2a64a6;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* =================================================================
   レイアウト Type A: 「ラベル + 価格 + 〇」の3列行
   (排雪料金/オプション②/早割③ のような単一option行)
   ================================================================= */
.benny-form__row {
    display: grid;
    grid-template-columns: 1fr 110px 36px;
    gap: 8px;
    align-items: center;
    padding: 6px;
    border-bottom: 1px dotted #d9e2ec;
    min-height: 36px;
}

.benny-form__row:last-child {
    border-bottom: none;
}

.benny-form__row .label {
    font-size: 13px;
}

.benny-form__row .price {
    text-align: right;
    font-weight: bold;
    color: #2a64a6;
}

.benny-form__row .price.minus {
    color: #d4380d;
}

/* CF7 出力ラッパーをコンパクトに、〇印だけ表示 */
.benny-form__row .wpcf7-form-control-wrap,
.benny-form__row .wpcf7-form-control,
.benny-form__row .wpcf7-list-item {
    display: inline-block;
    margin: 0 !important;
    padding: 0;
}

.benny-form__row .wpcf7-list-item label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    cursor: pointer;
}

/* CF7のラベルテキストは行内で重複するため非表示 */
.benny-form__row .wpcf7-list-item-label {
    display: none !important;
}

/* =================================================================
   レイアウト Type B: 複数オプションのリスト
   (継続割引④ のような複数option・ラベル左/価格中/〇右)
   ================================================================= */
.benny-form__list .wpcf7-form-control-wrap {
    display: block;
}

.benny-form__list .wpcf7-form-control {
    display: block;
}

.benny-form__list .wpcf7-list-item {
    display: block;
    margin: 0 !important;
    padding: 0;
    border-bottom: 1px dotted #d9e2ec;
}

.benny-form__list .wpcf7-list-item:last-child {
    border-bottom: none;
}

.benny-form__list .wpcf7-list-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    cursor: pointer;
    margin: 0;
}

.benny-form__list .wpcf7-list-item-label {
    flex: 1;
    font-size: 13px;
    order: 1;
}

/* CSS::afterで価格を中央列に挿入 (CF7のform-tagはdata属性を持てないため) */
.benny-form__list .wpcf7-list-item label::after {
    order: 2;
    text-align: right;
    font-weight: bold;
    color: #d4380d;
    min-width: 90px;
    font-size: 13px;
}

.benny-form__list .wpcf7-list-item input[type="radio"],
.benny-form__list .wpcf7-list-item input[type="checkbox"] {
    order: 3;
    margin-left: 0;
}

/* 継続割引④ 価格マッピング (年数→割引額・マイナスは¥なし) */
.benny-form__list label:has(input[value="2-3年"])::after   { content: "−500"; }
.benny-form__list label:has(input[value="4-5年"])::after   { content: "−800"; }
.benny-form__list label:has(input[value="6-7年"])::after   { content: "−1,000"; }
.benny-form__list label:has(input[value="8-9年"])::after   { content: "−1,200"; }
.benny-form__list label:has(input[value="10年"])::after    { content: "−1,500"; }
.benny-form__list label:has(input[value="11年"])::after    { content: "−1,800"; }
.benny-form__list label:has(input[value="12-18年"])::after { content: "−2,000"; }
.benny-form__list label:has(input[value="19年以降"])::after { content: "−2,500"; }

/* =================================================================
   レイアウト Type C: 用件 (お問い合わせ/お申込み) 横並び
   セクションタイトル無し、〇→ラベル の自然順
   ================================================================= */
.benny-form__inquiry-type {
    padding: 22px 32px;
    border-bottom: 1px solid #c8d6e5;
    background: #fff;
    display: flex;
    gap: 48px;
    align-items: center;
    justify-content: flex-start;
}

.benny-form__inquiry-type .wpcf7-form-control-wrap,
.benny-form__inquiry-type .wpcf7-form-control {
    display: inline-block;
}

.benny-form__inquiry-type .wpcf7-list-item {
    display: inline-block;
    margin: 0 48px 0 0 !important;
    padding: 0;
}

.benny-form__inquiry-type .wpcf7-list-item:last-child {
    margin-right: 0 !important;
}

.benny-form__inquiry-type .wpcf7-list-item label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
    padding: 6px 4px;
}

.benny-form__inquiry-type .wpcf7-list-item-label {
    font-size: 15px;
    font-weight: bold;
}

/* =================================================================
   レイアウト Type D: 排雪エリア (〇 → 「排雪エリア-」 → エリア名)
   ================================================================= */
.benny-form__area-list .wpcf7-form-control-wrap,
.benny-form__area-list .wpcf7-form-control {
    display: block !important;
    width: 100%;
}

.benny-form__area-list .wpcf7-list-item {
    display: block !important;
    width: 100%;
    margin: 0 !important;
    padding: 0;
    border-bottom: 1px solid #d9e2ec;
    box-sizing: border-box;
}

.benny-form__area-list .wpcf7-list-item:last-child {
    border-bottom: none;
}

.benny-form__area-list .wpcf7-list-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    margin: 0;
}

.benny-form__area-list .wpcf7-list-item-label {
    font-size: 13px;
    line-height: 1.5;
}

.benny-form__area-list .wpcf7-list-item-label::before {
    content: "排雪エリア- ";
    margin-right: 2px;
}

/* =================================================================
   お振込み口座 / 入金期日 情報ボックス (2カラム)
   ================================================================= */
.benny-form__info {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 10px;
    padding: 10px 14px;
}

.benny-form__info-block {
    background: #fff;
    border: 1px solid #d9e2ec;
    padding: 0;
    font-size: 12px;
    display: flex;
    flex-direction: column;
}

.benny-form__info-header {
    background: #fff;
    border-bottom: 1px solid #d9e2ec;
    padding: 6px 10px;
    font-weight: bold;
    font-size: 13px;
    color: #333;
    text-align: left;
}

.benny-form__info-header .note {
    display: inline-block;
    margin-left: 6px;
    color: #d4380d;
    font-weight: normal;
    font-size: 11px;
}

.benny-form__info-body {
    padding: 10px;
    flex: 1;
}

.benny-form__info-body .info-account {
    padding: 4px 0;
    font-size: 12px;
    line-height: 1.7;
}

.benny-form__info-body .info-account::before {
    content: "○ ";
    color: #2a64a6;
    font-weight: bold;
    margin-right: 4px;
}

.benny-form__info-body .deadline-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 13px;
    line-height: 1.6;
}

.benny-form__info-body .deadline-row .label {
    font-weight: bold;
}

.benny-form__info-body .deadline-note {
    margin-top: 8px;
    padding: 4px 0;
    font-size: 11px;
    color: #555;
    text-align: center;
}

.benny-form__info-body .deadline-note .emphasis {
    color: #d4380d;
    font-weight: bold;
}

/* =================================================================
   申込書 入力欄
   ================================================================= */
.benny-form__apply-title {
    padding: 6px 10px;
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.benny-form__apply-table {
    width: 100%;
    border-collapse: collapse;
}

.benny-form__apply-table th,
.benny-form__apply-table td {
    border: 1px solid #d9e2ec;
    padding: 6px 8px;
    font-size: 13px;
    vertical-align: middle;
}

.benny-form__apply-table th {
    background: #f0f5fa;
    width: 30%;
    text-align: left;
    font-weight: normal;
}

.benny-form__apply-table input[type="text"],
.benny-form__apply-table input[type="tel"],
.benny-form__apply-table input[type="email"],
.benny-form__apply-table input[type="number"],
.benny-form__apply-table textarea {
    border: 1px solid #c0c8d2;
    padding: 4px 6px;
    font-size: 13px;
    box-sizing: border-box;
    font-family: inherit;
}

.benny-form__apply-table input.w-full,
.benny-form__apply-table textarea.w-full {
    width: 100%;
}

.benny-form__apply-table input.w-sm {
    width: 60px;
}

.benny-form__apply-table input.w-md {
    width: 120px;
}

.benny-form__apply-table .row-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* CF7 form-tag出力のwrapper を素のinput感覚で扱う */
.benny-form__apply-table .wpcf7-form-control-wrap {
    display: inline-block;
}

/* =================================================================
   合計金額 (項目別5ボックス表示)
   ================================================================= */
.benny-form__calc {
    padding: 12px 14px;
    background: #fafbfc;
}

.benny-form__calc-formula {
    font-size: 12px;
    color: #555;
    margin: 0 0 8px;
    text-align: center;
}

.benny-form__calc-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    align-items: stretch;
}

.benny-form__calc-box {
    background: #fff;
    border: 1px solid #d9e2ec;
    padding: 10px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
}

.benny-form__calc-box .calc-label {
    font-size: 11px;
    color: #555;
    margin-bottom: 6px;
    line-height: 1.4;
}

.benny-form__calc-box .calc-value {
    font-size: 14px;
    font-weight: bold;
    color: #d4380d;
    word-break: keep-all;
}

.benny-form__calc-box--minus .calc-value {
    color: #d4380d;
}

.benny-form__calc-box--total {
    background: #fff;
    border: 2px solid #2a64a6;
    padding: 0;
    overflow: hidden;
}

/* 上部「合計金額」ラベルを青背景・白文字で帯状に */
.benny-form__calc-box--total .calc-label {
    color: #fff;
    background: #2a64a6;
    font-weight: bold;
    padding: 6px 4px;
    margin-bottom: 0;
}

.benny-form__calc-box--total .calc-value {
    color: #d4380d;
    font-size: 17px;
    padding: 8px 4px;
}

/* SP: <html class="sp"> 付与時 */
.sp .benny-form__calc-grid {
    grid-template-columns: repeat(2, 1fr);
}
.sp .benny-form__calc-box--total {
    grid-column: 1 / -1;
}

/* =================================================================
   送信ボタン
   ================================================================= */
.benny-form__submit-wrap {
    text-align: center;
    padding: 14px;
    background: #f0f5fa;
}

.benny-form .wpcf7-submit,
.benny-form__submit {
    background: #2a64a6;
    color: #fff;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s ease;
}

.benny-form .wpcf7-submit:hover,
.benny-form__submit:hover {
    background: #1d4a80;
}

/* =================================================================
   レスポンシブ
   ================================================================= */
/* SP: <html class="sp"> 付与時 */
.sp .benny-form__info {
    grid-template-columns: 1fr;
}

.sp .benny-form__row {
    grid-template-columns: 1fr 90px 32px;
    font-size: 1em;
}

.sp .benny-form__apply-table th {
    width: 35%;
    font-size: 1em;
}
