/**
 * 賃貸vs持ち家計算機 固有スタイル
 * プレフィックス: rvb- (rent-vs-buy)
 *
 * 共通スタイルは以下から継承:
 * - common/style.css - グローバルスタイル
 * - common/common.css - 共通レイアウト
 * - common/calculator-common.css - 計算機共通スタイル
 *   - 2列レイアウト、操作メニュー、結果表示エリア
 *   - シミュレーションヘッダー
 *   - ダイアログ関連（保存・呼出）
 *   - 印刷対応
 *
 * このファイルには、賃貸vs持ち家計算機でのみ使用される
 * 固有のスタイルのみを定義しています。
 */

/* 注: 以下のスタイルはcalculator-common.cssで定義済み
 * - .compareArea (2列レイアウト基本)
 * - .compare (比較パネル基本スタイル)
 * - #ope (操作メニュー)
 * - #openName (現在のデータ表示)
 * - #ans (結果表示エリア基本)
 * - #savesub (保存サブメニュー)
 * - .btnReCalc (再計算ボタン)
 * - .calc (計算ボタンエリア)
 */

/* ========================================
   見出しスタイル
   ======================================== */

/* .midashi と .midashires はcalculator-common.cssで定義済み
   ページ固有の調整が必要な場合はここで上書き */

/* 賃貸vs持ち家固有の幅設定 */
.compare.rvb-compare {
    padding: 15px; /* 通常より少し狭め */
}

.compare.rvb-compare:first-child {
    width: 450px; /* 賃貸側の幅 */
}

.compare.rvb-compare:last-child {
    width: 480px; /* 持ち家側の幅（賃貸より少し広め） */
}

/* ========================================
   テーブルレイアウト
   ======================================== */

/* テーブルレイアウトは基本的にcalculator-common.cssから継承
   以下は賃貸vs持ち家固有の調整のみ */

/* テーブルセル共通設定 */
.compare.rvb-compare table td {
    padding: 7px 0px 7px 4px;
    vertical-align: middle;
    white-space: nowrap;
    /* font-size: 16px; */ /* 共通クラス(calculator-common.css)で定義済み */
}

/* 賃貸側の特殊レイアウト（年齢区分と家賃が横並び） */
.compare.rvb-compare:first-child table tr td:nth-child(1),
.compare.rvb-compare:first-child table tr td:nth-child(2) {
    width: 50%;
    text-align: left; /* 左揃えに変更 */
    padding-left: 10px;
    padding-right: 10px;
}

/* 持ち家側テーブル（右側）の列幅設定 */
.compare.rvb-compare:last-child table td:first-child {
    width: 35px;
    text-align: center;
}

.compare.rvb-compare:last-child table td:nth-child(2) {
    width: auto;
    padding-right: 10px;
}

.compare.rvb-compare:last-child table td:last-child {
    width: 180px;
    text-align: left; /* 左揃えに変更 */
    padding-left: 10px;
}

/* 入力フィールドスタイル - calculator-common.cssの上書き */
.compare.rvb-compare input[type="number"],
.compare.rvb-compare .txtNum {
    padding: 4px 20px 4px 8px !important; /* 右側余白を増やしてスピンボタンと数値が重ならないように */
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: 'Noto Sans JP Bold', 'メイリオ', sans-serif;
    font-size: 26px !important; /* calculator-common.cssと同じ大きさに統一 */
    line-height: 1.4; /* 行高を設定して数字が中央に配置されるように */
    text-align: right;
    background: #fff;
    margin: 0 3px;
    height: auto !important; /* 高さをautoにしてpaddingで調整 */
    box-sizing: border-box; /* paddingを含めたサイズ計算 */
}

.compare.rvb-compare input[type="number"]:focus,
.compare.rvb-compare .txtNum:focus {
    border-color: #3FA9F5;
    outline: none;
    background: #f0f8ff;
}

/* 賃貸側の入力フィールド幅 */
/* 基本スタイルはcalculator-common.cssから継承
   ここではページ固有の幅調整を行う
   共通クラス: .txtNum--medium (80px)と同じ幅 */
.compare.rvb-compare:first-child input[type="number"],
.compare.rvb-compare:first-child .txtNum {
    width: 80px !important; /* 家賃用のフィールド幅 */
}

/* 年齢入力フィールドはさらに狭く */
/* calculator-common.cssの.txtNum--small (60px)相当 */
.compare.rvb-compare:first-child input[style*="width:60px"],
.compare.rvb-compare:first-child input.age-input {
    width: 60px !important; /* 年齢用のコンパクトな幅 */
}

