* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 20px;
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

/* 页面切换样式 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 表单样式 */
form {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

input, select, button {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

button {
    background-color: #007AFF;
    color: white;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: none;
    background: none;
    color: #666;
    padding: 5px;
    width: 25%;
}

.nav-item.active {
    color: #007AFF;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

/* 统计页面样式 */
.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.stats-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#chartContainer {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    min-height: 300px;
}

/* 设置页面样式 */
.settings-section {
    margin: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.list-container {
    background: #fff;
    border-radius: 8px;
}

.list-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.list-item:hover {
    background: #f5f5f5;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.category-type {
    margin: 15px 0;
}

.main-category {
    margin-left: 15px;
}

.sub-categories {
    margin-left: 30px;
}

.item-count {
    color: #666;
    font-size: 0.9em;
}

.transaction-form {
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 15px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.balance-preview {
    margin-top: 5px;
    font-size: 14px;
    color: #666;
    padding: 4px 0;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.submit-btn:hover {
    background: #45a049;
}

.today-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.today-summary {
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

.today-summary div {
    font-size: 14px;
    color: #333;
}

.transactions-list {
    margin-top: 10px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.transaction-info {
    flex: 1;
}

.transaction-info .category {
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.transaction-info .note {
    font-size: 14px;
    color: #666;
}

.amount {
    font-size: 16px;
    font-weight: 500;
}

.amount.expense {
    color: #ff4444;
}

.amount.income {
    color: #4CAF50;
}

#weeklyChart {
    margin-top: 20px;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .transaction-form {
        padding: 10px;
    }

    .form-group select,
    .form-group input {
        font-size: 14px;
    }

    .today-summary {
        flex-direction: column;
    }

    .today-summary div {
        margin-bottom: 5px;
    }
}