/* ========================================
   Part 7: 収支管理スタイル
   ======================================== */

/* 基本レイアウト */
.expense-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* サマリーセクション */
.summary-section {
    background: var(--bg-secondary, #f8f9fa);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.summary-item {
    background: var(--bg-primary, white);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #dee2e6);
    text-align: center;
    transition: transform 0.2s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* タブメニュー */
.expense-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color, #dee2e6);
    overflow-x: auto;
}

.expense-tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 14px;
    color: var(--text-primary, #333);
}

.expense-tab-btn:hover {
    background: var(--bg-hover, #f8f9fa);
    border-radius: 4px 4px 0 0;
}

.expense-tab-btn[style*="border-bottom: 3px"] {
    font-weight: 600;
    color: #007bff;
}

/* フォーム要素 */
.expense-form {
    background: var(--bg-primary, white);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #dee2e6);
    margin-bottom: 20px;
}

.expense-form input,
.expense-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color, #ced4da);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.expense-form input:focus,
.expense-form select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

/* 一括入力テーブル */
#bulkInputTable {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary, white);
}

#bulkInputTable th {
    background: var(--bg-secondary, #f8f9fa);
    padding: 10px 8px;
    border: 1px solid var(--border-color, #dee2e6);
    font-weight: 600;
    font-size: 13px;
    text-align: left;
}

#bulkInputTable td {
    padding: 4px;
    border: 1px solid var(--border-color, #dee2e6);
}

#bulkInputTable input,
#bulkInputTable select {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color, #ced4da);
    border-radius: 3px;
    font-size: 13px;
}

/* ボタンスタイル */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 経費リスト */
.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color, #f8f9fa);
    transition: background 0.2s ease;
}

.expense-item:hover {
    background: var(--bg-hover, #f8f9fa);
}

.expense-date {
    font-size: 13px;
    color: #6c757d;
}

.expense-category {
    font-size: 12px;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .expense-container {
        padding: 10px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .expense-tabs {
        flex-wrap: nowrap;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .expense-tab-btn {
        flex: 0 0 auto;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    #bulkInputTable {
        font-size: 11px;
    }
    
    #bulkInputTable th,
    #bulkInputTable td {
        padding: 4px 2px;
    }
    
    #bulkInputTable input,
    #bulkInputTable select {
        padding: 4px;
        font-size: 11px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* モバイルでの横スクロール対応 */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .expense-form > div {
        grid-template-columns: 1fr !important;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ダークモード対応 */
body.dark-mode {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d30;
    --bg-hover: #353538;
    --text-primary: #e4e4e4;
    --border-color: #444;
}

body.dark-mode .summary-section {
    background: #2d2d30;
    color: #e4e4e4;
}

body.dark-mode .summary-item {
    background: #1e1e1e;
    border-color: #444;
    color: #e4e4e4;
}

body.dark-mode .expense-form {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-mode .expense-form input,
body.dark-mode .expense-form select {
    background: #2d2d30;
    color: #e4e4e4;
    border-color: #444;
}

body.dark-mode #bulkInputTable {
    background: #1e1e1e;
}

body.dark-mode #bulkInputTable th {
    background: #2d2d30;
    color: #e4e4e4;
}

body.dark-mode #bulkInputTable td {
    border-color: #444;
}

body.dark-mode #bulkInputTable input,
body.dark-mode #bulkInputTable select {
    background: #2d2d30;
    color: #e4e4e4;
    border-color: #444;
}

body.dark-mode .expense-item:hover {
    background: #2d2d30;
}

body.dark-mode .expense-category {
    background: #3d3d40;
    color: #e4e4e4;
}

/* アニメーション */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.expense-section {
    animation: slideIn 0.3s ease;
}

/* スクロールバーカスタマイズ */
.expense-tabs::-webkit-scrollbar {
    height: 4px;
}

.expense-tabs::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.expense-tabs::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.expense-tabs::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 印刷対応 */
@media print {
    .expense-tabs,
    .btn,
    button {
        display: none !important;
    }
    
    .expense-section {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* ========== 8_expense.css に追加/修正 ========== */

/* ダークモード時の背景を暗く修正 */
body:not(.light-mode) #tax {
    background: #0a0a0a !important;
}

body:not(.light-mode) #tax .expense-container {
    background: #0a0a0a !important;
}

body:not(.light-mode) #tax .expense-form {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
}

body:not(.light-mode) #tax .summary-section {
    background: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
}

body:not(.light-mode) #tax .summary-item {
    background: #252525 !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
}

/* 入力フィールドも暗く */
body:not(.light-mode) #tax input,
body:not(.light-mode) #tax select,
body:not(.light-mode) #tax textarea {
    background: #2d2d2d !important;
    color: #ffffff !important;
    border: 1px solid #555 !important;
}

/* テーブルも暗く */
body:not(.light-mode) #tax table {
    background: #1a1a1a !important;
}

body:not(.light-mode) #tax th {
    background: #252525 !important;
    color: #00ff88 !important;
}

body:not(.light-mode) #tax td {
    background: #1e1e1e !important;
    color: #e0e0e0 !important;
}

/* タブセクション全体も暗く */
body:not(.light-mode) #tax .expense-tabs {
    background: #1a1a1a !important;
}

body:not(.light-mode) #tax .expense-section {
    background: #0a0a0a !important;
}

/* すべての白い要素を強制的に暗く（カレンダー要素を除外） */
body:not(.light-mode) #tax *:not([class*="calendar"]) {
    background-color: inherit !important;
    color: #e0e0e0 !important;
}

/* 特定の要素だけ個別に設定 */
body:not(.light-mode) #tax .btn-primary {
    background: #00ff88 !important;
    color: #000 !important;
}