/* ========================================
   Adobe製品 概算コストシミュレーター
   スタイルシート
   
   ※このCSSは.simulator内にスコープ限定しています。
   ※既存のヘッダー・フッターには影響しません。
======================================== */

/* リセット・基本設定（.simulator内にスコープ限定） */
.simulator *,
.simulator *::before,
.simulator *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 既存CSSのh1/h2/h3/btnスタイルをリセット */
.simulator h1 {
    padding: 0;
    font-size: inherit;
    color: inherit;
    border-bottom: none;
    font-family: inherit;
    margin-bottom: 0;
    letter-spacing: normal;
}

.simulator h2 {
    border-top: none;
    border-bottom: none;
    padding: 0;
    background-image: none;
    font-size: inherit;
    margin-top: 0;
    margin-bottom: 0;
    font-family: inherit;
    background-color: transparent;
    color: inherit;
}

.simulator h3 {
    border-bottom: none;
    padding: 0;
    font-size: inherit;
    margin-top: 0;
    margin-bottom: 0;
    color: inherit;
    font-family: inherit;
    background: transparent;
}

.simulator .btn {
    box-shadow: none;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
}

/* ユーティリティ */
.sp-only {
    display: none;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .sp-only {
        display: inline;
    }
    .mobile-only {
        display: flex;
    }
}

/* ========================================
   シミュレーター全体
======================================== */
.simulator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    /* 元bodyのスタイルをここに移動 */
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    font-size: 16px; /* emの基準となるサイズを明示的に設定 */
    line-height: 1.6;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ヘッダー */
.simulator-header {
    text-align: center;
    margin-bottom: 40px;
}

.simulator .simulator-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .simulator .simulator-header h1 {
        font-size: 1.75em;
    }
}

/* ========================================
   ステップインジケーター
======================================== */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.step-item.active {
    opacity: 1;
}

.step-item.active .step-label {
    color: #E53935;
}

.step-item.active .step-name {
    color: #E53935;
}

.step-label {
    font-size: 0.875em;
    font-weight: 700;
    color: #000;
}

.step-name {
    font-size: 0.75em;
    color: #000;
}

.step-line {
    flex: 1;
    max-width: 120px;
    height: 2px;
    background-color: #ddd;
    margin: 0 16px;
    transition: background-color 0.3s ease;
}

.step-line.completed {
    background-color: #E53935;
}

@media (max-width: 768px) {
    .step-indicator {
        padding: 0;
    }
    
    .step-line {
        max-width: 60px;
        margin: 0 8px;
    }
    
    .step-label {
        font-size: 0.75em;
    }
    
    .step-name {
        font-size: 0.625em;
    }
}

/* ========================================
   ステップコンテンツ共通
======================================== */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.step-container {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 40px;
    box-shadow: none;
}

@media (max-width: 768px) {
    .step-container {
        padding: 24px 16px;
    }
}

.step-instruction {
    text-align: center;
    font-size: 1.375em;
    font-weight: 600;
    color: #333;
    margin-bottom: 32px;
}

.plan-display {
    text-align: center;
    font-size: 1em;
    margin-bottom: 32px;
}

.plan-name {
    color: #E53935;
    font-weight: 700;
    font-size: 1.25em;
}

/* ========================================
   STEP1: プラン診断
======================================== */
.question-block {
    margin-bottom: 60px;
}

.question-block:last-of-type {
    margin-bottom: 32px;
}

