/* ガソリン代計算ツール専用スタイル */
.calc-box {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-top: 20px;
}
.input-group {
    margin-bottom: 20px;
}
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #1e3c72;
}
.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

/* 🚗 車種・平均燃費データベース検索ボックス */
.car-select-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.car-select-title {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: #1e3c72;
    margin-bottom: 12px;
}
.car-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.car-select-item label {
    display: block;
    font-size: 0.8rem;
    color: #495057;
    margin-bottom: 4px;
}
.car-select-item input, .car-select-item select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.car-select-item[hidden] {
    display: none;
}
.car-fetch-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
}
#car-selected-info {
    color: #2b2b2b;
    font-weight: bold;
}
.btn-apply-car {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-apply-car:hover:not(:disabled) { background-color: #218838; }
.btn-apply-car:disabled {
    background-color: #ced4da;
    cursor: not-allowed;
}

.btn-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}
.btn-calc {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    background-color: #2a5298;
    color: white;
}
.btn-clear-tool {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    background-color: #e9ecef;
    color: #495057;
}

.result-box {
    background-color: #f1f3f5;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}
.result-row:last-child { border-bottom: none; }
.res-highlight { font-weight: bold; }
.res-primary {
    font-size: 1.4rem;
    color: #2a5298;
}

.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;
    cursor: pointer;
}
.history-list {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
    padding-left: 0;
}
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
}
.history-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.history-time {
    color: #999;
    font-size: 0.75rem;
}
.btn-restore-history {
    background-color: #e7f1ff;
    color: #0d6efd;
    border: 1px solid #b6d4fe;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}
.btn-restore-history:hover { background-color: #cfe2ff; }
.history-empty {
    color: #adb5bd;
    text-align: center;
    font-size: 0.9rem;
    padding: 10px 0;
}

/* スマホ・タブレット(iPhone, iPad)対応 */
@media (max-width: 768px) {
    .calc-box { padding: 20px; }
    .car-select-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .car-fetch-result {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        text-align: center;
    }
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .btn-restore-history {
        align-self: flex-end;
    }
}
/* === 往復・複数の行き先 === */
/* 💡 追加：走行距離の下に置く2つの切り替えです。
            ・往復　　　：入れると距離が2倍、外すと半分に戻ります
            ・行き先複数：入れると隣に ー ＋ が出て、行き先の欄を増やせます */
.gas-toggles {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gas-toggles .check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #334155;
    cursor: pointer;
}

.gas-toggles .check-label input[type="checkbox"] {
    /* .input-group input の width:100% を打ち消す（チェックボックスなので） */
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

/* 「行き先を複数にする」と ー ＋ ボタンを同じ行に並べる */
.gas-toggle-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dest-buttons {
    display: inline-flex;
    gap: 6px;
}

.dest-buttons[hidden] { display: none; }

.btn-dest {
    width: 36px;
    height: 32px;
    border: 1px solid #93b4e8;
    border-radius: 6px;
    background: #ffffff;
    color: #2a5298;
    font-size: 0.95rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-dest:hover { background: #e8effb; }

/* --- 2件目以降の行き先 --- */
.dest-rows {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dest-rows[hidden] { display: none; }

.dest-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dest-row-label {
    /* .input-group label の display:block を打ち消して、横に並べる */
    display: inline-block;
    width: 5.5em;
    margin-bottom: 0;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: bold;
}

.dest-row input.dest-distance {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
}

.dest-unit {
    font-size: 0.9rem;
    color: #475569;
    flex-shrink: 0;
}

/* --- 合計距離 --- */
.dest-total {
    margin: 10px 0 0;
    padding: 8px 12px;
    background: #eef4ff;
    border: 1px solid #cddffb;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #334155;
}

.dest-total[hidden] { display: none; }

.dest-total strong { color: #1e3c72; font-size: 1.05rem; }

/* === スマホ・タブレット対応 === */
@media (max-width: 768px) {
    .gas-toggles { padding: 10px 12px; }

    /* 行き先の見出しを上に置き、入力欄を横いっぱいに使う */
    .dest-row-label { width: 4.5em; font-size: 0.8rem; }
}
