/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimSun', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    gap: 30px;
}

/* 区域样式 */
section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1e5f8e);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7a7b);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn-remove:hover {
    background: #c0392b;
}

.btn-icon {
    font-size: 1.2rem;
}

/* 区域标题 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 规则选择区域 */
.rule-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rule-selector label {
    font-weight: 500;
    color: #2c3e50;
}

.rule-select {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

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

.rule-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.rule-description h4 {
    color: #2c3e50;
    margin-bottom: 8px;
}

/* 文件上传区域 */
.upload-area {
    border: 3px dashed #3498db;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    background: #e3f2fd;
    border-color: #2980b9;
}

.upload-area.dragover {
    background: #e3f2fd;
    border-color: #2980b9;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #3498db;
}

.upload-text {
    font-size: 1.3rem;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 10px;
}

.upload-hint {
    color: #7f8c8d;
    font-size: 1rem;
}

/* 预览区域 */
.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-info {
    color: #27ae60;
    font-weight: 500;
}

.preview-container {
    margin-top: 20px;
}

.preview-converted {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.preview-converted h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* 表格样式 */
.table-container {
    max-height: 500px;
    overflow: auto;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.table-container table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-container th {
    background: #3498db;
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-container th.row-number-header {
    background: #2c3e50;
    min-width: 60px;
    width: 60px;
}

.table-container td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    text-align: center;
    min-width: 80px;
    white-space: nowrap;
}

.table-container td.row-number {
    background: #ecf0f1;
    font-weight: 600;
    color: #2c3e50;
    min-width: 60px;
    width: 60px;
}

.table-container tr:nth-child(even) {
    background: #f8f9fa;
}

.table-container tr:hover {
    background: #e3f2fd;
}

/* 分页控制样式 */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid #ddd;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #2c3e50;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-size select {
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-jump input {
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

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

/* 响应式分页 */
@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .pagination-buttons {
        justify-content: center;
    }

    .pagination-size,
    .pagination-jump {
        justify-content: center;
    }
}

/* 导出区域 */
.export-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.export-info {
    color: #27ae60;
    font-weight: 500;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #3498db;
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* 标签页样式 */
.rule-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #7f8c8d;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-btn:hover {
    color: #2c3e50;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 规则列表样式 */
.rule-list-header {
    margin-bottom: 20px;
}

.rule-list {
    display: grid;
    gap: 15px;
}

.rule-item {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.rule-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
}

.rule-info h4 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.rule-info p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.rule-actions {
    display: flex;
    gap: 10px;
}

/* 表单样式 */
.rule-form {
    display: grid;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

/* 简化列配置样式 */
.simple-column-configs {
    display: grid;
    gap: 15px;
}

.simple-config-row {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
}

.simple-config-fields {
    display: grid;
    gap: 15px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: start;
}

.field-row.source-type-row {
    grid-template-columns: 1fr 1fr 1fr;
}

.field-row.source-value-row {
    grid-template-columns: 1fr 1fr;
}

/* 源类型相关的样式 */
.source-column-group {
    transition: all 0.3s ease;
}

.fixed-value-group {
    transition: all 0.3s ease;
}

.source-type-simple {
    min-width: 120px;
}

.fixed-value-simple {
    min-width: 200px;
}

.config-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.config-row-header h4 {
    color: #2c3e50;
    margin: 0;
    font-size: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-group label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.field-group input,
.field-group select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.field-group input:focus,
.field-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.field-group small {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 2px;
}

.config-help {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
}

.config-help h5 {
    color: #1976d2;
    margin: 0 0 10px 0;
    font-size: 0.95rem;
}

.config-help ul {
    margin: 0;
    padding-left: 20px;
}

.config-help li {
    color: #424242;
    font-size: 0.85rem;
    margin-bottom: 5px;
    line-height: 1.4;
}

.config-help strong {
    color: #1976d2;
}

/* 兼容旧版本的列配置样式 */
.column-configs {
    display: grid;
    gap: 20px;
}

.column-config-row {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.config-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* 样式配置区域 */
.style-config {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.style-section {
    margin-bottom: 20px;
}

.style-section:last-child {
    margin-bottom: 0;
}

.style-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* 日期列样式（兼容旧版本） */
.date-columns {
    display: grid;
    gap: 10px;
}

.date-column-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.date-column-row select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 导入导出样式 */
/* 统一导入/导出/保存按钮的核心样式 */
.import-export-section .btn {
    /* 强制统一尺寸 */
    width: 100%;               /* 宽度撑满父容器（依赖父容器宽度一致） */
    height: 40px;              /* 固定高度（关键！） */
    padding: 0;                /* 清除Bootstrap默认padding */
    font-size: 14px;           /* 统一字体大小 */
    font-weight: 500;          /* 中等字重（比bold柔和） */
    border-radius: 6px;        /* 统一大圆角（更现代） */
    cursor: pointer;
    transition: all 0.2s ease; /* 更丝滑的过渡效果 */
    display: flex;             /* 用flex对齐图标和文字 */
    align-items: center;
    justify-content: center;
    gap: 8px;                  /* 图标和文字间距 */
}

/* 统一按钮背景色（中性色，降低颜色冲突） */
.import-export-section .btn {
    background-color: #f0f2f5;  /* 浅灰色背景（统一底色） */
    color: #495057;             /* 深灰色文字（易读） */
    border: 1px solid #dee2e6;  /* 浅边框（增加层次感） */
}

/* 区分功能：仅用图标颜色或微小背景变化（可选） */
/* 导入/导出按钮：蓝色图标 */
.import-export-section .btn-import-export {
    color: #007bff;             /* 蓝色文字/图标（替代背景色区分） */
}

/* 保存按钮：绿色图标 */
.import-export-section .btn-save {
    color: #28a745;             /* 绿色文字/图标（替代背景色区分） */
}

/* 统一悬停效果（所有按钮反馈一致） */
.import-export-section .btn:hover {
    background-color: #e9ecef;  /* 浅灰色加深（统一hover） */
    border-color: #ced4da;      /* 边框颜色加深 */
}

/* 可选：激活状态（点击反馈） */
.import-export-section .btn:active {
    background-color: #dee2e6;  /* 更深的灰色（点击感） */
}
/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
    min-width: 300px;
    border-left: 4px solid #27ae60;
}

.message.error {
    border-left-color: #e74c3c;
}

.message.warning {
    border-left-color: #f39c12;
}

.message-text {
    flex: 1;
    color: #2c3e50;
}

.message-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    line-height: 1;
}

.message-close:hover {
    color: #2c3e50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .preview-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-body {
        padding: 20px;
    }

    .import-export-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .mapping-row,
    .date-column-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

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

    .export-controls {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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