/* 记账系统样式 - 简洁紧凑风格 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部样式 */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #2196F3;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: color 0.3s;
}

.nav a:hover {
    color: #2196F3;
}

/* 主要内容区域 */
.main {
    min-height: calc(100vh - 120px);
    padding: 15px 0;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* 金额和日期输入框样式 */
.form-row .form-group {
    margin-bottom: 0; /* 在flex容器中移除底部边距 */
}

.form-row .form-group input[name="amount"],
.form-row .form-group input[name="record_date"] {
    width: 100%;
    max-width: 200px; /* 限制最大宽度 */
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
    color: #555;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.3s;
}

/* 金额和日期输入框的特殊样式 */
.form-row .form-group input[name="amount"],
.form-row .form-group input[name="record_date"] {
    padding-right: 4px; /* 进一步减少右内边距 */
    padding-left: 4px; /* 进一步减少左内边距 */
}

.form-row .form-group input[name="amount"] {
    width: 100%;
    max-width: 90px; /* 金额输入框再缩小一点 */
}

.form-row .form-group input[name="record_date"] {
    width: 100%;
    max-width: 180px; /* 日期输入框也相应缩小 */
}

.form-row .form-group:first-child {
    margin-right: 0; /* 确保金额框没有右边距 */
}

.form-row .form-group:last-child {
    margin-left: 0; /* 确保日期框没有左边距 */
}

.form-control:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33,150,243,0.1);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #388E3C;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-large {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: bold;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th,
.table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    background: #f5f5f5;
    font-weight: normal;
    color: #666;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

/* 记账页面样式 */
.accounting-section {
    background: #fff;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

/* 用户后台标签页样式 */
.type-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.type-tabs a {
    display: block;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: all 0.3s;
}

.type-tabs a:hover {
    color: #2196F3;
    background: #f5f5f5;
}

.type-tabs a.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.type-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.type-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
}

.type-tab.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.type-tab.income-tab.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

.accounting-form {
    /* 移除flex布局，让表单元素正常排列 */
}

.form-row {
    display: block;
    white-space: nowrap;
}

/* 移除表单组的默认样式 */
.form-row .form-group {
    display: inline-block !important;
    vertical-align: bottom !important;
    margin: 0 !important;
    padding: 0 !important;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-row .form-group:first-child {
    flex: 0.5; /* 金额容器缩小 */
}

.form-row .form-group:last-child {
    flex: 1;
}

.form-row .form-group input[name="amount"] {
    width: 100%;
    max-width: 100px; /* 金额输入框宽度缩小一半 */
}

.form-row .form-group input[name="record_date"] {
    width: 100%;
    max-width: 200px;
}

.quick-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.quick-cat-btn {
    padding: 4px 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

/* 支出模式下的快捷按钮 */
.expense-mode .quick-cat-btn {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.expense-mode .quick-cat-btn:hover {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

/* 收益模式下的快捷按钮 */
.income-mode .quick-cat-btn {
    background: #f1f8e9;
    border-color: #4CAF50;
    color: #2e7d32;
}

.income-mode .quick-cat-btn:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* 商业记账样式 */
.business-section {
    background: #f3e5f5;
}

.business-section .type-tab.active {
    color: #9C27B0;
    border-bottom-color: #9C27B0;
}

/* 记录列表样式 */
.records-list {
    margin-top: 15px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.record-item:last-child {
    border-bottom: none;
}

.record-info {
    flex: 1;
}

.record-category-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.record-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    white-space: nowrap;
}

.record-type-badge.expense {
    background: #f44336;
    color: white;
}

.record-type-badge.income {
    background: #4CAF50;
    color: white;
}

/* 支出/收益标签页颜色与记录一致 */
.type-tab.active {
    color: #f44336 !important;
    border-bottom-color: #f44336 !important;
}

.type-tab.income-tab.active {
    color: #4CAF50 !important;
    border-bottom-color: #4CAF50 !important;
}

/* 统一支出相关的颜色 */
.expense-mode .form-control {
    border-color: #ffcdd2;
}

.expense-mode .form-control:focus {
    border-color: #f44336;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.1);
}

.expense-mode .btn-primary {
    background: #f44336;
    border-color: #f44336;
}

.expense-mode .btn-primary:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

/* 统一收益相关的颜色 */
.income-mode .form-control {
    border-color: #c8e6c9;
}

.income-mode .form-control:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.income-mode .btn-success {
    background: #4CAF50;
    border-color: #4CAF50;
}

.income-mode .btn-success:hover {
    background: #388E3C;
    border-color: #388E3C;
}

/* 为表单区域添加模式类 */

.record-category {
    font-weight: normal;
    color: #666;
}

.record-category.expense {
    color: #f44336;
    font-weight: bold;
}

.record-category.income {
    color: #4CAF50;
    font-weight: bold;
}

.record-date {
    color: #999;
    font-size: 12px;
}

.record-remark {
    color: #666;
    font-size: 12px;
    margin-top: 3px;
    font-style: italic;
}

.record-amount {
    font-weight: bold;
}

.record-amount.expense {
    color: #f44336;
}

.record-amount.income {
    color: #4CAF50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .accounting-form {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
        width: 100%;
    }
    
    .form-control {
        width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 0;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .card {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .record-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .record-amount {
        align-self: flex-end;
    }
}

/* 统计页面样式 */
.stats-filters {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.stats-summary {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.stats-summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.stats-summary-item:last-child {
    border-bottom: none;
    font-weight: bold;
    color: #2196F3;
}

.stats-details {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
}

/* 页脚样式 */
.footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 15px 0;
    font-size: 12px;
}

.footer a {
    color: #2196F3;
    text-decoration: none;
}

/* 登录注册页面 */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-title {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 24px;
}

/* 后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 200px;
    background: #333;
    color: white;
    padding: 20px 0;
}

.admin-menu {
    list-style: none;
}

.admin-menu li {
    border-bottom: 1px solid #444;
}

.admin-menu a {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: #555;
}

.admin-content {
    flex: 1;
    padding: 20px;
    background: #f5f5f5;
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
    }
    
    .admin-content {
        padding: 10px;
    }
}