/* CSS変数定義（レスポンシブでも調整可能） */
:root {
    --base-font-size: 16px;
    --header-font-size: 24px;
    --subheader-font-size: 15px;
    --button-font-size: 16px;
    --calendar-title-size: 20px;
    --calendar-description-size: 14px;
    --calendar-height: 600px;
    --container-padding: 40px;
    --form-padding: 30px 40px;
}

/* 基本スタイル */
html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #f7f8fa;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: var(--container-padding);
    padding-bottom: 40px; /* 下部に余白を追加 */
    font-size: var(--base-font-size);
    min-height: 100%;
    box-sizing: border-box;
}

/* フォームコンテナ */
.form-container {
    max-width: 720px;
    margin: 0 auto;
    background-color: #fff;
    padding: var(--form-padding);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    box-sizing: border-box;
    width: 100%;
}

/* ヘッダー */
.form-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}
.form-header h1 {
    font-size: var(--header-font-size);
    font-weight: 700;
    margin: 0 0 10px;
}
.form-header p {
    font-size: var(--subheader-font-size);
    color: #555;
    margin: 0;
}

/* --- ここから追加・修正したスタイル --- */

/* 進捗インジケーター */
.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}
.step {
    text-align: center;
    width: 100px; /* アイコンとテキストの幅を確保 */
    position: relative;
}
.step-icon {
    width: 30px;
    height: 30px;
    background-color: #ddd;
    color: #fff;
    border-radius: 50%;
    line-height: 30px;
    font-weight: bold;
    margin: 0 auto 8px;
    transition: background-color 0.3s;
}
.step p {
    font-size: 13px;
    color: #888;
    margin: 0;
    font-weight: 500;
}
.step.active .step-icon,
.step.completed .step-icon {
    background-color: #E70000; /* MeRaise Red */
}
.step.active p {
    color: #333;
}
.step-line {
    flex-grow: 1;
    height: 2px;
    background-color: #ddd;
    margin: 14px 0 0;
    transition: background-color 0.3s;
}
.step.completed + .step-line {
    background-color: #E70000;
}

/* フォームステップ */
.form-step {
    display: none;
}
.form-step.active-step {
    display: block;
}

/* ナビゲーションボタン */
.navigation-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}
.btn {
    width: 100%;
    max-width: 250px;
    background-color: #E70000;
    color: #fff;
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(231, 0, 0, 0.2);
}
.btn:hover {
    background-color: #C50000;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(231, 0, 0, 0.3);
}
.btn-prev {
    background-color: #aaa;
}
.btn-prev:hover {
    background-color: #999;
}
#form-step-3 .submit-container {
    margin-top: 0;
    width: 100%;
}
#form-step-3 .navigation-buttons {
    align-items: center;
}
.submit-btn {
    width: 100%;
    max-width: 250px;
}
/* エラーメッセージ */
.error-message {
    color: #e53935;
    font-size: 12px;
    margin-top: 5px;
}
/* --- ここまで追加・修正したスタイル --- */


/* フォームセクション */
.form-section {
    margin-bottom: 20px;
}

