/* src/public/css/calculator/money.css … お金の計算（積立投資・利息計算・積立額の逆算）で共通の見た目
   ダークモードは theme-dark.css の末尾（=== お金の計算 ===）にあります。 */

.calc-box {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-top: 20px;
}
.calc-box [hidden] { display: none !important; }

.mc-section-title {
    margin: 26px 0 12px;
    font-size: 1.1rem;
    color: #1e3c72;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}
.calc-box > .mc-section-title:first-child { margin-top: 0; }
.mc-desc { margin: 0 0 14px; font-size: 0.9rem; color: #475569; line-height: 1.6; }

.mc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.input-group { margin-bottom: 16px; min-width: 0; }
.input-group label,
.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #1e3c72;
    font-size: 0.92rem;
}
.input-group input[type="text"],
.input-group select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #ffffff;
    height: 46px;
    line-height: normal;
    margin: 0;
    color: inherit;
    font-family: inherit;
}
/* 💡 選択の欄は、iPad・iPhone（Safari）などで独自の見た目になるため、ほかの欄とそろえる */
.input-group select {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-width: 0;
    max-width: 100%;
    padding-right: 36px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}
.mc-field-note { margin: 6px 0 0; font-size: 0.8rem; color: #64748b; line-height: 1.5; }

/* 数字欄＋単位 */
.mc-unit-field { display: flex; align-items: center; gap: 6px; }
.mc-unit-field input { flex: 1; min-width: 0; text-align: right; }
.mc-unit-field span { flex: 0 0 auto; color: #475569; font-size: 0.9rem; white-space: nowrap; }
.mc-pair { display: flex; gap: 8px; }
.mc-pair .mc-unit-field { flex: 1; min-width: 0; }

/* 例のボタン（金利・金額をすぐ入れる） */
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mc-chip {
    padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc;
    color: #334155; font-size: 0.8rem; font-weight: bold; cursor: pointer;
}
.mc-chip:hover { border-color: #2a5298; color: #2a5298; }

/* 💡 ボタン（クリア／計算する）・計算履歴・折りたたみは calc-common.css、詳細オプションは x-pocketcalc-options の共通の見た目です */
.mc-message { margin: 0; min-height: 1.4em; font-size: 0.9rem; font-weight: bold; color: #b45309; white-space: pre-line; }

/* 結果のカード */
.mc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.mc-card {
    display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; min-width: 0;
}
.mc-card-main { background: #eef3fb; border-color: #bfd0ee; }
.mc-card-title { font-size: 0.85rem; font-weight: bold; color: #475569; }
.mc-card-val { font-size: 1.45rem; font-weight: bold; color: #1e3c72; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.mc-card-main .mc-card-val { font-size: 1.8rem; color: #2a5298; }
.mc-card-sub { font-size: 0.8rem; color: #64748b; line-height: 1.5; }
.mc-card-gain .mc-card-val { color: #15803d; }

.mc-sub-title { margin: 22px 0 8px; font-size: 1rem; color: #1e3c72; }
.mc-note { margin: 6px 0 12px; font-size: 0.8rem; color: #64748b; line-height: 1.55; white-space: pre-line; }

/* 表 */
.mc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mc-table-scroll { max-height: 420px; overflow-y: auto; }
.mc-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.mc-table th,
.mc-table td { padding: 10px 8px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: middle; }
.mc-table thead th { background-color: #f1f5f9; color: #1e3c72; font-size: 0.85rem; white-space: nowrap; position: sticky; top: 0; }
.mc-table tbody th { color: #1e293b; font-weight: bold; white-space: nowrap; }
.mc-table .mc-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mc-table .mc-strong td,
.mc-table .mc-strong th { font-weight: bold; color: #1e3c72; }
.mc-table tr.is-current td,
.mc-table tr.is-current th { background-color: #eef3fb; }
.mc-table .mc-minus { color: #b91c1c; }

/* グラフ（SVG：積み上げ棒） */
.mc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: #334155; margin-bottom: 6px; }
.mc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mc-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mc-swatch-principal { background: #94a3b8; }
.mc-swatch-gain { background: #22c55e; }
.mc-chart-wrap { position: relative; width: 100%; }
.mc-chart { display: block; width: 100%; height: auto; overflow: visible; }
.mc-chart .mc-bar-principal { fill: #94a3b8; }
.mc-chart .mc-bar-gain { fill: #22c55e; }
.mc-chart .mc-bar-hit { fill: transparent; cursor: pointer; }
.mc-chart .mc-bar-hit:hover,
.mc-chart .mc-bar-hit.is-active { fill: rgba(42, 82, 152, 0.08); }
.mc-chart .mc-axis { stroke: #94a3b8; stroke-width: 1; }
.mc-chart .mc-gridline { stroke: #e2e8f0; stroke-width: 1; }
.mc-chart .mc-tick { fill: #64748b; font-size: 11px; }
.mc-tooltip {
    position: absolute; pointer-events: none; z-index: 2; min-width: 160px;
    background: rgba(15, 23, 42, 0.92); color: #fff; border-radius: 8px; padding: 8px 10px;
    font-size: 0.8rem; line-height: 1.6; white-space: nowrap; transform: translate(-50%, -100%);
}
.mc-tooltip b { display: block; font-size: 0.85rem; }

.mc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mc-btn-sub {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid #cbd5e1;
    border-radius: 6px; background: #f8fafc; color: #1e3c72; font-size: 0.9rem; font-weight: bold;
    cursor: pointer; text-decoration: none;
}
.mc-btn-sub:hover { background: #e2e8f0; }

/* ほかの計算への案内 */
.mc-related { margin: 18px 0 0; padding: 12px 16px; border-radius: 10px; background: #f1f5f9; font-size: 0.9rem; color: #475569; line-height: 1.8; }
.mc-related a { color: #2563eb; font-weight: bold; }
.mc-related i { color: #2a5298; margin-right: 4px; }

@media (max-width: 768px) {
    .calc-box { padding: 20px; }
    .mc-table { font-size: 0.85rem; }
    .mc-table th, .mc-table td { padding: 8px 6px; }
    .mc-card-main .mc-card-val { font-size: 1.55rem; }
}
@media (max-width: 480px) {
    .mc-grid { grid-template-columns: 1fr; }
    .mc-table { font-size: 0.78rem; }
    .mc-table th, .mc-table td { padding: 7px 4px; }
}