.simulator .question-title {
    font-size: 1.125em;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

/* IP補償の説明ボックス */
.ip-notice {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 24px;
}

.ip-notice-title {
    font-size: 0.875em;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.ip-notice-text {
    font-size: 0.875em;
    color: #000;
    line-height: 1.6;
}

/* 回答オプション */
.answer-options {
    display: flex;
    gap: 16px;
}

@media (max-width: 768px) {
    .answer-options {
        flex-direction: column;
    }
}

.answer-option {
    flex: 1;
    cursor: pointer;
}

.answer-option input {
    display: none;
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.2s ease;
    min-height: 100px;
}

.answer-option:hover .option-content {
    border-color: #bbb;
}

.answer-option input:checked + .option-content {
    border-color: #E53935;
    background-color: #fff;
}

.option-label {
    font-size: 1.125em;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.option-description {
    font-size: 0.9375em;
    color: #000;
    text-align: center;
}

/* ========================================
   ボタン
======================================== */
.simulator .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 48px;
    font-size: 1em;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.simulator .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.simulator .btn-primary {
    background-color: #E53935;
    color: #fff;
}

.simulator .btn-primary:hover:not(:disabled) {
    background-color: #C62828;
}

.simulator .btn-secondary {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.simulator .btn-secondary:hover:not(:disabled) {
    background-color: #f5f5f5;
}

.simulator .btn-text {
    color: #000;
    padding: 14px 24px;
    background-color: #fff;
}

.simulator .btn-text:hover:not(:disabled) {
    color: #333;
    background-color: #fafafa;
}

.simulator .btn-large {
    padding: 18px 64px;
    font-size: 1.125em;
}

.simulator .btn-small {
    padding: 10px 20px;
    font-size: 0.875em;
}

.step-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

@media (max-width: 768px) {
    .simulator .btn {
        padding: 12px 32px;
        font-size: 0.9375em;
    }
    
    .simulator .btn-large {
        padding: 16px 48px;
        font-size: 1em;
    }
    
    .step-actions {
        padding: 12px 0;
        margin-top: 16px;
        margin-bottom: 16px;
    }
    
    .step3-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .step3-actions .btn {
        width: 100%;
    }
}

/* ========================================
   STEP2: 製品選択
======================================== */
.product-selection-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 992px) {
    .product-selection-wrapper {
        grid-template-columns: 1fr;
    }
}

/* 製品リスト */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0; /* グリッドのオーバーフロー防止 */
}

.product-item {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    min-width: 0; /* グリッドのオーバーフロー防止 */
}

.product-item:first-child {
    padding-top: 0;
}

/* 製品アイコン */
.product-icon {
    width: 84px;
    height: 84px;
    min-width: 84px;
    min-height: 84px;
    aspect-ratio: 1 / 1;
    padding: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-icon img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    object-position: center;
    display: block;
}

.product-icon.no-icon {
    background: none;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* グリッドアイテムの縮小を許可 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-name {
    font-size: 1em;
    font-weight: 700;
    color: #1a1a1a;
}

.product-description {
    font-size: 0.8125em;
    color: #000;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.product-price-info {
    font-size: 0.875em;
    color: #000;
    word-break: break-all;
}

@media (max-width: 768px) {
    .product-price-info {
        font-size: 0.75em;
    }
}

.product-badges {
    margin-top: 2px;
}

.product-badges .discount-badge {
    display: block;
    font-size: 0.75em;
    color: #E53935;
    line-height: 1.6;
}

.product-badges .discount-badge + .discount-badge {
    margin-top: 4px;
}

.product-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 数量コントロール */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background-color: #fff;
    font-size: 1.25em;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background-color: #f5f5f5;
}

.qty-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.qty-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.qty-input {
    width: 48px;
    height: 32px;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 0.9375em;
    font-weight: 600;
    color: #333;
    -moz-appearance: textfield; /* Firefox */
}

/* Chrome, Safari, Edge でスピナーを非表示 */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
    border-color: #E53935;
    background-color: #fff;
}

.qty-input::placeholder {
    color: #999;
    font-size: 0.75em;
    font-weight: 400;
}

.quantity-hint {
    font-size: 0.8125em;
    color: #000;
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 4px;
    text-align: right;
    box-sizing: border-box;
}

.step2 .quantity-hint {
    width: calc(100% - 352px);
}

@media (max-width: 992px) {
    .step2 .quantity-hint {
        width: 100%;
    }
}

/* セレクトボックス（プラン選択用） */
.product-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875em;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    min-width: 140px;
}

.product-select:focus {
    outline: none;
    border-color: #E53935;
}

/* 選択サマリー（サイドバー） */
.selection-summary {
    position: sticky;
    top: 120px;
    background-color: #fff;
    border-radius: 8px;
    padding: 24px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    align-self: start;
}

@media (max-width: 992px) {
    .selection-summary {
        position: static;
        margin-top: 24px;
        max-height: none;
        overflow-y: visible;
    }
}

