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

/* === 早見表へのリンクボタン === */
/* 💡 追加：blade に直接書かれていた style 属性をこちらへ移しました
             （ページ上部に置き、計算フォームより前に見える位置にしています） */
.tool-link-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 0.9rem;
}

/* 💡 追加：合計欄が自動計算になっているときの説明文 */
.input-note {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: #64748b;
}

/* おまけ設定エリア */
.bonus-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.bonus-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #cbd5e1;
}

.input-row {
    display: flex;
    gap: 15px;
}

.flex-1 {
    flex: 1;
    margin-bottom: 0;
}

/* ボタン群 */
.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: 15px;
}

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

/* 💡 追加：display 指定があると hidden 属性が効かなくなるため、明示的に隠す */
.result-grid[hidden] { display: none; }

/* 💡 追加：内訳を使う間、合計欄は自動計算になるため入力できない見た目にする */
.input-group input[readonly] {
    background-color: #f1f3f5;
    color: #495057;
}

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

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

.result-item strong {
    font-size: 1.05rem;
    color: #e67e22;
}

/* 履歴エリア */
.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 属性の移動先） */
.history-time {
    color: #999;
    font-size: 0.8rem;
    white-space: nowrap;
}

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

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

/* === スマホ・タブレット対応 === */
/* 💡 追加：狭い画面での余白と、横に並びきらない項目の並びを調整する */
@media (max-width: 768px) {
    .calc-box { padding: 20px; }

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

    /* 有償・無償の2列は横幅が足りないため縦積みにする */
    .input-row { flex-direction: column; gap: 16px; }

    .btn-group { gap: 10px; }

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

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

    .result-grid {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

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

    .history-box { padding: 16px; }

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