/* src/public/css/calculator/unit_price.css */

.compare-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

/* 💡 変更：商品が最大3つになり横幅が足りなくなるため、
             縦並びに切り替える幅を 600px → 768px に広げた */
@media (max-width: 768px) {
    .compare-wrapper {
        flex-direction: column;
    }
}

.compare-card {
    flex: 1;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

/* 勝利カードの強調表現 */
.compare-card.winner {
    border-color: #2ecc71;
    background: #f0fdf4;
}

.card-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 15px;
}

.badge-a { background-color: #3498db; }
.badge-b { background-color: #e67e22; }
/* 💡 追加：商品C用のバッジ色（A・Bと見分けが付く色にする） */
.badge-c { background-color: #8e44ad; }

/* === 商品Cの追加スイッチ === */
/* 💡 追加：比較カードの上に置く「商品Cを追加する」スイッチの並び */
.compare-option {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

/* === 個数の入力欄（スイッチ付き） === */
/* 💡 追加：スイッチと入力欄を縦に並べ、OFFのときは無効だと分かる見た目にする */
.count-group .tool-switch-container {
    margin-bottom: 6px;
}

.count-group input:disabled {
    background-color: #f1f3f5;
    color: #adb5bd;
    cursor: not-allowed;
}

.vs-divider {
    font-weight: 900;
    font-size: 1.2rem;
    color: #94a3b8;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #1e3c72;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

/* ボタン群 */
.btn-group {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.btn-calc {
    flex: 2;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #2a5298;
    color: white;
}

.btn-calc:hover { background-color: #1e3c72; }

.btn-clear-tool {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #e9ecef;
    color: #495057;
}

.btn-clear-tool:hover { background-color: #dee2e6; }

/* 結果表示 */
.result-box {
    background-color: #f1f3f5;
    padding: 20px;
    border-radius: 8px;
}

.result-card {
    text-align: center;
}

.res-title {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: bold;
    margin-bottom: 5px;
}

.res-big-val {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #2a5298;
    margin-bottom: 15px;
}

.result-detail-grid {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
    gap: 10px;
}

.result-detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* 💡 追加：display 指定があると hidden 属性が効かなくなるため、明示的に隠す
            （これが無いと商品CがOFFでも商品Cの結果欄が出たままになります） */
.result-detail-item[hidden] { display: none; }

.result-detail-item span {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: bold;
}

.result-detail-item strong {
    font-size: 1.05rem;
    color: #2c3e50;
}

.result-diff-text {
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    color: #27ae60;
}

/* 履歴エリア */
.history-box {
    margin-top: 30px;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.history-box h3 {
    font-size: 1.1rem;
    color: #1e3c72;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-history-lnk {
    font-size: 0.8rem;
    color: #dc3545;
    text-decoration: none;
    cursor: pointer;
}

.history-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    padding-left: 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
}

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

/* 💡 追加：履歴の時刻。JS側のインラインstyleをやめてCSSへ移した（見た目はCSSの担当のため） */
.history-time {
    color: #999;
    font-size: 0.8rem;
}

.history-empty {
    color: #adb5bd;
    text-align: center;
    font-size: 0.9rem;
    padding: 10px 0;
    list-style: none;
}

/* 💡 削除：.back-btn は全ツール共通のため style.css に一本化しました */

/* === スマホ・タブレット対応 === */
/* 💡 追加：商品が最大3つになり横並びだと窮屈なため、狭い画面での並びを調整する */
@media (max-width: 768px) {
    .compare-card { padding: 16px; }

    .compare-option { justify-content: flex-start; }

    /* 3項目が横に並びきらないため、結果欄は縦積みにして読みやすくする */
    .result-detail-grid {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .result-detail-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* 💡 追加：この @media でも .result-detail-item を上書きしているため、
                将来ここに display を足したときに hidden が効かなくなるのを防ぐ保険 */
    .result-detail-item[hidden] { display: none; }

    .res-big-val { font-size: 1.5rem; }

    .btn-group { gap: 10px; }

    .btn-calc,
    .btn-clear-tool { padding: 12px; font-size: 0.95rem; }

    .history-box { padding: 16px; }

    .history-item {
        flex-direction: column;
        gap: 4px;
        font-size: 0.85rem;
    }
}