.summary-title {
    font-size: 0.9375em;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.summary-products {
    margin-bottom: 20px;
    min-height: 60px;
}

.no-selection {
    font-size: 0.875em;
    color: #999;
}

.summary-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875em;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.summary-product-item:last-child {
    border-bottom: none;
}

.summary-product-name {
    color: #333;
    flex: 1;
    padding-right: 8px;
}

.summary-product-qty {
    color: #000;
    white-space: nowrap;
}

.discount-level {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 0.875em;
}

.discount-level:empty {
    display: none;
}

.discount-level-item {
    padding: 4px 0;
    color: #E53935;
    font-weight: 600;
}

.discount-level-item:first-child {
    padding-top: 0;
}

.discount-level-item:last-child {
    padding-bottom: 0;
}

.discount-level-item.disabled {
    color: #000;
    font-weight: 600;
}

.simulator .selection-summary .btn {
    width: 100%;
}

/* モバイル用ナビゲーション */
@media (max-width: 992px) {
    .step2 .mobile-only {
        display: flex;
        justify-content: space-between;
        padding: 20px 0 0;
        border-top: 1px solid #eee;
        margin-top: 24px;
    }
}

@media (max-width: 768px) {
    .product-item {
        grid-template-columns: 68px 1fr;
        gap: 12px;
    }
    
    .product-icon {
        width: 68px;
        height: 68px;
        min-width: 68px;
        min-height: 68px;
        padding: 6px;
    }
    
    .product-controls {
        grid-column: 2;
        justify-content: flex-start;
        margin-top: 8px;
        flex-wrap: wrap;
    }
    
    .product-name {
        font-size: 0.9375em;
    }
    
    .product-select {
        min-width: 120px;
        max-width: 100%;
    }
}

/* 製品リストの横スクロール防止 */
.product-list {
    overflow-x: hidden;
}


/* ========================================
   STEP3: 試算結果
======================================== */
.result-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .result-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.result-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 32px;
    position: relative;
}

.result-card.disabled {
    opacity: 0.5;
    animation: none;
}

.result-card-title {
    font-size: 0.9375em;
    font-weight: 700;
    color: #333;
    margin-bottom: 24px;
}

.result-price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.result-price-row.sub {
    margin-bottom: 0;
}

.result-label {
    font-size: 0.875em;
    color: #000;
}

.result-price {
    font-size: 2em;
    font-weight: 700;
    color: #1a1a1a;
}

.result-price-sub {
    font-size: 1em;
    color: #000;
}

.result-price .tax-note,
.result-price-sub .tax-note {
    font-size: 0.7em;
    font-weight: 400;
}

.savings-message {
    margin-top: 16px;
    padding: 12px 16px;
    font-size: 1em;
    color: #E53935;
    font-weight: 700;
    background-color: #FFF3E0;
    border: 2px solid #FF9800;
    border-radius: 8px;
    text-align: center;
}

.savings-message .savings-amount {
    font-size: 1.3em;
    font-weight: 900;
    color: #D32F2F;
}

.three-year-notice {
    margin-top: 16px;
    font-size: 0.8125em;
    color: #000;
    font-weight: 700;
}

.three-year-benefits {
    margin-top: 20px;
    padding-top: 20px;
}

.three-year-benefits .benefits-title {
    font-size: 0.875em;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.three-year-benefits .benefits-list {
    margin: 0;
    padding-left: 20px;
    font-size: 0.8125em;
    color: #000;
    line-height: 1.8;
}

.three-year-benefits .benefits-list li {
    margin-bottom: 8px;
}

.three-year-benefits .benefits-list li:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .result-card {
        padding: 24px;
    }
    
    .result-price {
        font-size: 1.5em;
    }
    
    .savings-message {
        font-size: 0.9em;
        padding: 10px 12px;
    }
    
    .savings-message .savings-amount {
        font-size: 1.2em;
    }
}

/* 製品別内訳テーブル */
.result-details {
    margin-bottom: 32px;
}

