@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #eef0f6;
    color: #495256;
    padding-bottom: 2rem; /* iframeの高さ自動調整用余白 */
}

/* メインコンテナ：iframeに美しく収まるサイズ設計 */
.main-container {
    max-width: 54rem;
    margin-top: 1rem;
    padding-left: 10px;
    padding-right: 10px;
}

.sim-title {
    color: #0e0d21;
    font-size: 1.35rem;
}

.glass-card {
    background: #ffffff;
    border: 1px solid #ece5df !important;
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(139, 94, 60, 0.1);
}

.section-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafc 100%);
}

.corner-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #495256;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-bottom-left-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 入力エリア */
.input-area {
    background-color: #dfe8ef;
    border: 1px solid #0052e3;
    border-radius: 12px;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* セレクトボックス共通デザイン（幅確保・文字省略対応） */
.custom-select {
    border: 1px solid #0052e3 !important;
    border-radius: 8px !important;
    font-weight: 700;
    color: #140b54;
    width: 100%;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.custom-select:focus {
    border-color: #0052e3 !important;
    box-shadow: none !important;
}

.custom-select option {
    color: #140b54 !important;
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .custom-select {
        font-size: 0.8rem;
    }
}

.custom-select-qty {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

/* 商品名 */
.fs-product-name {
    font-size: 0.8rem;
    font-weight: 700;
}
/* サイズ */
.fs-product-size {
    font-size: 0.8rem;
}

/* ===== ② 冊数ラベルを折り返さないようにする ===== */
#book_count,
.input-area .row.align-items-center label {
    white-space: nowrap;
}

/* 結果表示エリア */
.result-area {
    background-color: #ffffff;
    border: 2px dashed #2f6fbc;
    border-radius: 16px;
}
.result-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #495256;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap; /* 折り返し禁止 */
}
.result-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #495256;
    white-space: nowrap; /* 折り返し禁止 */
}
.result-label-discount {
    font-size: 0.9rem;
    font-weight: 700;
    color: #dc3545;
    white-space: nowrap; /* 折り返し禁止 */
}

/* 単価表示・数値の強調デザイン */
.result-unit {
    font-size: 0.75rem;
    white-space: nowrap; /* 折り返し禁止 */
}
.unit-price-highlight {
    font-size: 0.95rem;
    font-weight: 700;
    color: #495256;
    margin-left: 1px;
    margin-right: 1px;
}
.unit-price-highlight-discount {
    font-size: 0.95rem;
    font-weight: 700;
    color: #dc3545;
    margin-left: 1px;
    margin-right: 1px;
}

/* 合計金額表示 */
.result-total {
    font-size: 1.5rem;
    font-weight: 900;
    color: #495256;
    display: block;
}
.result-total-discount {
    font-size: 1.5rem;
    font-weight: 900;
    color: #dc3545;
    display: block;
}
.result-row {
    border-bottom: 1px solid #2f6fbc;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* おトク額表示の専用デザイン */
.saving-badge {
    background-color: #f5f9fc;
    color: #2f6fbc;
    border: 1px solid #2f6fbc;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.6rem;
    white-space: nowrap; /* 折り返し禁止 */
}

/* 結果エリア下部の補足テキスト用スタイル */
.result-note {
    font-size: 0.85rem;
    line-height: 1.2;
    display: block;
    font-weight: 700;
    white-space: nowrap; /* 折り返し禁止 */
}

/* 商品画像ディスプレイ枠 */
.image-preview-box {
    background-color: #fff;
    border: 1px solid #0052e3;
    border-radius: 8px;
    padding: 10px;
    margin: 0 auto;
    width: 75%;
    height: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* プレビュー画像（アスペクト比維持とフェードインアニメーション用） */
.image-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* 詳細はこちらボタン */
.btn-detail {
    display: inline-flex;
    align-items: center;
    color: #1a56b8 !important;
    background-color: #fff;
    border: 1.5px solid #1a56b8;
    border-radius: 8px;
    padding: 0.5rem 1.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none !important;
}
.btn-detail:hover {
    background-color: #1a56b8;
    color: #fff !important;
    border-color: #164a9e;
    box-shadow: 0 2px 6px rgba(26, 86, 184, 0.3);
}
.btn-detail:active {
    background-color: #164a9e;
    border-color: #164a9e;
    color: #fff !important;
}

/* モーダル内画像用の余白調整（任意） */
#imageModal .modal-body img {
    max-height: 75vh;
    object-fit: contain;
}

/* ==========================================================
   画像拡大モーダル関連の追加スタイル
   ========================================================== */

/* 1. モーダルタイトルの文字サイズ調整（スマホで折り返さないように） */
.modal-title-custom {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
    .modal-title-custom {
        font-size: 0.8rem;
    }
}

/* 2. モーダル自体・画像の拡大表示（iframe埋め込み時にも大きく見せる） */
#imageModal .modal-dialog {
    max-width: 700px;
    width: 90%;
}

#imageModal .modal-body {
    padding: 2rem;
}

#imageModal .modal-body img {
    max-height: 70vh;
    width: 100%;
    object-fit: contain;
}

/* 3. モーダルを画面中央に固定表示させる対応（横スクロール防止も含む） */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

#imageModal {
    left: 0;
    right: 0;
    margin: 0 auto;
}

#imageModal .modal-dialog {
    margin-left: auto;
    margin-right: auto;
}

/* モーダル表示中はピンチズーム操作自体を禁止する */
#imageModal {
    touch-action: none;
}

#imageModal .modal-dialog,
#imageModal .modal-content,
#imageModal .modal-body {
    touch-action: none;
}

/* 画像自体もピンチズーム対象から除外 */
#imageModal .modal-body img {
    touch-action: none;
}

/* スマホ表示時のみタイトルを改行させる */
.sp-only {
    display: none;
}

@media (max-width: 767.98px) {
    .sp-only {
        display: inline;
    }
}

/* ==========================================================
   スマホ幅（iPhone実機・iframe埋め込み時）での
   左右余白調整・折り返し防止用の追加スタイル
   ========================================================== */
@media (max-width: 575.98px) {

    /* メインコンテナの左右余白をさらに詰めて表示スペースを確保 */
    .main-container {
        padding-left: 6px;
        padding-right: 6px;
    }

    /* 入力エリアの左右余白を詰める */
    .input-area {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    /* 「② 冊数」ラベル列を文字量に応じた幅（auto）に変更し、
       折り返しを防止しつつセレクトボックス側に余った幅を渡す */
    .row.align-items-center.g-2 > .col-3 {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap;
        padding-right: 0.25rem;
    }
    .row.align-items-center.g-2 > .col-9 {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }

    /* 結果エリアの左右余白を詰める */
    .result-area {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    /* 「価格シミュレーション結果」の文字サイズ・文字間を縮小して1行に収める */
    .result-title {
        font-size: 0.8rem;
        letter-spacing: 0.02em;
    }

    /* 「（1冊あたり○○円）」を縮小して1行に収める */
    .result-unit {
        font-size: 0.68rem;
    }

    /* 補足テキスト（早割取扱期間など）を縮小して1行に収める */
    .result-note {
        font-size: 0.72rem;
    }

    /* 「通常価格：」「早割価格：」を縮小して1行に収める */
    .result-label,
    .result-label-discount {
        font-size: 0.78rem;
    }

    /* 「早割5%OFFで 1,400 円お得！」を縮小して1行に収める */
    .saving-badge {
        font-size: 0.72rem;
        padding: 0.5rem 0.4rem;
    }
}