/* リセット＆基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
}

/* セクション共通 */
section {
    padding: 30px;
    border-bottom: 1px solid #e0e0e0;
}

section:last-of-type {
    border-bottom: none;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #667eea;
}

/* フォームスタイル */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* ボタン */
.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-success {
    background: #f6ad55;
    color: white;
    width: 100%;
}

.btn-success:hover {
    background: #ed8936;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(246, 173, 85, 0.4);
}

/* カテゴリ別集計 */
.category-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.category-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.category-item .category-name {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.category-item .category-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.total-summary {
    background: #667eea;
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
}

.total-summary strong {
    margin-right: 10px;
}

/* 支出一覧 */
.expense-list {
    max-height: 500px;
    overflow-y: auto;
}

.expense-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.expense-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.expense-info {
    flex: 1;
}

.expense-header {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
}

.expense-date {
    color: #718096;
    font-size: 0.9rem;
}

.expense-category {
    background: #667eea;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.expense-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

.expense-memo {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 5px;
}

.expense-delete {
    background: #fc8181;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.expense-delete:hover {
    background: #f56565;
    transform: scale(1.05);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
}

.empty-state p {
    font-size: 1.1rem;
}

/* フッター */
footer {
    background: #f7fafc;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 20px;
    }

    .category-summary {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .expense-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .expense-delete {
        margin-top: 10px;
        width: 100%;
    }
}

/* スクロールバーのカスタマイズ */
.expense-list::-webkit-scrollbar {
    width: 8px;
}

.expense-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.expense-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.expense-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