.details-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.details-title {
    font-size: 0.9375em;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.details-tax-note {
    font-size: 0.8125em;
    color: #000;
    font-weight: 700;
}

.details-table-wrapper {
    overflow-x: auto;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875em;
}

.details-table th,
.details-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.details-table th {
    font-weight: 600;
    color: #000;
    background-color: #fff;
    white-space: nowrap;
}

.details-table td {
    color: #333;
}

.details-table td:nth-child(2),
.details-table td:nth-child(3),
.details-table td:nth-child(4),
.details-table td:nth-child(5),
.details-table td:nth-child(6),
.details-table td:nth-child(7),
.details-table td:nth-child(8) {
    text-align: right;
    white-space: nowrap;
}

.details-table th:nth-child(2),
.details-table th:nth-child(3),
.details-table th:nth-child(4),
.details-table th:nth-child(5),
.details-table th:nth-child(6),
.details-table th:nth-child(7),
.details-table th:nth-child(8) {
    text-align: right;
}

.details-table tfoot td {
    font-weight: 700;
    background-color: #fff;
    border-top: 2px solid #ddd;
}

.details-table .discount-label {
    font-size: 0.85em;
    color: #E53935;
    font-weight: 700;
}

.details-table .grayed {
    color: #999;
}

@media (max-width: 768px) {
    .details-table {
        font-size: 0.8125em;
    }
    
    .details-table th,
    .details-table td {
        padding: 10px 8px;
    }
}

/* 注意書き */
.result-notice {
    background-color: #fff;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 32px;
}

.result-notice p {
    font-size: 0.875em;
    color: #000;
    line-height: 1.6;
}

/* アクションボタン */
/* STEP2の戻るボタンは左寄せ */
.step2-actions {
    justify-content: flex-start;
}

.step3-actions {
    justify-content: space-between;
    position: static;
    margin-top: 32px;
    margin-bottom: 0;
}

/* ========================================
   アニメーション
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


.result-card {
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.result-card:nth-child(1) {
    animation-delay: 0.1s;
}

.result-card:nth-child(2) {
    animation-delay: 0.2s;
}

.result-details {
    animation: fadeInUp 0.5s ease 0.3s both;
}

.details-table tbody tr {
    animation: slideInRight 0.4s ease;
    animation-fill-mode: both;
}

.details-table tbody tr:nth-child(1) {
    animation-delay: 0.4s;
}

.details-table tbody tr:nth-child(2) {
    animation-delay: 0.45s;
}

.details-table tbody tr:nth-child(3) {
    animation-delay: 0.5s;
}

.details-table tbody tr:nth-child(4) {
    animation-delay: 0.55s;
}

.details-table tbody tr:nth-child(5) {
    animation-delay: 0.6s;
}

.details-table tbody tr:nth-child(n+6) {
    animation-delay: 0.65s;
}

.details-table tfoot tr {
    animation: fadeInUp 0.4s ease 0.7s both;
}

.result-notice {
    animation: fadeInUp 0.4s ease 0.8s both;
}

.step3-actions {
    animation: fadeInUp 0.4s ease 0.9s both;
}

.product-item {
    animation: fadeInUp 0.3s ease;
    animation-fill-mode: both;
}

.product-item:nth-child(1) {
    animation-delay: 0.05s;
}

.product-item:nth-child(2) {
    animation-delay: 0.1s;
}

.product-item:nth-child(3) {
    animation-delay: 0.15s;
}

.product-item:nth-child(4) {
    animation-delay: 0.2s;
}

.product-item:nth-child(5) {
    animation-delay: 0.25s;
}

.product-item:nth-child(n+6) {
    animation-delay: 0.3s;
}

/* ========================================
   追加のレスポンシブ調整
======================================== */
@media (max-width: 480px) {
    .simulator {
        padding: 24px 12px 60px;
    }
    
    .simulator .simulator-header h1 {
        font-size: 1.5em;
    }
    
    .simulator .step-container {
        padding: 20px 12px;
    }
    
    .simulator .question-title {
        font-size: 1em;
    }
    
    .simulator .option-content {
        padding: 16px;
        min-height: 80px;
    }
    
    .simulator .option-label {
        font-size: 1em;
    }
    
    .simulator .btn {
        padding: 12px 24px;
        font-size: 0.875em;
    }
}

/* ========================================
   その他の調整
======================================== */

/* フォーカス状態 */
.answer-option:focus-within .option-content {
    border-color: #E53935;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

/* 製品アイテムホバー */
.product-item:hover {
    background-color: #fafafa;
}

/* 選択済み製品のハイライト */
.product-item.selected {
    background-color: #fff5f5;
}

/* 価格のハイライト */
.price-highlight {
    color: #E53935;
    font-weight: 700;
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* スクロールスムーズ */
html {
    scroll-behavior: smooth;
}

/* 印刷スタイル */
@media print {
    .simulator {
        padding: 20px;
    }
    
    .step-actions,
    .mobile-only {
        display: none !important;
    }
    
    .step-content {
        display: block !important;
    }
    
    .result-card {
        break-inside: avoid;
    }
}
