/* ============================================
   summary-table.css - データ表の共通スタイル
   対象: data_lifetime.php, data_yearly.php, data_monthly.php
   ============================================ */

/* 基本テーブルスタイル */
.summary-table {
    table-layout: fixed;
    border-collapse: collapse;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    font-size: 16px;
}

/* 損益色 */
.summary-table .profit {
    color: var(--profit);
}

.summary-table .loss {
    color: var(--loss);
}

/* セル共通スタイル */
.summary-table td,
.summary-table th {
    display: table-cell !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-left: none !important;
    border-right: none !important;
    padding: 12px 8px !important;
    text-align: center;
    vertical-align: middle;
}

/* ヘッダー行のスタイル */
.summary-table thead th {
    font-size: 16px !important;
    font-weight: 600 !important;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #1e293b;
}

[data-theme="dark"] .summary-table thead th {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
}

/* データセルのフォント太さ */
.summary-table tbody td {
    font-weight: 500;
}

/* 年/月セル固定幅（PC用） */
.summary-table th.th-year,
.summary-table th.th-month,
.summary-table td.month-cell {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

/* 年/月セルのみ右ボーダー */
.summary-table td.month-cell {
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* 合計列に左線 */
.summary-table td:last-child,
.summary-table th:last-child {
    border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* データ行ホバー */
.summary-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.summary-row:hover {
    background-color: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

/* stickyヘッダー */
.summary-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 合計行スタイル */
.summary-row-total {
    background-color: #f0f9ff !important;
    font-weight: 700;
}

.summary-row-total td {
    background-color: #f0f9ff !important;
    border-top: 2px solid #bae6fd !important;
    border-bottom: 2px solid #bae6fd !important;
}

[data-theme="dark"] .summary-row-total,
[data-theme="dark"] .summary-row-total td {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* ダークモード対応 */
[data-theme="dark"] .summary-table td,
[data-theme="dark"] .summary-table th {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .summary-table td.month-cell {
    border-right-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .summary-table td:last-child,
[data-theme="dark"] .summary-table th:last-child {
    border-left-color: rgba(255, 255, 255, 0.1) !important;
}

/* ヘッダー行の年/月列 */
.summary-table thead tr th.th-year,
.summary-table thead tr th.th-month {
    background: #e5e7eb !important;
    background-color: #e5e7eb !important;
    background-image: none !important;
    color: #1e293b !important;
}

/* ヘッダー行の合計列 */
.summary-table thead tr th.th-total {
    background: #e5e7eb !important;
    background-color: #e5e7eb !important;
    background-image: none !important;
    color: #1e293b !important;
    border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] .summary-table thead tr th.th-year,
[data-theme="dark"] .summary-table thead tr th.th-month {
    background: #1e293b !important;
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .summary-table thead tr th.th-total {
    background: #1e293b !important;
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* カテゴリ列のヘッダー */
.summary-table thead tr th {
    background-image: none !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 下部ナビゲーション */
.bottom-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px 0;
}

.bottom-nav .btn-nav {
    padding: 8px 20px;
    font-size: 14px;
}

/* PCモード時はカテゴリ合計を非表示 */
.summary-categories-inline {
    display: none;
}