/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* 头部样式 */
.header {
    background-color: #ffffff;
    color: #334155;
    padding: 1.5rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

/* 统计卡片样式 */
.stats-cards-container {
    margin-bottom: 1rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    background: white;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    flex-shrink: 0;
    margin-right: 1.2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    align-items: flex-start;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    width: 100%;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    padding: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    width: 100%;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: left;
    align-self: flex-start;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    width: 100%;
}

.stat-value.income {
    color: #10b981;
}

.stat-value.expense {
    color: #ef4444;
}

.stat-value.balance {
    color: #f59e0b;
}

.stat-card.income-card .stat-label {
    color: #10b981;
}

.stat-card.expense-card .stat-label {
    color: #ef4444;
}

.stat-card.balance-card .stat-label {
    color: #f59e0b;
}

/* 主容器样式 */
.main-container {
    max-width: 800px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* 导航标签样式 */
.nav-tabs {
    display: flex;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 6px;
    position: relative;
    margin-bottom: 2rem;
}

/* 标签按钮样式 */
.nav-tabs .tab-btn {
    flex: 1;
    padding: 1rem 1.2rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 12px;
    color: #64748b;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid transparent !important;
}

.nav-tabs .tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.nav-tabs .tab-btn:hover {
    color: #475569;
    transform: translateY(-1px);
}

.nav-tabs .tab-btn.active {
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border-bottom: 2px solid #2563eb !important;
}

.nav-tabs .tab-btn.active::before {
    opacity: 0;
}

/* 标签内容样式 */
.tab-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

.tab-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    opacity: 0.7;
}

.tab-panel {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 表单样式 */
.transaction-form {
    max-width: 600px;
    margin: 0 auto;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.transaction-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 1.5rem;
    position: relative;
}

.transaction-form h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 3px;
}

.form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
}

