/*
 * 回答フォームの質問の並び。回答者サイトの入力画面と、管理サイトのプレビューが同じ見た目で使う
 * 色と寸法はこのファイルの中で閉じる。読み込む側のスタイルシートに変数を求めない
 */
.ef {
    --ef-surface: #ffffff;
    --ef-subtle: #f6f6f6;
    --ef-border: #dddddd;
    --ef-strong: #000000;
    --ef-text: #000000;
    --ef-text-secondary: #666666;
    --ef-placeholder: #aaaaaa;
    --ef-error: #e5484d;
    --ef-error-bg: #fff1f1;

    color: var(--ef-text);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: left;
}

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

/* ---- 区切りの見出し ---- */

.ef-section {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 56px 0 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ef-strong);
}

.ef-section:first-child {
    margin-top: 0;
}

.ef-section-no {
    font-size: 14px;
    font-weight: 900;
    color: var(--ef-placeholder);
}

.ef-section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

/* ---- 質問 ---- */

.ef-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 28px 0 0;
    min-width: 0;
}

.ef-field:first-child {
    margin-top: 0;
}

/* 住所のように、質問の中にさらに見出し付きの欄が並ぶもの */
.ef-group {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.ef-sub {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* 確認用の欄は、見た目の上では独立した質問と同じ間隔で並べる */
.ef-field > .ef-sub {
    margin-top: 18px;
}

.ef-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.ef-badge {
    flex: none;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--ef-text-secondary);
    border: 1px solid var(--ef-border);
    border-radius: 3px;
    white-space: nowrap;
}

.ef-badge.is-required {
    color: #ffffff;
    background: var(--ef-strong);
    border-color: var(--ef-strong);
}

/* 管理者が入力した改行をそのまま見せる */
.ef-help {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--ef-text-secondary);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* 選べる数の案内。テンプレートの改行を見せない */
.ef-help.is-inline {
    white-space: normal;
}

.ef-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--ef-error);
}

