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

:root {
    --primary-red: #d32f2f;
    --bright-red: #ff5252;
    --dark-red: #b71c1c;
    --gold: #ffd700;
    --light-gold: #fff59d;
    --cream: #fff8e1;
    --text-dark: #333;
    --text-light: #fff;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #8b0000 0%, #c62828 50%, #8b0000 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 节日头部 */
.festival-header {
    text-align: center;
    padding: 30px 20px;
    position: relative;
    background: linear-gradient(to bottom, #b71c1c, #c62828);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.festival-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 215, 0, 0.05) 10px,
        rgba(255, 215, 0, 0.05) 20px
    );
}

.lantern {
    position: absolute;
    top: 20px;
    width: 60px;
    height: 80px;
    background: radial-gradient(ellipse at center, #ff5252 0%, #d32f2f 100%);
    border-radius: 50% 50% 50% 50%;
    box-shadow: 0 0 30px rgba(255, 82, 82, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: swing 3s ease-in-out infinite;
}

.lantern::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 15px;
    background: var(--gold);
    border-radius: 50% 50% 0 0;
}

.lantern::after {
    content: '福';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gold);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.lantern-left {
    left: 60px;
    animation-delay: 0s;
}

.lantern-right {
    right: 60px;
    animation-delay: 1.5s;
}

@keyframes swing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.main-title {
    color: var(--gold);
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    letter-spacing: 3px;
}

.title-icon {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

.title-icon:last-child {
    animation-delay: 1s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 导航标签 */
.tab-nav {
    display: flex;
    background: var(--dark-red);
    padding: 10px;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    background: linear-gradient(to bottom, #d32f2f, #b71c1c);
    color: var(--gold);
    border: 2px solid var(--gold);
    border-radius: 10px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.tab-btn:hover {
    background: linear-gradient(to bottom, #b71c1c, #8b0000);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.tab-btn.active {
    background: var(--gold);
    color: var(--dark-red);
    border-color: var(--dark-red);
    transform: scale(1.05);
}

/* 主内容区 */
main {
    background: var(--cream);
    border-radius: 0 0 20px 20px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* 卡片样式 */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--light-gold);
}

.card-title {
    color: var(--dark-red);
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-red);
}

/* 表单样式 */
.record-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.2);
}

/* 按钮 */
.btn-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(to bottom, var(--bright-red), var(--primary-red));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
}

.btn-submit:hover {
    background: linear-gradient(to bottom, var(--primary-red), var(--dark-red));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.6);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--dark-red);
}

/* 记录列表 */
.records-list {
    max-height: 400px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff8e1, #fff);
    border-left: 4px solid var(--primary-red);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.record-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px var(--shadow);
}

.record-item.type-receive {
    border-left-color: #4caf50;
}

.record-item.type-give {
    border-left-color: #2196f3;
}

.record-info {
    flex: 1;
}

.record-name {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--text-dark);
}

.record-details {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.record-amount {
    font-size: 1.3em;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 20px;
}

.record-amount.receive {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.record-amount.give {
    color: #2196f3;
    background: rgba(33, 150, 243, 0.1);
}

.record-actions {
    margin-left: 10px;
}

.btn-delete {
    padding: 5px 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-delete:hover {
    background: #d32f2f;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-income {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 2px solid #4caf50;
}

.stat-expense {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid #2196f3;
}

.stat-balance {
    background: linear-gradient(135deg, #fff8e1, #ffe0b2);
    border: 2px solid var(--gold);
}

.stat-count {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    border: 2px solid #9c27b0;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-income .stat-value { color: #2e7d32; }
.stat-expense .stat-value { color: #1565c0; }
.stat-balance .stat-value { color: #e65100; }
.stat-count .stat-value { color: #6a1b9a; }

.stat-label {
    color: #666;
    font-size: 0.9em;
}

/* 个人统计 */
.person-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.person-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(to right, #fff8e1, #fff);
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
}

.person-stat-name {
    font-weight: bold;
    flex: 1;
}

.person-stat-details {
    text-align: right;
}

.person-stat-net {
    font-weight: bold;
    margin-top: 5px;
}

.net-positive { color: #4caf50; }
.net-negative { color: #f44336; }

/* 关系分布图表 */
.relationship-chart {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.relationship-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.relationship-label {
    width: 120px;
    font-weight: bold;
}

.relationship-bar-fill {
    flex: 1;
    height: 30px;
    background: linear-gradient(to right, var(--primary-red), var(--bright-red));
    border-radius: 5px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: white;
    font-weight: bold;
    min-width: 50px;
}

.relationship-count {
    width: 80px;
    text-align: right;
    font-weight: bold;
}

/* 对比控制 */
.comparison-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.comparison-controls select {
    padding: 10px 20px;
    font-size: 1.1em;
    border: 2px solid var(--primary-red);
    border-radius: 8px;
    cursor: pointer;
}

.vs-text {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-red);
}

.comparison-result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.comparison-card {
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--primary-red);
}

.comparison-card h4 {
    color: var(--dark-red);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.comparison-value {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.comparison-change {
    font-size: 0.9em;
    padding: 5px 10px;
    border-radius: 5px;
}

.change-positive {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.change-negative {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

/* 年度趋势 */
.yearly-trend {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.trend-year {
    width: 80px;
    font-weight: bold;
    color: var(--dark-red);
}

.trend-bar {
    flex: 1;
    display: flex;
    gap: 5px;
    height: 40px;
}

.trend-bar-income {
    background: linear-gradient(to right, #81c784, #4caf50);
    border-radius: 5px 0 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    min-width: 40px;
}

.trend-bar-expense {
    background: linear-gradient(to right, #64b5f6, #2196f3);
    border-radius: 0 5px 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    min-width: 40px;
}

/* 回礼建议 */
.suggestion-result {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(to right, #fff8e1, #fff);
    border-radius: 10px;
    border-left: 4px solid var(--gold);
}

.suggestion-amount {
    font-size: 2em;
    font-weight: bold;
    color: var(--dark-red);
    margin: 15px 0;
}

.suggestion-reason {
    color: #666;
    line-height: 1.6;
}

.suggestion-history {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
}

.suggestion-history h5 {
    color: var(--dark-red);
    margin-bottom: 10px;
}

/* 权重说明 */
.weight-explanation {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(to right, #fff8e1, #fff);
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
}

.weight-label {
    font-weight: bold;
    flex: 1;
}

.weight-value {
    background: var(--gold);
    color: var(--dark-red);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    margin: 0 15px;
}

.weight-desc {
    color: #666;
    font-size: 0.9em;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--primary-red);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-title {
        font-size: 1.8em;
    }

    .lantern {
        width: 40px;
        height: 60px;
    }

    .lantern::after {
        font-size: 18px;
    }

    .tab-nav {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .comparison-controls {
        flex-direction: column;
    }

    .vs-text {
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .record-amount {
        margin-top: 10px;
    }

    .record-actions {
        margin-top: 10px;
        margin-left: 0;
    }
}

/* 滚动条样式 */
.records-list::-webkit-scrollbar {
    width: 8px;
}

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

.records-list::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

.records-list::-webkit-scrollbar-thumb:hover {
    background: var(--dark-red);
}