/**
 * 人情往来记账系统 - 样式表
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    text-decoration: none;
    color: #1890ff;
}

/* 登录页 */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 8px;
    font-size: 24px;
}

.login-box .subtitle {
    text-align: center;
    color: #999;
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid #e8e8e8;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    position: relative;
}

.tab-btn.active {
    color: #1890ff;
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #1890ff;
}

.form {
    display: none;
}

.form.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1890ff;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.hint {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 16px;
}

.message {
    margin-top: 16px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    display: none;
}

.message.success {
    display: block;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.message.error {
    display: block;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

/* 表单底部链接 */
.form-footer {
    text-align: right;
    margin-top: 12px;
}

.forgot-link {
    color: #1890ff;
    font-size: 14px;
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* 布局 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.sidebar-header p {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    margin-top: 4px;
}

.sidebar-menu {
    padding: 16px 0;
}

.menu-item {
    display: block;
    padding: 12px 24px;
    color: rgba(255,255,255,0.85);
    transition: all 0.3s;
}

.menu-item:hover,
.menu-item.active {
    background: #1890ff;
    color: #fff;
}

.menu-item i {
    margin-right: 10px;
    width: 16px;
    display: inline-block;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
}

.header {
    background: #fff;
    padding: 16px 24px;
    margin: -24px -24px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 20px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

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

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

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

.stat-card {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
}

.stat-icon.income {
    background: #f6ffed;
    color: #52c41a;
}

.stat-icon.expense {
    background: #fff2f0;
    color: #ff4d4f;
}

.stat-icon.balance {
    background: #e6f7ff;
    color: #1890ff;
}

.stat-info h3 {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.stat-info p {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-top: 4px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.data-table th {
    background: #fafafa;
    font-weight: 500;
    color: #666;
}

.data-table tr:hover {
    background: #f5f5f5;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.tag-income {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.tag-expense {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.tag-pending {
    background: #fff7e6;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.tag-funeral {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #d9d9d9;
}

/* 金额显示 */
.amount {
    font-weight: 600;
}

.amount-income {
    color: #52c41a;
}

.amount-income::before {
    content: '↑ +';
}

.amount-expense {
    color: #ff4d4f;
}

.amount-expense::before {
    content: '↓ -';
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 4px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #666;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    text-align: right;
}

.modal-footer .btn {
    margin-left: 8px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    margin-top: 16px;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1890ff;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background: #40a9ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.back-to-top.visible {
    display: flex;
}

.back-to-top {
    display: flex !important;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .back-to-top {
        bottom: 100px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}