.ef-error img {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

/* ---- 入力欄 ---- */

.ef-input,
.ef-select,
.ef-textarea {
    display: block;
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    /* 16px未満だとiOSが入力のたびに画面を拡大する */
    font: inherit;
    font-size: 16px;
    color: var(--ef-text);
    background-color: var(--ef-subtle);
    border: 1px solid transparent;
    border-radius: 10px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.ef-textarea {
    height: 140px;
    padding: 12px 14px;
    line-height: 1.5;
    resize: vertical;
}

.ef-select {
    padding-right: 40px;
    background-image: url("/img/form/chevron-down.svg");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px 18px;
    cursor: pointer;
}

/* 未選択のプルダウンは入力例と同じ薄い色で見せる */
.ef-select:invalid,
.ef-select.is-empty {
    color: var(--ef-placeholder);
}

.ef-select option {
    color: var(--ef-text);
}

.ef-input::placeholder,
.ef-textarea::placeholder {
    color: var(--ef-placeholder);
    opacity: 1;
}

.ef-input:focus-visible,
.ef-select:focus-visible,
.ef-textarea:focus-visible {
    border-color: var(--ef-strong);
    background-color: var(--ef-surface);
}

.ef-input:disabled,
.ef-select:disabled,
.ef-textarea:disabled {
    opacity: 1;
    cursor: default;
}

/* 住所は誤りのある欄だけを赤くする */
.ef-field.is-invalid .ef-input,
.ef-field.is-invalid .ef-select,
.ef-sub.is-invalid .ef-input,
.ef-sub.is-invalid .ef-select,
.ef-field.is-invalid .ef-textarea {
    background-color: var(--ef-error-bg);
    border-color: var(--ef-error);
}

.ef-row {
    display: flex;
    gap: 12px;
    min-width: 0;
}

.ef-row > * {
    flex: 1 1 0;
}

.ef-row.is-tight {
    gap: 8px;
}

.is-w220 {
    max-width: 220px;
}

.is-w280 {
    max-width: 280px;
}

/* 住所の都道府県は、画面の幅に関わらず他の欄と幅を揃える */
.is-pref {
    max-width: none;
}

/* ---- 選択肢 ---- */

.ef-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ef-chip {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

/* 見た目はspanが担う。入力そのものは隠すが、キーボードで選べるよう画面からは消さない */
.ef-chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.ef-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 4px 22px;
    font-size: 14px;
    font-weight: 500;
    background: var(--ef-surface);
    border: 1px solid var(--ef-border);
    border-radius: 22px;
    overflow-wrap: anywhere;
}

.ef-chip input:checked + span {
    color: #ffffff;
    background: var(--ef-strong);
    border-color: var(--ef-strong);
}

.ef-chip input:focus-visible + span {
    outline: 2px solid var(--ef-strong);
    outline-offset: 2px;
}

.ef-field.is-invalid .ef-chip span {
    border-color: var(--ef-error);
}

.ef-checks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ef-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
}

.ef-check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    background-color: var(--ef-surface);
    border: 1px solid var(--ef-border);
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.ef-check input:checked {
    background: var(--ef-strong) url("/img/form/check.svg") center / 14px 14px no-repeat;
    border-color: var(--ef-strong);
}

.ef-check input:focus-visible {
    outline: 2px solid var(--ef-strong);
    outline-offset: 2px;
}

.ef-check span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ef-check input:disabled,
.ef-chip input:disabled {
    cursor: default;
}

/* ---- 同意を求める項目 ---- */

.ef-agreements {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ef-agreements-lead {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
}

.ef-doc {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 規約の本文。全文を広げると入力欄より長くなるので、枠の高さを決めて中でスクロールさせる */
.ef-doc-body {
    height: 180px;
    margin: 0;
    padding: 14px 24px 14px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.7;
    color: var(--ef-text-secondary);
    background: var(--ef-subtle);
    border-radius: 10px;
    /* 管理者が入力した改行と空行をそのまま見せる */
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ef-doc-body:focus-visible {
    outline: 2px solid var(--ef-strong);
    outline-offset: 2px;
}

.ef-agreements .ef-check {
    gap: 10px;
    font-size: 15px;
}

/* ---- 住所検索のボタン ---- */

.ef-pill {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 140px;
    padding: 0 20px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ef-text);
    background: var(--ef-surface);
    border: 1px solid var(--ef-strong);
    border-radius: 22px;
    white-space: nowrap;
    cursor: pointer;
}

.ef-pill:disabled {
    color: var(--ef-placeholder);
    border-color: var(--ef-border);
    cursor: default;
}

.ef-zip-row {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.ef-zip-row .ef-input {
    flex: 1 1 0;
}

/* 狭い画面では余白と見出しを詰める */
@media (max-width: 767px) {
    .ef-section {
        margin-top: 44px;
    }

    .ef-section-title {
        font-size: 18px;
    }

    .ef-field {
        margin-top: 22px;
    }

    .ef-group {
        gap: 22px;
    }

    .ef-field > .ef-sub {
        margin-top: 12px;
    }

    .ef-pill {
        min-width: 116px;
    }

    .is-w280 {
        max-width: 200px;
    }
}

/* ---- メールアドレスの認証 ---- */

.ef-verify {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--ef-subtle);
    border-radius: 8px;
}

.ef-verify-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.ef-verify-row .ef-input {
    flex: 1;
    max-width: 200px;
}

.ef-verify-button {
    flex: none;
    height: 44px;
    padding: 0 18px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--ef-text);
    background: var(--ef-surface);
    border: 1.5px solid var(--ef-strong);
    border-radius: 22px;
    cursor: pointer;
}

.ef-verify-link {
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--ef-text-secondary);
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

.ef-verified {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ef-text);
}

.ef-verified::before {
    content: "✓ ";
}
