@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

/* --- 基本レイアウト --- */
body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #f0f2f5;
    margin: 0; padding: 0; color: #333;
}

.container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

h2 { border-bottom: 2px solid #007bff; padding-bottom: 8px; font-size: 1.2em; margin-bottom: 20px; }

/* --- ボタン・ナビゲーション --- */
.header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn { padding: 8px 16px; border-radius: 5px; text-decoration: none; cursor: pointer; border: none; display: inline-block; font-weight: bold; }
.btn-print { background: #6c757d; color: white; }
.btn-add { background: #007bff; color: white; }
.logout-link { font-size: 1.2em; margin-left: 10px; vertical-align: middle; }

/* 月切り替えナビ */
.month-nav { display: flex; align-items: center; gap: 15px; font-size: 1.2em; font-weight: bold; }
.month-nav a { color: #007bff; text-decoration: none; padding: 5px 10px; border-radius: 4px; background: #f0f7ff; }

/* --- グラフエリア --- */
.chart-container { 
    margin-bottom: 30px; 
    background: #fff; 
    padding: 15px; 
    border-radius: 8px; 
    border: 1px solid #eee; 
    height: 350px; 
    position: relative; 
}

/* --- デスクトップ用：表形式 --- */
.desktop-table { width: 100%; border-collapse: collapse; display: table; margin-top: 10px; }
.desktop-table th, .desktop-table td { border: 1px solid #ddd; padding: 12px; text-align: left; vertical-align: top; }
.desktop-table th { background: #f8f9fa !important; -webkit-print-color-adjust: exact; }

/* --- スマホ用：カード形式 --- */
.mobile-cards { display: none; }
.card { background: white; border: 1px solid #ddd; border-radius: 10px; padding: 15px; margin-bottom: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.card-row { display: block; margin-bottom: 10px; padding: 8px; border-radius: 4px; line-height: 1.6; word-break: break-all; }
.label { font-weight: bold; color: #333; }

/* 背景色設定（印刷時も反映） */
.pos-bg { background-color: #e8f5e9 !important; border-left: 4px solid #28a745; -webkit-print-color-adjust: exact; }
.neg-bg { background-color: #ffebee !important; border-left: 4px solid #dc3545; -webkit-print-color-adjust: exact; }
.thought-bg { background-color: #fff9c4 !important; border-left: 4px solid #fbc02d; -webkit-print-color-adjust: exact; }

/* --- フォーム入力画面用（index.php用） --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 8px; }
input[type="text"], input[type="number"], input[type="date"], textarea {
    width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 16px;
}
textarea { min-height: 150px; line-height: 1.6; resize: vertical; }

/* --- レスポンシブ切り替え --- */
@media (max-width: 768px) {
    .desktop-table { display: none; }
    .mobile-cards { display: block; }
    .header-flex { flex-direction: column; gap: 15px; text-align: center; }
}

/* --- 印刷用設定 --- */
@media print {
    body { background: white; width: 100%; }
    .no-print, .btn, .month-nav a, .logout-link { display: none !important; }
    
    /* 印刷時は強制的に表形式 */
    .desktop-table { display: table !important; width: 100%; font-size: 10pt; }
    .mobile-cards { display: none !important; }
    
    .chart-container { 
        display: block !important; 
        height: 300px !important; 
        width: 100% !important; 
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    .container { width: 100%; max-width: 100%; box-shadow: none; border: none; margin: 0; padding: 0; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}