/* src/public/css/calculator/unit_conversion.css */

.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[type="number"], 
.input-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.unit-select {
    margin-top: 8px;
    background-color: #f8fafc;
}

.conversion-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* === スマホ・タブレット対応 === */
/* 💡 修正：区切り幅を 600px から、他のページと同じ 768px にそろえました。
            600〜768px（iPad の縦持ちなど）で「変換元 ▶ 変換先」が横並びのまま
            プルダウンが潰れて読めなくなっていました。
   💡 追加：あわせて余白・文字サイズと履歴の並びも狭い画面向けに調整しています。 */
@media (max-width: 768px) {
    .conversion-row {
        flex-direction: column;
        gap: 0;
    }
    .arrow-divider {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .calc-box { padding: 20px; }

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

    /* 変換結果は単位付きで長くなるため、はみ出さないよう折り返す */
    #res-converted-val,
    #res-formula-text {
        word-break: break-all;
    }

    .history-box { padding: 16px; }

    .unit-note { padding: 16px; }

    /* 内容と時刻が1行に収まらないため、縦に積む */
    .history-item {
        flex-direction: column;
        gap: 4px;
        font-size: 0.85rem;
    }
}

.flex-1 {
    flex: 1;
}

.arrow-divider {
    font-weight: 900;
    font-size: 1.5rem;
    color: #2a5298;
    margin-top: 10px;
}

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

.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;
    margin-top: 20px;
}

.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: 2.2rem;
    font-weight: bold;
    color: #2a5298;
    margin-bottom: 10px;
    word-break: break-all;
}

.result-sub {
    font-size: 0.95rem;
    color: #475569;
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
}

/* 履歴エリア */
.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;
}

/* 💡 追加：解釈が分かれる単位（畳・KB・年・マッハ）の基準を説明する囲み */
.unit-note {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
}

.unit-note h3 {
    font-size: 1rem;
    color: #1e3c72;
    margin: 0 0 10px;
}

.unit-note p {
    margin: 0 0 8px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #495057;
}

.unit-note p:last-child { margin-bottom: 0; }

/* 💡 削除：.back-btn は全ページ共通のため style.css に一本化しました
             （ここで margin-top: 20px に上書きしていたため、このページだけ
               戻るリンクの位置が他ページとずれていました） */