/* 基本スタイル */
body {
    font-family: 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', 'Meiryo', 'Arial', sans-serif;
    background-color: #F0F2F5;
    color: #333;
    margin: 0;
    padding: 20px 0;
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box; 
}

.form-container {
    max-width: 800px;
    width: 95%;
    background-color: #FFFFFF;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #E5EAF0;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #3A5FCD;
    padding-bottom: 20px;
}

header h1 {
    font-size: 2.2em;
    color: #3A5FCD;
    margin: 0;
}

header h2 {
    font-size: 1.5em;
    color: #555;
    margin: 10px 0 0 0;
    font-weight: 400;
}

/* フォーム要素 */
fieldset {
    border: none;
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #E5EAF0;
}

fieldset:last-of-type {
    border-bottom: none;
}

legend {
    font-size: 1.6em;
    font-weight: bold;
    color: #3A5FCD;
    padding: 0;
    margin-bottom: 20px;
    width: 100%;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #444;
}

.form-group-split {
    display: flex;
    gap: 20px;
}
.form-group-split .form-group {
    width: 50%;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box; 
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus {
    border-color: #3A5FCD;
    box-shadow: 0 0 8px rgba(58, 95, 205, 0.2);
    outline: none;
}

.form-note {
    font-size: 0.9em;
    color: #555;
    margin: 8px 0 0 0;
}

.required {
    font-size: 0.8em;
    font-weight: normal;
    background-color: #c0392b;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* 価格サマリー関連のCSS */
#price-summary-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #E5EAF0;
    margin-bottom: 25px; 
}

/* 価格とアップセルの横並びボックス */
.summary-main-box {
    display: flex;
    gap: 20px;
}

#price-summary {
    flex: 1;
    border-right: 1px solid #E5EAF0;
    padding-right: 20px;
}
/* #price-summary の直下のpのみ flex を適用 */
#price-summary > p {
    margin: 10px 0;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
}
#price-summary p span {
    font-weight: bold;
    color: #333;
    min-width: 100px;
    text-align: right;
}
#price-summary p #summary-total-price {
    font-size: 1.5em;
    color: #c0392b;
}

.total-price-section {
    /* このdivのマージンは、中のpのマージンを0にしたので、ここで調整 */
    margin: 10px 0;
}
.total-price-section p {
    margin: 0; /* マージンをリセット */
}
/* 合計金額の行にだけ flex を適用 */
.total-price-section > p:first-child {
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
}
/* 送料注釈の行 */
.summary-note {
    text-align: right;
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}

/* ▼▼▼【修正点1】特典の注釈（*1 など）のスタイル ▼▼▼ */
#price-summary p span span { /* #summary-live と #summary-live-note を含む親span */
    min-width: 0; /* min-widthをリセット */
    text-align: right;
}
.perk-note {
    font-size: 0.9em;
    margin-left: 4px;
    font-weight: normal; /* 太字解除 */
    color: #555;
}
/* ▲▲▲ 修正ここまで ▲▲▲ */


#upsell-message {
    flex: 1;
    padding-top: 1.5em; 
    font-size: 1.2em;
    color: #3A5FCD;
    font-weight: bold;
    text-align: center;
    line-height: 1.6;
}

/* 選択中DVDリストのボックス */
#selected-list-box {
    margin-top: 20px;
    border-top: 1px solid #E5EAF0;
    padding-top: 15px;
}
#selected-list-box strong {
    font-size: 1.1em;
    color: #333;
}

#selected-dvd-list {
    margin-top: 10px;
    max-height: 150px; 
    overflow-y: auto;
    background: #fff;
    border: 1px solid #E5EAF0;
    border-radius: 5px;
    padding: 10px;
}
.empty-list-message {
    font-style: italic;
    color: #777;
    margin: 0;
    padding: 5px 0;
}
.selected-dvd-item {
    font-size: 0.95em;
    padding: 4px 2px;
    border-bottom: 1px dashed #eee;
}
.selected-dvd-item:last-child {
    border-bottom: none;
}

.case-note {
    margin-top: 10px; 
    margin-bottom: 0;
}

/* ▼▼▼【修正点2】注釈の凡例エリアのスタイル ▼▼▼ */
.price-notes {
    margin-top: 20px;
    border-top: 1px solid #E5EAF0;
    padding-top: 15px;
    font-size: 0.9em;
    color: #555;
}
.price-notes p {
    margin: 5px 0 0 0;
    line-height: 1.5;
}
/* ▲▲▲ 修正ここまで ▲▲▲ */


/* DVDチェックリスト */
#dvd-checklist-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
    padding: 15px;
    background-color: #F8F9FA;
    border-radius: 8px;
    border: 1px solid #E5EAF0;
}
.dvd-check-item {
    display: flex;
    align-items: baseline;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.dvd-check-item:hover {
    background-color: #E9ECEF;
}
.dvd-check-item label {
    cursor: pointer;
    margin-left: 8px;
    margin-bottom: 0;
    font-weight: normal;
    line-height: 1.5; /* 行の高さを指定してベースラインを安定させる */
}
.dvd-check-item input {
    margin-top: 0;
    flex-shrink: 0; /* チェックボックスが縮まないようにする */
}

/* ラジオボタン */
.radio-group label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
    cursor: pointer;
}
.radio-group input {
    margin-right: 5px;
}

/* 発送先グループのスタイル */
.address-group {
    border: 1px solid #E5EAF0;
    border-radius: 8px;
    padding: 20px 25px 5px 25px; 
    margin-top: 30px;
    margin-bottom: 30px;
    background-color: #fdfdfd;
}