/* 自定义分类输入样式 */
.category-input-group {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.category-input-group::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-input-group:focus-within::after {
    transform: scaleX(1);
}

.category-input-group select {
    flex: 1;
    transition: all 0.3s ease;
}

.custom-category-input {
    margin-top: 0.5rem;
    width: 100%;
    transition: all 0.3s ease;
}

.form-group .radio-group {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem;
    border-radius: 12px;
    position: relative;
    align-items: center !important;
    min-height: 48px !important;
}

.radio-item {
    flex: 1;
    position: relative;
}

.radio-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.radio-item input[type="radio"]:checked + .radio-label {
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.radio-item input[type="radio"]:checked + .radio-label.expense {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.radio-item input[type="radio"]:checked + .radio-label.income {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.radio-label.expense {
    background-color: #fee2e2;
    color: #dc2626;
}

.radio-label.income {
    background-color: #dcfce7;
    color: #16a34a;
}

input[type="number"],
input[type="date"],
input[type="month"],
input[type="text"],
select,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

input[type="number"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* 按钮样式 */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
}

/* 列表控制样式 */
.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.filter-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-group select,
.filter-group input {
    padding: 0.6rem 1rem;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    min-width: 120px;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .list-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }
}

/* 交易列表样式 */
.transaction-list {
    margin-top: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* 筛选后的小计金额样式 */
.filtered-summary {
    margin-top: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filtered-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.filtered-summary .summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.filtered-summary .summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.filtered-summary .summary-card:nth-child(1)::before {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.filtered-summary .summary-card:nth-child(2)::before {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.filtered-summary .summary-card:nth-child(3)::before {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.filtered-summary .summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.filtered-summary .summary-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filtered-summary .summary-card p {
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
}

.filtered-summary .summary-card:nth-child(1) p {
    color: #16a34a;
}

.filtered-summary .summary-card:nth-child(2) p {
    color: #dc2626;
}

.filtered-summary .summary-card:nth-child(3) p {
    color: #3b82f6;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.transaction-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.transaction-item.expense::before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.transaction-item.income::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.transaction-item:hover {
    background-color: rgba(248, 250, 252, 0.8);
    transform: translateX(4px);
}

.transaction-item:hover::before {
    transform: scaleY(1);
}

.transaction-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.transaction-type {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transaction-type.expense {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.transaction-type.income {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.transaction-category {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
}

.transaction-date {
    color: #64748b;
    font-size: 0.9rem;
}

.transaction-note {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.3rem;
    font-style: italic;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 1rem;
}

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

.transaction-amount.income {
    color: #16a34a;
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
}

.transaction-actions .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-width: auto;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: rgba(241, 245, 249, 0.8);
    color: #334155;
    transform: scale(1.1);
}

.btn-icon.delete-category-btn {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 40px;
    color: #fff;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-icon.delete-category-btn:hover {
    background: linear-gradient(135deg, #f55a4e, #e53935);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-icon.delete:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.empty-state::before {
    content: '📊';
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 400px;
    margin: 0 auto;
}

/* 统计页面样式 */
.stats-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.summary-card.expense::before {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.summary-card.income::before {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
}

.summary-card.balance::before {
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.summary-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-card p {
    font-size: 2rem;
    font-weight: 700;
    color: #334155;
}

.summary-card.expense p {
    color: #dc2626;
}

.summary-card.income p {
    color: #16a34a;
}

.summary-card.balance p {
    color: #3b82f6;
}

.chart-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: center;
    width: 100%;
    overflow-x: auto;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    position: relative;
    padding-bottom: 0.75rem;
}

.chart-container h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 2px;
}

/* 分类统计样式 */
.category-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.category-stats-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-stats-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.category-stats-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.expense-header {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-bottom: 2px solid rgba(239, 68, 68, 0.1);
}

.income-header {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-bottom: 2px solid rgba(34, 197, 94, 0.1);
}

.category-stats-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
    position: relative;
}

.category-stats-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 40px;
    height: 3px;
    border-radius: 2px;
}

.expense-header .category-stats-title::after {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.income-header .category-stats-title::after {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
}

.category-stats-total {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
}

.expense-header .category-stats-total {
    color: #dc2626;
    background-color: rgba(239, 68, 68, 0.1);
}

.income-header .category-stats-total {
    color: #16a34a;
    background-color: rgba(34, 197, 94, 0.1);
}

.category-stats-list {
    padding: 1.5rem;
}

.category-stat-item {
    margin-bottom: 1.5rem;
    position: relative;
    padding: 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.category-stat-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.category-stat-item:last-child {
    margin-bottom: 0;
}

.stat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.stat-name {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-name::before {
    content: '📁';
    font-size: 1rem;
}

.stat-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.expense-item .stat-amount {
    color: #dc2626;
}

.income-item .stat-amount {
    color: #16a34a;
}

.stat-percentage {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.stat-bar-container {
    height: 10px;
    background-color: rgba(226, 232, 240, 0.5);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.stat-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.stat-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.expense-bar {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.income-bar {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
}

.empty-stats {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 2rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px dashed rgba(156, 163, 175, 0.3);
}

/* 统计页面分类样式优化 */
.stats-list {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 1.5rem;
}

.stats-list h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #334155;
    position: relative;
    padding-bottom: 0.5rem;
}

.stats-list h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    border-radius: 2px;
}

.stats-list h4:first-of-type {
    margin-top: 0;
}

.stats-list h4:first-of-type::after {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.stats-list h4:nth-of-type(2) {
    margin-top: 2rem;
}

.stats-list h4:nth-of-type(2)::after {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.stat-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-category {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-category::before {
    content: '📁';
    font-size: 0.9rem;
}

.stat-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-amount.expense {
    color: #dc2626;
}

.stat-amount.income {
    color: #16a34a;
}

.stat-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.expense-item .stat-amount {
    color: #dc2626;
}

.income-item .stat-amount {
    color: #16a34a;
}

.stat-percentage {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.stat-bar-container {
    height: 10px;
    background-color: rgba(226, 232, 240, 0.5);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.stat-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.stat-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.expense-bar {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.income-bar {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
}

.empty-stats {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 2rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px dashed rgba(156, 163, 175, 0.3);
}

/* 响应式布局 */
@media (max-width: 768px) {
    .category-stats-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .category-stats-header {
        padding: 0.8rem 1.2rem;
    }
    
    .category-stats-list {
        padding: 0.8rem 1.2rem;
    }
}

/* 分类管理样式 */
.categories-management {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 2rem;
}

.categories-management h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.categories-management h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.categories-management > div {
    margin-bottom: 2rem;
}

.categories-management > div:last-child {
    margin-bottom: 0;
}

/* 优化输入框和按钮容器布局 */
.categories-management .flex {
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 优化输入框样式 */
.categories-management input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    outline: none;
}

.categories-management input[type="text"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.categories-management input[type="text"]::placeholder {
    color: #94a3b8;
}

/* 优化按钮样式 */
.categories-management .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    white-space: nowrap;
    width: auto;
    min-width: 80px;
}

.categories-management .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.category-list {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 1rem;
    min-height: 100px;
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: 10px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 232, 240, 0.5);
    position: relative;
    overflow: hidden;
}

.category-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-item:hover::before {
    transform: scaleY(1);
}

.category-item:last-child {
    margin-bottom: 0;
}

.category-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.category-item span {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.5rem;
}

.category-item span::before {
    content: '📁';
    font-size: 1rem;
}

.delete-category-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.delete-category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.delete-category-btn:hover::before {
    left: 100%;
}

.delete-category-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

.delete-category-btn:active {
    transform: scale(0.98);
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 2rem;
    font-size: 1rem;
}

.category-type.expense {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.category-type.income {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.category-actions {
    display: flex;
    gap: 0.5rem;
}

.add-category h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    position: relative;
    padding-bottom: 0.75rem;
}

.add-category h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 2px;
}

.add-category .form-group {
    margin-bottom: 1.5rem;
}

.add-category label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #475569;
}

.add-category input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-category input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.add-category .radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.add-category .radio-item {
    flex: 1;
    position: relative;
}

.add-category .radio-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.add-category .radio-label {
    display: block;
    padding: 0.8rem;
    text-align: center;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.add-category .radio-item input[type="radio"]:checked + .radio-label {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.add-category .radio-item input[type="radio"]:checked + .radio-label.expense {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.add-category .radio-item input[type="radio"]:checked + .radio-label.income {
    border-color: #10b981;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.add-category .btn {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1rem;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #334155;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: #6b7280;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 500;
}

.message.show {
    opacity: 1;
}

.message.success {
    background-color: #10b981;
    color: white;
}

.message.error {
    background-color: #ef4444;
    color: white;
}

.message.info {
    background-color: #3b82f6;
    color: white;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 表单验证样式 */
.form-group input:invalid,
.form-group select:invalid {
    /* 移除红色边框，使用默认边框样式 */
}

.form-group .error-message {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: none;
}

.form-group.has-error .error-message {
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        padding: 0.75rem;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 4px;
    }
    
    .tab-btn {
        flex: 1;
        min-width: calc(50% - 0.5rem);
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* 修改移动端数据卡片布局 */
    .stats-cards-container {
        width: 100%;
        overflow: hidden;
    }
    
    .stats-cards {
        display: grid !important;
        gap: 0.5rem;
        width: 100%;
    }
    
    /* 第一行和第二行：三个卡片 */
    .stats-cards-container .stats-cards:nth-child(1),
    .stats-cards-container .stats-cards:nth-child(2) {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* 第三行：两个卡片 */
    .stats-cards-container .stats-cards:nth-child(3) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 缩小卡片尺寸 */
    .stat-card {
        padding: 0.5rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .stat-icon {
        font-size: 1.2rem;
        margin-right: 0;
        margin-bottom: 0.2rem;
    }
    
    .stat-info {
        width: 100%;
        text-align: center;
    }
    
    .stat-label {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
    }
    
    .stat-value {
        font-size: 1rem;
        font-weight: bold;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .list-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }
    
    .category-stats-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .category-management {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .category-item {
        padding: 0.8rem 1rem;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .transaction-amount {
        margin-right: 0;
        align-self: flex-end;
    }
    
    .transaction-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .chart-container {
        padding: 1.5rem;
    }
    
    .category-stats-section {
        margin-bottom: 1.5rem;
    }
    
    .category-stats-header {
        padding: 1rem;
    }
    
    .category-stats-list {
        padding: 1rem;
    }
    
    .category-list {
        padding: 1.5rem;
    }
    
    .add-category {
        padding: 1.5rem;
    }
    
    .transaction-form {
        padding: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .tab-btn {
        min-width: calc(50% - 0.25rem);
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    /* 修改小屏幕数据卡片布局 */
    .stats-cards-container {
        width: 100%;
        overflow: hidden;
    }
    
    .stats-cards {
        display: grid !important;
        gap: 0.3rem;
        width: 100%;
    }
    
    /* 第一行和第二行：三个卡片 */
    .stats-cards-container .stats-cards:nth-child(1),
    .stats-cards-container .stats-cards:nth-child(2) {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* 第三行：两个卡片 */
    .stats-cards-container .stats-cards:nth-child(3) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 进一步缩小卡片尺寸 */
    .stat-card {
        padding: 0.4rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .stat-icon {
        font-size: 1rem;
        margin-right: 0;
        margin-bottom: 0.1rem;
    }
    
    .stat-info {
        width: 100%;
        text-align: center;
    }
    
    .stat-label {
        font-size: 0.6rem;
        margin-bottom: 0.1rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
        font-weight: bold;
    }
    
    .transaction-item {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .transaction-actions {
        gap: 0.4rem;
    }
    
    .transaction-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .category-stats-header {
        padding: 0.8rem;
    }
    
    .category-stats-list {
        padding: 0.8rem;
    }
    
    .category-stat-item {
        padding: 0.6rem;
    }
    
    .category-list {
        padding: 1rem;
    }
    
    .category-item {
        padding: 0.6rem 0.8rem;
    }
    
    .add-category {
        padding: 1rem;
    }
    
    .transaction-form {
        padding: 1rem;
    }
    
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .modal-content {
        width: 98%;
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .stats-summary {
        gap: 1rem;
    }
    
    .summary-card {
        padding: 1rem;
    }
    
    .summary-card p {
        font-size: 1.5rem;
    }
}

/* 分页控件样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pagination-container .btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none !important;
}

.pagination-container .btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    transform: translateY(-2px);
    box-shadow: none !important;
}

.pagination-container .btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none !important;
}

.pagination-container .btn:disabled {
    background: #cbd5e1 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none !important;
}

.pagination-container .btn.disabled {
    background: #cbd5e1 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none !important;
}

.pagination-info {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pagination-info span {
    font-weight: 700;
    color: #3b82f6;
}