/* フォームグループ */
.form-group {
    margin-bottom: 25px;
}
.label-title {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}
.required {
    color: #fff;
    background-color: #E70000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}
.private-info {
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

/* 入力フィールド */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
    background-color: #f7f8fa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: #E70000; /* MeRaise Red */
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(231, 0, 0, 0.1);
}

.form-row {
    display: flex;
    gap: 15px;
}
.form-row input {
    flex: 1;
}

.form-note {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* ラジオボタン */
.radio-group {
    display: flex;
    gap: 20px;
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
input[type="radio"] {
    width: 18px;
    height: 18px;
}

/* 同意セクション */
.agreement-section {
    background-color: #f7f8fa;
    padding: 20px;
    border-radius: 5px;
    margin: 30px 0;
}
.agreement-text {
    font-size: 13px;
    color: #555;
    margin: 0 0 20px;
}
.agreement-check {
    text-align: center;
}

.agreement-check label {
    display: flex;
    align-items: flex-start; /* 項目を上部に揃える */
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    text-align: left; /* テキストを左揃えにする */
}


input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* 送信ボタン */
.submit-container {
    text-align: center;
    margin-top: 20px;
}
.submit-btn {
    width: 100%;
    max-width: 320px;
    background-color: #E70000;
    color: #fff;
    border: none;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(231, 0, 0, 0.3);
}
.submit-btn:hover {
    background-color: #C50000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 0, 0, 0.4);
}

/* サクセスヘッダー */
.success-header {
    text-align: center;
    padding: 20px 0;
}

/* カレンダーセクション */
.calendar-section {
    margin: 30px 0;
}

.calendar-title {
    text-align: center;
    font-size: var(--calendar-title-size);
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

.calendar-description {
    text-align: center;
    font-size: var(--calendar-description-size);
    color: #666;
    margin-bottom: 20px;
}

.calendar-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.calendar-container iframe {
    width: 100%;
    max-width: 100%;
    height: var(--calendar-height);
    border: 0;
    display: block;
}

.back-button-container {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.back-to-top-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #E70000;
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: var(--button-font-size);
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(231, 0, 0, 0.2);
}

.back-to-top-btn:hover {
    background-color: #C50000;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(231, 0, 0, 0.3);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    :root {
        --base-font-size: 15px;
        --header-font-size: 22px;
        --subheader-font-size: 14px;
        --button-font-size: 16px;
        --calendar-title-size: 20px;
        --calendar-description-size: 14px;
        --calendar-height: 550px;
        --container-padding: 15px;
        --form-padding: 20px 15px;
    }

    body {
        padding: var(--container-padding);
        padding-bottom: 30px; /* 下部に余白を追加 */
        font-size: var(--base-font-size);
        min-height: auto;
    }

    .form-container {
        padding: var(--form-padding);
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        margin-bottom: 20px; /* 下部に余白を追加 */
    }

    .form-header {
        margin-bottom: 25px;
        padding-bottom: 15px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .form-header h1 {
        font-size: 18px; /* レスポンシブ時に小さく */
        line-height: 1.4;
        margin-bottom: 12px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .form-header p {
        font-size: var(--subheader-font-size);
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 進捗バーの改善 */
    .progress-bar {
        width: 100%;
        margin-bottom: 30px;
        padding: 0 5px;
    }

    .step {
        flex: 1;
        min-width: 0;
    }

    .step-icon {
        width: 32px; /* レスポンシブ時に小さく */
        height: 32px;
        line-height: 32px;
        font-size: 14px; /* レスポンシブ時に小さく */
        margin-bottom: 6px;
    }

    .step p {
        font-size: 9px; /* レスポンシブ時に小さくして画面内に収める */
        line-height: 1.3;
        word-break: keep-all;
    }

    .step-line {
        margin-top: 18px;
        height: 3px;
    }

    /* フォームグループの改善 */
    .form-group {
        margin-bottom: 22px;
    }

    .label-title {
        font-size: 14px;
        margin-bottom: 10px;
        font-weight: 600;
    }

    /* 入力フィールドの改善 */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    select {
        padding: 14px 16px;
        font-size: 16px; /* iOSでズームを防ぐため16px以上 */
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }

    .form-row {
        flex-direction: column;
        gap: 22px;
    }

    /* ラジオボタンとチェックボックスの改善 */
    .radio-group {
        flex-direction: column;
        gap: 15px;
    }

    .radio-label {
        padding: 12px;
        background-color: #f7f8fa;
        border-radius: 8px;
        transition: background-color 0.2s;
    }

    .radio-label:active {
        background-color: #e8e9ea;
    }

    input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    /* 同意セクションの改善 */
    .agreement-section {
        padding: 18px 15px;
        margin: 25px 0;
        border-radius: 8px;
    }

    .agreement-text {
        font-size: 13px;
        line-height: 1.7;
        margin-bottom: 15px;
    }

    .agreement-check {
        text-align: left;
    }

    .agreement-check label {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        font-size: 13px;
        line-height: 1.6;
        padding: 10px;
        cursor: pointer;
    }

    input[type="checkbox"] {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        margin-top: 2px;
    }

    /* ナビゲーションボタンの改善 */
    .navigation-buttons {
        flex-direction: column;
        gap: 12px;
        margin-top: 30px;
    }

    .btn {
        width: 100%;
        max-width: 100%;
        padding: 16px 20px;
        font-size: var(--button-font-size);
        font-weight: 700;
        border-radius: 50px;
        min-height: 52px; /* タップしやすいサイズ */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .submit-btn {
        width: 100%;
        max-width: 100%;
        padding: 16px 20px;
        font-size: var(--button-font-size);
        min-height: 52px;
    }

    #form-step-3 .navigation-buttons {
        flex-direction: column-reverse;
    }

    /* サクセスヘッダーの改善 */
    .success-header {
        padding: 15px 0;
        margin-bottom: 20px;
    }

    .success-header h1 {
        font-size: 22px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    .success-header p {
        font-size: 14px;
        line-height: 1.7;
    }

    /* カレンダーセクションの改善 */
    .calendar-section {
        margin: 25px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .calendar-title {
        font-size: var(--calendar-title-size);
        margin-bottom: 12px;
        line-height: 1.4;
        text-align: center;
    }

    .calendar-description {
        font-size: var(--calendar-description-size);
        margin-bottom: 18px;
        line-height: 1.6;
        text-align: center;
    }

    .calendar-container {
        width: 90%;
        max-width: 500px; /* レスポンシブ時に最大幅を制限 */
        border-radius: 8px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .calendar-container iframe {
        width: 100%;
        height: 400px; /* レスポンシブ時に高さを小さく */
        min-height: 400px;
        max-height: 400px;
    }

    /* 戻るボタンの改善 */
    .back-button-container {
        margin-top: 25px;
        padding-top: 20px;
    }

    .back-to-top-btn {
        width: 100%;
        max-width: 100%;
        padding: 16px 20px;
        font-size: var(--button-font-size);
        font-weight: 700;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50px;
    }

    .back-to-top-btn:active {
        transform: scale(0.98);
    }

    /* エラーメッセージの改善 */
    .error-message {
        font-size: 13px;
        margin-top: 6px;
        padding-left: 4px;
    }
}

/* より小さな画面（iPhone SEなど）への対応 */
@media (max-width: 375px) {
    :root {
        --header-font-size: 20px;
        --calendar-title-size: 18px;
        --calendar-height: 500px;
        --container-padding: 12px;
        --form-padding: 18px 12px;
    }

    body {
        padding: var(--container-padding);
        padding-bottom: 25px; /* 下部に余白を追加 */
    }

    .form-container {
        padding: var(--form-padding);
        margin-bottom: 15px; /* 下部に余白を追加 */
    }

    .step-icon {
        width: 28px; /* より小さな画面でさらに小さく */
        height: 28px;
        line-height: 28px;
        font-size: 12px; /* より小さな画面でさらに小さく */
    }

    .step p {
        font-size: 8px; /* より小さな画面でさらに小さく */
    }

    .form-header h1 {
        font-size: 16px; /* より小さな画面でさらに小さく */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* カレンダーセクションの改善（より小さな画面） */
    .calendar-container {
        width: 85%;
        max-width: 400px; /* より小さな画面でさらに小さく */
    }

    .calendar-container iframe {
        height: 350px; /* より小さな画面でさらに小さく */
        min-height: 350px;
        max-height: 350px;
    }

    .calendar-title {
        font-size: 16px;
    }

    .calendar-description {
        font-size: 12px;
    }
}