/* --- レイアウトのベース --- */
.contact-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    color: #333;
}

.form-item {
    display: flex;
    flex-direction: column; /* モバイル：縦並び */
    margin-bottom: 24px;
}

/* エラー時の枠組み調整 */
.form-item.is-error {
    margin-bottom: 30px;
}

/* 項目名のラベル（左側） */
.form-item label:first-child {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
}

/* --- テキスト入力・セレクト・テキストエリアの統合デザイン --- */
input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid #ccc !important;
    border-radius: 4px;
    background-color: #fff !important;
    box-sizing: border-box;
    appearance: auto !important;
    -webkit-appearance: menulist !important;
}

/* --- バリデーション連動スタイル --- */
.is-error input[type="text"],
.is-error input[type="email"],
.is-error select,
.is-error textarea {
    background-color: #fff5f5 !important;
    border-color: #e74c3c !important;
}

.error-text {
    display: none;
    margin-top: 8px;
    margin-bottom: 0;
    color: #e74c3c;
    font-size: 13px;
    font-weight: bold;
}

.is-error .error-text {
    display: block;
}

/* --- 高さの統一設定 --- */
input[type="text"],
input[type="email"],
select {
    height: 48px;
}

textarea {
    min-height: 150px;
}

/* --- ラジオボタンの配置調整 --- */
.form-item div.radio-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center; 
    min-height: 48px;
    padding-top: 10px;
    box-sizing: border-box;
}

/* 選択肢のラベル */
.form-item .radio-group label {
    display: inline-flex;
    align-items: center;
    width: auto !important;
    margin-right: 24px;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    font-weight: normal !important;
    line-height: 1.5;
    cursor: pointer;
}

input[type="radio"] {
    position: relative;
    flex-shrink: 0;
    top: -1px; 
    width: 18px !important;
    height: 18px !important;
    margin: 0 6px 0 0 !important;
    padding: 0 !important;
    appearance: radio !important;
    -webkit-appearance: radio !important;
    cursor: pointer;
}

/* ラジオボタン群にエラーがある場合 */
.is-error .radio-group {
    padding: 10px 15px;
    background-color: #fff5f5;
    border-radius: 4px;
    border: 1px solid #e74c3c;
    box-sizing: border-box;
}

/* --- 必須ラベル --- */
.required {
    margin-left: 8px;
    padding: 2px 6px;
    background: #e74c3c;
    font-size: 11px;
    color: #fff;
    border-radius: 3px;
    white-space: nowrap;
}

/* --- ボタン周り（左右配置調整版） --- */
.btn-group {
    display: flex;
    flex-direction: column; /* モバイルでは縦並び */
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    text-align: center;
}

.btn-submit, .btn-back {
    display: inline-block;
    min-width: 220px;
    padding: 15px 40px;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    text-align: center;
    cursor: pointer;
}

/* 右側：進むボタン（確認画面へ・送信する） */
.btn-submit { 
    background: #2ecc71; 
    color: white; 
    border-bottom: 3px solid #27ae60; 
}

/* 左側：戻るボタン（修正する・戻る） */
.btn-back { 
    background: #546e7a; 
    color: white; 
    border-bottom: 3px solid #37474f; 
}

.btn-submit:hover, .btn-back:hover { 
    opacity: 0.85; 
    transform: translateY(2px); 
    border-bottom-width: 1px; 
}

/* --- PCレイアウト (min-width: 768px) 用の最適化 --- */
@media (min-width: 768px) {
    .form-item {
        flex-direction: row; 
        align-items: flex-start;
        flex-wrap: wrap;
    }

    /* 項目名ラベル */
    .form-item > label:first-child {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        width: 250px; 
        margin-bottom: 0;
        padding-top: 12px; 
    }

    /* ラジオボタン・グループ */
    .form-item div.radio-group {
        flex: 1;
        padding-top: 10px;
    }

    input[type="text"],
    input[type="email"],
    select,
    textarea,
    .input-group,
    #dynamic-fields {
        flex: 1;
        min-width: 0;
    }

    /* エラーメッセージ */
    .error-text {
        width: 100%;
        margin-left: 250px;
        padding-top: 5px;
    }

    /* PCではボタンを横並び（左：修正 / 右：送信）にする */
    .btn-group {
        flex-direction: row; /* row-reverseからrowに変更 */
        justify-content: center;
        gap: 20px;
    }
}

/* --- 動的フィールド --- */
#dynamic-fields .form-item {
    margin-bottom: 20px;
}

/* --- 確認画面 --- */
.confirm-table {
    width: 100%;
    margin-top: 26px;
    margin-bottom: 30px;
    border-collapse: collapse;
    border-top: 2px solid #333;
}
@media (min-width: 768px) {
    .confirm-table {
        margin-top: 56px;
    }
}

.confirm-table th, .confirm-table td {
    padding: 18px 15px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}
.confirm-table th {
    width: 30%;
    background: #f8f9fa;
    font-weight: bold;
}
.confirm-table td {
    background: #fff;
}

.thanks-msg p {
    margin-top: 26px;
}
@media (min-width: 768px) {
    .thanks-msg p {
        margin-top: 56px;
    }
}

.thanks-page-button {
    margin-top: 30px;
    text-align: center;
}