/* 区分2と3の開始年齢を入力フィールド風にスタイリング */
.fake-input-age {
    display: inline-block;
    width: 60px !important;
    padding: 4px 20px 4px 8px !important; /* 右側余白を増やしてスピンボタンと数値が重ならないように */
    font-family: 'Noto Sans JP Bold', 'メイリオ', sans-serif;
    font-size: 26px !important;
    line-height: 1.4;
    text-align: right;
    margin: 0 3px;
    box-sizing: border-box;
    vertical-align: middle;
}

/* 家賃入力フィールドの幅調整 */
.compare.rvb-compare:first-child input.rent-input {
    width: 100px !important; /* 家賃用に幅を広げる */
}

/* 持ち家側の入力フィールド幅 */
/* calculator-common.cssの.txtNum--default (110px)相当 */
.compare.rvb-compare:last-child input[type="number"],
.compare.rvb-compare:last-child .txtNum {
    width: 110px !important; /* purchase-amountと同じ標準幅 */
}

/* 行の高さ統一 */
.compare.rvb-compare tr {
    height: 45px;
}

/* ローン換算額エリアの入力フィールド - 標準スタイルを適用 */
.midashires input[type="number"],
.midashires .txtNum {
    width: 100px !important;     /* 文章内の入力フィールドなので標準より少し縮小 */
    padding: 4px 20px 4px 8px !important;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: 'Noto Sans JP Bold', 'メイリオ', sans-serif;
    font-size: 26px !important;
    line-height: 1.4;
    text-align: right;
    background: #fff;
    margin: 0 3px;
    box-sizing: border-box;
}

/* ローン換算額エリアの単位 - 文章の一部なので標準スタイルを上書き */
.midashires .unit {
    width: auto !important;        /* 固定幅を解除 */
    margin-left: 0 !important;     /* 左余白を削除 */
    display: inline !important;    /* inline-blockではなくinlineに */
}

/* ラベルのスタイル */
.qlbl {
    display: inline-block;
    min-width: 30px;
    text-align: right;
    font-weight: bold;
    color: #333;
}

/* 操作メニューはcalculator-common.cssで定義済み */

/* シミュレーションヘッダーは calculator-common.css で定義済み */

/* #openNameの基本スタイルはcalculator-common.cssで定義済み */

.rvb-current-data-display {
    color: #666;
    font-size: 0.9rem;
}

/* Font Awesomeアイコンの調整 */
.fa, .fas, .far {
    margin-right: 5px;
}

/* 結果表示エリアの追加スタイル（基本はcalculator-common.cssから継承） */
#ans .midashi {
    font-weight: bold;
    text-align: center;
    border-radius: 3px;
}

#ans .midashires {
    margin: 10px 0;
    font-size: 14px;
}

/* 計算ボタンは calculator-common.css の共通スタイルを使用 */

/* 入力フォーム */
.rvb-input-form {
    margin-bottom: 2rem;
}

.rvb-input-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.rvb-input-form .form-group {
    display: flex;
    flex-direction: column;
}

.rvb-input-form .input-with-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rvb-input-form .input-with-unit input {
    flex: 1;
}

.rvb-input-form .unit {
    color: #666;
    font-size: 0.9rem;
    min-width: 60px;
}

/* 計算結果エリア */
.rvb-result-area {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 比較結果サマリー */
.rvb-comparison-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.rvb-summary-item {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.rvb-summary-item h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.rvb-summary-value {
    display: flex;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.rvb-summary-value .label {
    flex: 1;
    color: #666;
    font-size: 0.9rem;
}

.rvb-summary-value .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-right: 0.25rem;
}

.rvb-summary-value .unit {
    color: #666;
    font-size: 0.9rem;
}

/* 比較メッセージ */
.rvb-comparison-message {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.rvb-comparison-message .message {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0;
}

/* 1カラムレイアウトのグラフコンテナは calculator-common.css の .chart-container を使用 */
/* 2カラムレイアウトのグラフは個別にインラインスタイルで定義 */

/* データテーブル */
.rvb-data-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.rvb-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rvb-data-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.rvb-data-table th {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.rvb-data-table td {
    padding: 0.5rem;
    text-align: right;
    border: 1px solid #dee2e6;
}

.rvb-data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.rvb-data-table tbody tr:hover {
    background: #e9ecef;
}

.rvb-data-table .age-cell {
    text-align: center;
    font-weight: 500;
}

.rvb-data-table .positive {
    color: #28a745;
}

.rvb-data-table .negative {
    color: #dc3545;
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.button-group button {
    min-width: 120px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .rvb-comparison-summary {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .rvb-input-form .form-grid {
        grid-template-columns: 1fr;
    }

    .rvb-chart-container {
        height: 300px;
    }

    .rvb-data-table {
        font-size: 0.8rem;
    }

    .rvb-data-table th,
    .rvb-data-table td {
        padding: 0.4rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }
}

/* ダイアログ関連スタイルは calculator-common.css で定義済み */

/* 印刷対応は calculator-common.css で定義済み
   ※rvb固有の要素は共通CSSで対応済み */