/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #2c3e50 0%, #1a2530 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 3px 0 10px rgba(0,0,0,0.2);
}

.logo {
    padding: 25px 20px;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar li {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar li a {
    display: block;
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 16px;
    text-align: center; /* 添加居中 */
    justify-content: center; /* 添加居中 */
}

.sidebar li a:hover, 
.sidebar li.active a {
    background: #3498db;
    padding-left: 25px; /* 移除悬停时左侧填充 */
}

/* 主内容区域调整 */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 20px;
    box-sizing: border-box;
}

/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(90deg, #2c3e50 0%, #1a2530 100%);
    color: white;
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn .icon {
    font-size: 16px;
}

.danger {
    background: #e74c3c;
}

.danger:hover {
    background: #c0392b;
}

.calculate-btn {
    background: #2ecc71;
}

.calculate-btn:hover {
    background: #27ae60;
}

.config-btn {
    background: #9b59b6;
}

.config-btn:hover {
    background: #8e44ad;
}

.back-btn {
    background: #3498db;
}

.back-btn:hover {
    background: #2980b9;
}

.export-btn {
    background: #f39c12;
}

.export-btn:hover {
    background: #d35400;
}

.save-btn {
    background: #3498db;
}

.save-btn:hover {
    background: #2980b9;
}

.add-rule-btn {
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    margin-right: 15px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-rule-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.message {
    padding: 15px 25px;
    margin: 0 30px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 配置区域 */
.config-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin: 0 30px 30px;
    border: 1px solid #eaeaea;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.config-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 22px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.config-row label {
    font-weight: 500;
    min-width: 120px;
    color: #2c3e50;
}

.config-row input {
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    width: 150px;
    font-size: 16px;
    transition: border 0.3s;
}

.config-row input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.config-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.config-table th, .config-table td {
    border: 1px solid #e0e6ed;
    padding: 14px;
    text-align: center;
}

.config-table th {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
    font-weight: 600;
}

.config-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.config-table input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

.config-table input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

.config-table button {
    padding: 8px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.config-table button:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* 数据区域 */
.data-section {
    display: flex;
    gap: 30px;
    margin: 0 30px 30px;
    flex-wrap: wrap;
}

.data-column {
    flex: 1;
    min-width: 500px;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.data-column h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #3498db;
}

.data-column textarea {
    width: 100%;
    height: 300px;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    margin-bottom: 15px;
    resize: vertical;
    transition: border 0.3s;
}

.data-column textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 结果区域 */
.results-section {
    margin: 0 30px 30px;
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.results-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 22px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.summary {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(to right, #f8f9fa, #e9f7fe);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e6ed;
    flex-wrap: wrap;
    gap: 15px;
}

.summary-item {
    text-align: center;
    flex: 1;
    min-width: 180px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1 solid #e0e6ed;
}

.summary-item .label {
    display: block;
    font-weight: 500;
    color: #7f8c8d;
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-item .value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
}

.summary-item:nth-child(1) .value {
    color: #27ae60;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 1000px;
}

.results-table th, .results-table td {
    border: 1px solid #e0e6ed;
    padding: 14px;
    text-align: left;
}

.results-table th {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    text-align: center;
}

.results-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.results-table tr:hover {
    background-color: #f1f8ff;
}

.results-table td {
    text-align: center;
}

.positive {
    color: #27ae60;
    font-weight: 600;
    font-size: 16px;
}

.negative {
    color: #e74c3c;
    font-weight: 500;
}

/* 加载指示器 */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 18px;
    font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .data-section {
        flex-direction: column;
    }
    
    .data-column {
        min-width: 100%;
    }
    
    .actions {
        flex-wrap: wrap;
    }
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0;
}

.pagination-link {
    display: inline-block;
    padding: 8px 15px;
    background: #3498db;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
}

.pagination-link:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pagination-link.active {
    background: #2c3e50;
    font-weight: bold;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #e0e6ed;
    margin: 0 15px;
}

.per-page-selector select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 14px;
}

.per-page-selector select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.pagination-info {
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
    min-width: 200px;
    text-align: center;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-controls,
    .per-page-selector,
    .pagination-info {
        width: 100%;
        justify-content: center;
    }
}

/* 规则配置按钮布局 */
.config-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 计算结果头部布局 */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* 搜索表单样式 */
.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-form input {
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    min-width: 250px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-form input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.search-btn {
    background: #2ecc71;
    padding: 10px 15px;
}

.search-btn:hover {
    background: #27ae60;
}

.clear-search-btn {
    background: #e74c3c;
    padding: 10px 15px;
}

.clear-search-btn:hover {
    background: #c0392b;
}

/* 修复表格中正负值样式 */
.positive-difference {
    color: #27ae60;
}

.negative-difference {
    color: #e74c3c;
}

/* 确保操作按钮可见 */
.actions {
    z-index: 10;
    position: relative;
}

/* 移动设备适配 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .data-column {
        min-width: 100%;
    }
}
/* 修改侧边栏所有文本居中 */
.sidebar ul li a,
.logout-btn {
    text-align: center;
    justify-content: center;
}


/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #3498db 0%, #8e44ad 100%);
}

.login-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    text-align: left; /* 整体左对齐 */
}

.login-box h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
    text-align: center; /* 标题居中 */
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    /* 标签左对齐 */
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
    /* 输入框左对齐 */
    text-align: left;
}

.form-group input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 登录按钮居中 */
.login-btn-container {
    display: flex;
    justify-content: center; /* 按钮居中 */
    margin-top: 20px;
}

.login-btn {
    width: 50%; /* 适当宽度 */
    padding: 12px;
    background: #3498db;
    font-size: 16px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #2980b9;
}

/* 侧边栏底部退出按钮 */
.logout-container {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
}

.logout-btn {
    display: block;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 16px;
    border-radius: 6px;
    text-align: center; /* 添加居中 */
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.logout-btn .icon {
    margin-right: 8px;
}

