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

/* 傾斜設定エリア */
.slant-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;
}

.slant-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;
}

/* === 多めに払う人の入力行（ボタン／人数／金額／役職・名前の4列） === */
/* 💡 追加：ボタン列の幅を変数にまとめ、見出しと入力行の列位置がずれないようにする */
.slant-controls {
    --slant-btn-width: 40px;
}

/* 💡 変更：右端に「役職・名前」列を追加したため、3列 → 4列にした */
.slant-head,
.slant-input-row {
    display: grid;
    grid-template-columns: var(--slant-btn-width) 0.9fr 1.2fr 1.4fr;
    gap: 10px;
    align-items: center;
}

/* 列の見出し */
.slant-head {
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #64748b;
}

.slant-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 入力欄と単位（人・円）の並び */
.slant-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slant-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    text-align: right;
}

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

/* 💡 追加：役職・名前は文字入力のため、金額と違って左寄せにする */
.slant-field input.slant-title {
    text-align: left;
}

/* ー ／ ＋ ボタン */
.btn-slant {
    width: var(--slant-btn-width, 40px);
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #475569;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-slant:hover {
    background: #e2e8f0;
}

/* 削除（ー）は間違えて押しにくいよう、ホバー時だけ警告色にする */
.btn-slant-remove:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* 追加（＋）は行末（ーボタンの下）に配置する */
.btn-slant-add {
    margin-top: 10px;
    color: #2a5298;
    border-color: #93b4e8;
}

.btn-slant-add:hover {
    background: #e8effb;
}

/* === 結果側：多めに払うグループの一覧 === */
.result-slant-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.result-sub {
    display: flex;
    justify-content: space-around;
    font-size: 0.9rem;
    color: #475569;
    border-top: 1px solid #dee2e6;
    padding-top: 12px;
}

.result-slant-card {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 💡 追加：display 指定があると hidden 属性が効かなくなるため、明示的に隠す
            （これが無いと傾斜OFFでも「0 円 / 人」の結果が出たままになります） */
.result-slant-card[hidden] { display: none; }

.slant-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    padding: 4px 0;
}

.highlight-text {
    color: #e67e22;
    font-size: 1.1rem;
}

/* 履歴エリア */
.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 に一本化しました */
/* === スマホ・タブレット対応 === */
/* 💡 変更：4列になり横幅が足りないため、狭い画面では
            「ー ボタン ＋ 縦積みの入力欄」という形に切り替える */
@media (max-width: 768px) {
    .calc-box { padding: 20px; }

    .slant-controls { --slant-btn-width: 36px; }

    /* 縦積みにすると列見出しの位置が合わなくなるため、見出しは隠す
       （各欄の単位「人・円」とプレースホルダで何の項目かが分かるようにしてある） */
    .slant-head { display: none; }

    .slant-input-row {
        grid-template-columns: var(--slant-btn-width) 1fr;
        gap: 8px;
        padding-bottom: 10px;
        border-bottom: 1px dashed #e2e8f0;
    }

    /* ー ボタンは3つの入力欄の左側にまとめて配置する */
    .slant-input-row .btn-slant-remove {
        grid-row: span 3;
        align-self: start;
    }

    .btn-slant { height: 38px; }

    .slant-field input { padding: 8px; font-size: 0.95rem; }

    .slant-unit { font-size: 0.85rem; }

    .input-row { flex-direction: column; gap: 10px; }

    .result-sub {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

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

    .slant-row { font-size: 0.9rem; }

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