/* 统一的样式文件 */

/* 全局样式 */



/* 无数据消息样式 */
.no-data-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: var(--medium-gray);
    text-align: center;
    display: none;
}
:root {
    --primary-color: #4f46e5; /* 主色调 - 靛蓝色 */
    --secondary-color: #06b6d4; /* 次要色调 - 青色 */
    --success-color: #ef4444; /* 成功色 - 红色 */
    --danger-color: #10b981; /* 危险色 - 绿色 */
    --warning-color: #f59e0b; /* 警告色 - 橙色 */
    --light-gray: #f3f4f6; /* 浅灰色 */
    --medium-gray: #9ca3af; /* 中灰色 */
    --dark-gray: #374151; /* 深灰色 */
    --white: #ffffff; /* 白色 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #e9ecef 100%);
    color: var(--dark-gray);
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 左侧导航栏样式 */
.sidebar {
    width: 250px;
    background-color: var(--white);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-content {
    width: 100%;
    padding-right: 10px;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-brand i {
    font-size: 1.75rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 0.5rem;
}

.sidebar-nav-link {
    font-weight: 500;
    color: var(--dark-gray);
    position: relative;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.05);
}

.sidebar-nav-link.active {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.05);
}

.sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

/* 主内容区域样式 */
.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.toggle-sidebar {
    position: fixed;
    top: 50%;
    left: 250px;
    transform: translateY(-50%);
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 5px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed ~ .toggle-sidebar {
    left: 0;
    transform: translateY(-50%) rotate(180deg);
}

.toggle-sidebar:hover {
    background-color: #4338ca;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.15);
}

/* 导航栏样式（兼容旧代码） */
.navbar {
    display: none;
}

/* 卡片样式 */
.card {
    background-color: var(--white);
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    border-top-left-radius: var(--border-radius-lg) !important;
    border-top-right-radius: var(--border-radius-lg) !important;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* 按钮样式 */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-md);
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #0891b2);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--medium-gray);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #6b7280;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.form-control.is-valid {
    border-color: var(--success-color);
    background-image: none;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: none;
}

/* 统计卡片样式 */
.stats-card {
    background: linear-gradient(135deg, var(--white), #f8fafc);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid #e5e7eb;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stats-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-label {
    font-size: 1rem;
    color: var(--medium-gray);
    font-weight: 500;
}

/* 收入/支出样式 */
.income-amount {
    color: var(--success-color);
    font-weight: 700;
}

.expense-amount {
    color: var(--danger-color);
    font-weight: 700;
}

/* 预算详情样式 */
.budget-details {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
}

.budget-details h4 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.5rem;
}

.budget-details h5 {
    color: var(--dark-gray);
    margin: 1.5rem 0 1rem;
    font-weight: 600;
    font-size: 1.25rem;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.table th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-align: left;
}

.table td {
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table-responsive {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

/* 任务行文字颜色样式 */
.table tbody tr.task-row-expired td {
    color: #dc2626 !important; /* 红色文本 */
    font-weight: bold !important; /* 加粗文本 */
}

.table tbody tr.task-row-due-soon td {
    color: #ea580c !important; /* 橙色文本 */
    font-weight: bold !important; /* 加粗文本 */
}

/* 图表样式 */
.chart-container {
    position: relative;
    height: auto;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

/* 模块卡片样式 */
.module-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.module-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* 饼图容器 */
.chart-wrapper {
    width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    overflow: hidden !important;
    position: relative !important;
}

/* 移除饼图canvas的固定尺寸限制，让它们自适应容器大小 */
#incomeChart, #expenseChart, #actualIncomeChart, #actualExpenseChart {
    display: block !important;
}

/* 确保饼图容器内部元素尺寸一致 */
.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* 登录/注册页面样式 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.auth-card {
    background-color: var(--white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    max-width: 450px;
    width: 100%;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-gray);
    text-align: center;
    margin-bottom: 2rem;
}

/* 提醒样式 */
.alert {
    border-radius: var(--border-radius-md);
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    /* 侧边栏优化 */
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .toggle-sidebar {
        left: auto;
        right: 1rem;
        top: 1rem;
        transform: none;
    }
    
    .sidebar.open ~ .toggle-sidebar {
        transform: rotate(180deg);
    }
    
    /* 表格响应式优化 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    /* 卡片样式优化 */
    .card-body {
        padding: 1rem;
    }
    
    /* 统计卡片优化 */
    .stats-value {
        font-size: 1.5rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    /* 登录/注册页面优化 */
    .auth-card {
        padding: 1.5rem;
    }
    
    .auth-title {
        font-size: 1.75rem;
    }
    
    /* 按钮优化 */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* 表单优化 */
    .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
    }
    
    /* 黄金价格悬浮窗优化 */
    .gold-price-widget {
        width: calc(100% - 40px);
        max-width: 300px;
        bottom: 80px;
        right: 20px;
    }
    
    .toggle-gold-widget-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
    
    /* 预算详情优化 */
    .budget-details {
        padding: 1rem;
    }
    
    /* 模块卡片优化 */
    .module-card {
        padding: 1rem;
    }
    
    /* 图表容器优化 */
    .chart-container {
        padding: 0.5rem;
    }
}

/* 小屏幕设备优化 (max-width: 480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .sidebar-brand {
        font-size: 1.25rem;
        padding: 0 1rem 1rem;
    }
    
    .sidebar-nav-link {
        padding: 0.6rem 1rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-value {
        font-size: 1.25rem;
    }
    
    .stats-label {
        font-size: 0.9rem;
    }
    
    .gold-price-widget {
        width: calc(100% - 20px);
        max-width: none;
        right: 10px;
        left: 10px;
        bottom: 70px;
    }
    
    .toggle-gold-widget-btn {
        right: 10px;
        bottom: 10px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 工具类 */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 70, 229, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 黄金价格悬浮窗样式 */
.gold-price-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-family: 'Arial', sans-serif;
    transition: all 0.3s ease;
}

.gold-price-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    border-radius: 10px 10px 0 0;
}

.gold-price-header i {
    font-size: 18px;
    margin-right: 8px;
    color: #333;
}

.gold-price-header span {
    font-weight: bold;
    font-size: 16px;
}

.close-widget {
    background: none;
    border: none;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-widget:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.gold-price-content {
    padding: 20px;
    text-align: center;
}

.gold-price-value {
    font-size: 28px;
    font-weight: bold;
    color: #e6b800;
    margin-bottom: 8px;
}

.gold-price-time {
    font-size: 12px;
    color: #888;
}

.gold-price-footer {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 0 0 10px 10px;
    text-align: center;
    border-top: 1px solid #eee;
}

.view-details {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.view-details:hover {
    color: #0056b3;
    text-decoration: underline;
}

.toggle-gold-widget-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-gold-widget-btn:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

/* 页面特定的样式可以通过覆盖或添加新样式来实现 */