.group-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3A5FCD;
    text-align: left;
}

/* 同意事項 */
#agreements textarea {
    width: 100%;
    background: #fdfdfd;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    white-space: pre-wrap;
    font-size: 0.8em;
    color: #666;
}

/* ▼▼▼【ここを修正しました】▼▼▼ */
.agreement-check {
    display: flex;
    align-items: start; /* 上端揃え */
}

.agreement-check label {
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 0; 
    line-height: 1.4; /* テキストが折り返した時の行間 */
}
.agreement-check input {
    margin-right: 10px;
    transform: scale(1.2);
    flex-shrink: 0; /* チェックボックスが縮まないようにする */
    margin-top: 3px; /* テキストの1行目と高さを微調整 */
}
/* ▲▲▲【修正はここまで】▲▲▲ */


/* 送信ボタン */
.btn-submit {
    display: block;
    width: 100%;
    background-color: #e67e22; 
    color: #FFFFFF;
    border: none;
    padding: 20px 30px;
    font-size: 1.4em;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}
.btn-submit:hover {
    background-color: #d35400;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
}
.btn-submit:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .form-container {
        padding: 20px 25px;
    }
    .form-group-split {
        flex-direction: column;
        gap: 0;
    }
    .form-group-split .form-group {
        width: 100%;
        margin-bottom: 25px;
    }

    .summary-main-box {
        flex-direction: column; 
    }
    #price-summary {
        border-right: none;
        border-bottom: 1px solid #E5EAF0;
        padding-right: 0;
        padding-bottom: 20px;
    }

    #upsell-message {
        padding-top: 10px; 
    }
    .address-group {
        padding: 15px 20px 0 20px;
    }
    
    #dvd-checklist-container {
        grid-template-columns: 1fr;
    }
}

/* --- ライブバリデーション用スタイル --- */

/* エラーメッセージのスタイル */
.error-message {
    color: #c0392b; 
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 6px;
    min-height: 1em; 
}

/* エラー時の入力欄のスタイル */
input.invalid {
    border-color: #c0392b !important; 
    background-color: #fff8f8; 
}

/* エラー時のラジオボタン・チェックボックスのラベル */
.form-group.invalid label,
#dvd-checklist-container.invalid + .form-note { 
    color: #c0392b; 
}


/* --- 確認画面モーダル用スタイル --- */
.modal-overlay {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.modal {
    display: none; 
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #FFF;
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 101;
    width: 90%;
    max-width: 700px; 
    max-height: 85vh;
    overflow-y: auto;
    text-align: left; 
}

/* モーダル表示用のクラス */
.modal-open {
    display: block;
}

#confirm-modal h3 {
    font-size: 1.8em;
    color: #3A5FCD;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 2px solid #E5EAF0;
    padding-bottom: 10px;
}

#confirm-modal p {
    font-size: 1.1em;
    margin-bottom: 25px;
}

#confirm-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #E5EAF0;
    max-height: 50vh;
    overflow-y: auto;
}

#confirm-content dl {
}

#confirm-content dt {
    font-weight: bold;
    color: #555;
    padding-right: 0; 
    text-align: left; 
    margin-top: 15px; 
}
#confirm-content dl dt:first-of-type {
    margin-top: 0;
}


#confirm-content dd {
    margin: 0 0 15px 0; /* 下マージンでdd間のスペースを確保 */
    padding: 5px 0 15px 0; /* 上下のパディングを調整 */
    border-bottom: 1px solid #eee; 
    white-space: normal; /* pre-wrap を解除 */
    word-break: normal; /* break-all を解除 */
}

#confirm-content dd:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 新しいクラスのスタイル */
.confirm-perk-item, .confirm-note-item, .confirm-price-item {
    margin-bottom: 8px; /* 各行の間のスペース */
}
.confirm-note-item {
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
}
.confirm-shipping-note {
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}
/* 最後の要素の下マージンは不要 */
.confirm-perk-item:last-child, .confirm-note-item:last-child, .confirm-price-item:last-child {
    margin-bottom: 0;
}



#confirm-content dt.section-top {
    padding-top: 15px;
    border-top: 1px solid #E5EAF0; 
    margin-top: 15px; 
}
#confirm-content dd.section-top {
    padding-top: 5px; 
    border-top: none; 
    border-bottom: 1px solid #eee; 
}

.modal-button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 20px;
}

.modal-button-group .btn-secondary {
    width: 48%;
    margin: 0;
    padding: 15px 20px;
    font-size: 1.2em;
}

.modal-button-group .btn-submit {
    width: 48%;
    margin: 0;
    padding: 15px 20px;
    font-size: 1.2em;
}

@media (max-width: 600px) {
    #confirm-content dl {
    }
    #confirm-content dt {
    }
}

/* ▼▼▼ 追加（ここから） ▼▼▼ */
/* 規約文を折りたたむためのスタイル */
.terms-box {
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fdfdfd;
}

.terms-box summary {
    padding: 12px 15px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

.terms-box summary:hover {
    background: #f4f4f4;
}

.terms-content {
    padding: 0 15px 15px 15px;
    /* この中でスクロールさせます */
    max-height: 250px; 
    overflow-y: auto;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
    /* <textarea> のように改行を保持 */
    white-space: pre-wrap; 
}
/* ▲▲▲ 追加（ここまで） ▲▲▲ */


/* --- フォーム用フッター --- */
#form-footer {
    text-align: center;
    margin-top: 30px; 
    padding: 20px;
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
}

#form-footer a {
    color: #555;
    text-decoration: underline;
}

#form-footer a:hover {
    color: #3A5FCD;
}