/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --yellow-primary: #FFD700;
    --yellow-dark: #FFC107;
    --yellow-light: #FFF9C4;
    --white: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #E0E0E0;
    --bg-gray: #F5F5F5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-gray);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 页面容器 */
.page {
    display: none;
    padding-bottom: 70px;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 应用头部（黄色） */
.app-header {
    background: var(--yellow-primary);
    padding: 12px 16px 16px;
    color: var(--text-primary);
}

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

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-badge {
    position: relative;
    font-size: 20px;
}

.badge-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF4444;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.header-icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    padding: 4px;
    cursor: pointer;
}

.header-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    min-width: 80px;
    color: var(--text-primary);
}

.date-selector span {
    display: inline-block;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
}

.stats-summary {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.eye-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
}

/* 功能卡片 */
.feature-card {
    background: var(--white);
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
    display: flex;
    justify-content: space-around;
    margin-top: -8px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.feature-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gray);
    border-radius: 12px;
}

.feature-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 交易列表 */
.transaction-section {
    background: var(--white);
    padding: 16px;
}

.date-group {
    margin-bottom: 24px;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.date-text {
    font-size: 14px;
    font-weight: 500;
}

.date-expense {
    font-size: 12px;
    color: var(--text-secondary);
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F5F5F5;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
    background: var(--bg-gray);
}

.transaction-icon.expense {
    background: rgba(255, 68, 68, 0.1);
}

.transaction-icon.income {
    background: rgba(16, 185, 129, 0.1);
}

.transaction-content {
    flex: 1;
}

.transaction-title {
    font-size: 15px;
    font-weight: 500;
}

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

.transaction-amount.expense {
    color: #FF4444;
}

.transaction-amount.income {
    color: #10B981;
}

/* 记账页面头部 */
.bookkeeping-header {
    background: var(--yellow-primary);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-tabs {
    display: flex;
    gap: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 24px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--white);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cancel-btn {
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

/* 分类网格 */
.category-section {
    background: var(--white);
    padding: 16px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-item:active {
    background: var(--bg-gray);
}

.category-item.selected {
    background: var(--yellow-light);
}

.category-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.category-label {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
}

/* 金额显示 */
.amount-display {
    background: var(--white);
    padding: 24px 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.amount-value {
    font-size: 48px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 备注区域 */
.note-section {
    background: var(--white);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.note-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-input {
    flex: 1;
    border: none;
    background: var(--bg-gray);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.note-input:focus {
    outline: none;
    background: #F0F0F0;
}

.note-actions {
    display: flex;
    gap: 8px;
}

.note-action-btn {
    background: none;
    border: none;
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
}

/* 数字键盘 */
.keypad-section {
    background: var(--white);
    display: flex;
    padding: 16px;
    gap: 12px;
}

.keypad-left {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keypad-row {
    display: flex;
    gap: 12px;
}

.keypad-btn {
    flex: 1;
    background: var(--bg-gray);
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-size: 24px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
}

.keypad-btn:active {
    background: #E0E0E0;
    transform: scale(0.95);
}

.keypad-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keypad-func-btn {
    background: var(--bg-gray);
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.1s;
}

.keypad-func-btn:active {
    background: #E0E0E0;
}

.keypad-complete-btn {
    background: var(--yellow-primary);
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    transition: all 0.1s;
}

.keypad-complete-btn:active {
    background: var(--yellow-dark);
    transform: scale(0.98);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    position: relative;
    flex: 1;
    padding: 4px;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-icon {
    font-size: 22px;
}

.nav-label {
    font-size: 11px;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 8px;
    background: #FF4444;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.nav-center {
    position: relative;
}

.nav-center-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--yellow-primary);
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    margin-bottom: -8px;
}

/* 通用样式 */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.page-header {
    background: var(--white);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--text-primary);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s;
    font-size: 14px;
    pointer-events: none;
}

.message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.message-success {
    background: #10B981;
}

.message-error {
    background: #FF4444;
}

.message-info {
    background: var(--yellow-primary);
    color: var(--text-primary);
}

/* 响应式 */
@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .amount-value {
        font-size: 40px;
    }
}
