* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error {
    background-color: #fee;
    color: #c33;
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    border: 1px solid #fcc;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-action {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.btn-action {
    background-color: #28a745;
    color: white;
    padding: 0.5rem 1rem;
}

.btn-action:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

/* 表格页面头部 */
.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 2px solid #e0e0e0;
}

.header h1 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.header-actions .btn-primary,
.header-actions .btn-secondary,
.header-actions .btn-action {
    width: auto;
    padding: 0.5rem 1.2rem;
}

/* 工具栏 */
.toolbar {
    background: white;
    padding: 0.75rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 72px;
    z-index: 199;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-right: 1px solid #e0e0e0;
    align-items: center;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.toolbar-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.color-picker-label {
    position: relative;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
}

.color-picker-label:hover {
    background: #f0f0f0;
    border-color: #999;
}

.color-picker {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-picker-label span {
    pointer-events: none;
    font-size: 14px;
}

/* 表格容器 */
.table-container {
    padding: 0;
    height: calc(100vh - 150px);
    overflow: hidden;
    background: #f5f5f5;
}

.table-wrapper {
    background: white;
    overflow: auto;
    height: 100%;
    position: relative;
}

/* 表格样式 */
#dataTable {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    position: relative;
}

#dataTable th,
#dataTable td {
    border: 1px solid #d0d7de;
    padding: 0;
    position: relative;
    background: white;
}

/* 表头固定 */
#dataTable thead {
    position: sticky;
    top: 0;
    z-index: 120;
    background: white;
}

#dataTable thead th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #24292f;
    border-bottom: 2px solid #d0d7de;
    vertical-align: middle;
}

/* 行号列固定 */
.row-header {
    background-color: #f6f8fa !important;
    font-weight: 600;
    text-align: center;
    width: 60px;
    min-width: 60px;
    position: sticky;
    left: 0;
    z-index: 110;
    border-right: 2px solid #d0d7de;
    user-select: none;
    vertical-align: middle;
    padding: 0.5rem;
}

.corner-cell {
    position: sticky !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 130 !important;
    background-color: #f6f8fa !important;
}

#dataTable thead .row-header {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 125;
    background-color: #f6f8fa !important;
}

.frozen-row .row-header {
    background: #fffbf0 !important;
}

tbody .row-header {
    position: sticky;
    left: 0;
    z-index: 110;
}

.selected-row .row-header {
    background-color: #d0e0ff !important;
    font-weight: bold;
}


.column-header {
    min-width: 120px;
    text-align: center;
    user-select: none;
    position: relative;
    vertical-align: middle;
}

.header-content {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.filter-icon {
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: color 0.2s;
}

.filter-icon:hover {
    color: #667eea;
}

/* 冻结行样式 */
.frozen-row {
    position: sticky;
    z-index: 100;
    background: white;
}

/* 第一个冻结行 */
.frozen-row:first-of-type {
    top: 41px;  /* 表头高度 */
}
/* 多个冻结行支持 */
.frozen-row:nth-of-type(1) {
    top: 41px;
}

.frozen-row:nth-of-type(2) {
    top: 76px;  /* 41 + 35 (假设行高35px) */
}
.frozen-row:nth-of-type(3) {
    top: 111px;  /* 41 + 35*2 */
}
.frozen-row:nth-of-type(4) {
    top: 146px;  /* 41 + 35*3 */
}
.frozen-row:nth-of-type(5) {
    top: 181px;  /* 41 + 35*4 */
}


.frozen-row td {
    background: #fffbf0 !important;
    border-bottom: 2px solid #ffd700 !important;
}


/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    background-color: transparent;
    z-index: 15;
    transition: background-color 0.2s;
}

.column-resize {
    width: 5px;
    height: 100%;
    right: -2px;
    top: 0;
    cursor: col-resize;
}

.column-resize:hover {
    background-color: #667eea;
}

.row-resize {
    width: 100%;
    height: 5px;
    bottom: -2px;
    left: 0;
    cursor: row-resize;
}

.row-resize:hover {
    background-color: #667eea;
}

/* Textarea样式 */
.cell-input {
    width: 100%;
    border: none;
    padding: 0.5rem;
    background: transparent;
    font-size: 13px;
    min-height: 35px;
    font-family: inherit;
    resize: none;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.4;
}

.cell-input:focus {
    outline: 2px solid #667eea;
    background-color: #fff;
    z-index: 10;
}

/* 选中单元格样式 */
td.selected {
    box-shadow: 0 0 0 2px #667eea inset;
    z-index: 9;
}

/* 筛选弹窗 */
.filter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.filter-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.filter-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.filter-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.filter-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.filter-modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.filter-search {
    margin-bottom: 1rem;
}

.filter-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 14px;
}

.filter-search input:focus {
    outline: 2px solid #667eea;
    border-color: #667eea;
}

.filter-options {
    max-height: 300px;
    overflow-y: auto;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.filter-option:hover {
    background: #f6f8fa;
}

.filter-option input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-option span {
    flex: 1;
    font-size: 14px;
}

.filter-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.filter-modal-footer .btn-primary,
.filter-modal-footer .btn-secondary {
    width: auto;
    padding: 0.5rem 1.2rem;
}

/* 右键菜单 */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 0.5rem 0;
}

.context-menu-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.context-menu-item:hover {
    background-color: #f6f8fa;
}

.context-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0.5rem 0;
}

/* 滚动条样式 */
.table-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.table-wrapper::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

.filter-options::-webkit-scrollbar {
    width: 8px;
}

.filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .toolbar {
        padding: 0.5rem 1rem;
        overflow-x: auto;
        top: 120px;
    }

    .table-container {
        height: calc(100vh - 200px);
    }

    .column-header {
        min-width: 100px;
    }

    .filter-modal-content {
        width: 95%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.filter-modal-content {
    animation: fadeIn 0.2s ease;
}

.context-menu {
    animation: fadeIn 0.15s ease;
}

/* 加载状态 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #667eea;
}
/*--------------------------------------------------------------------------------------------*/

/* 在现有CSS基础上添加以下样式 */

/* 批量添加弹窗 */
.batch-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.batch-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
}

.batch-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.batch-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.batch-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.batch-modal-body {
    padding: 1.5rem;
}

.batch-modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.batch-modal-body input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 16px;
}

.batch-modal-body input[type="number"]:focus {
    outline: 2px solid #667eea;
    border-color: #667eea;
}

.batch-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.batch-modal-footer .btn-primary,
.batch-modal-footer .btn-secondary {
    width: auto;
    padding: 0.5rem 1.2rem;
}

/* 选中的单元格 */
.selected-cell {
    box-shadow: 0 0 0 2px #667eea inset !important;
    z-index: 9 !important;
}

/* 选中的行 */
.selected-row {
    background-color: #e8eeff !important;
    font-weight: bold;
}

/* 选中的列 */
.selected-column {
    background-color: #e8eeff !important;
    font-weight: bold;
}

/* 冻结行的行号样式 */
.frozen-row-header {
    position: sticky !important;
    left: 0 !important;
    z-index: 110 !important;
    background: #fffbf0 !important;
    border-bottom: 2px solid #ffd700 !important;
}

/* 选择信息 */
.selection-info {
    font-size: 13px;
    color: #666;
    padding: 0 0.5rem;
}

/* 冻结行在筛选后的样式保持 */
.frozen-row {
    position: sticky;
    top: 41px;
    z-index: 100;
    background: white;
}

.frozen-row td {
    background: #fffbf0 !important;
    border-bottom: 2px solid #ffd700 !important;
}

/* 多行冻结支持 */
.frozen-row:nth-child(2) {
    top: 76px;
}

.frozen-row:nth-child(3) {
    top: 111px;
}

.frozen-row:nth-child(4) {
    top: 146px;
}

.frozen-row:nth-child(5) {
    top: 181px;
}

/* 动画效果 */
.batch-modal-content {
    animation: fadeIn 0.2s ease;
}

/* 右键菜单项图标 */
.context-menu-item span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 工具栏激活状态 */
.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}


/*-----------------------------------------------------------------*/

/* 表格容器 - 确保正确的滚动容器 */
.table-wrapper {
    background: white;
    overflow: auto;
    height: 100%;
    position: relative;
}

/* 表格基础样式 */
#dataTable {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    position: relative;
}

#dataTable th,
#dataTable td {
    border: 1px solid #d0d7de;
    padding: 0;
    position: relative;
    background: white;
}

/* 表头固定 */
#dataTable thead {
    position: sticky;
    top: 0;
    z-index: 120;
    background: white;
}

#dataTable thead th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #24292f;
    border-bottom: 2px solid #d0d7de;
    vertical-align: middle;
    position: sticky;
    top: 0;
}

/* 左上角单元格 - 最高优先级 */
.corner-cell {
    position: sticky !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 150 !important;
    background-color: #f6f8fa !important;
}

/* 表头中的列标题 */
.column-header {
    min-width: 120px;
    text-align: center;
    user-select: none;
    position: sticky;
    top: 0;
    vertical-align: middle;
    z-index: 120;
}

/* 所有行号列 - 基础固定样式 */
.row-header {
    background-color: #f6f8fa !important;
    font-weight: 600;
    text-align: center;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    position: sticky !important;
    left: 0 !important;
    z-index: 110 !important;
    border-right: 2px solid #d0d7de !important;
    user-select: none;
    vertical-align: middle;
    padding: 0.5rem;
}

/* 普通行（tbody中的行） */
#dataTable tbody tr {
    position: relative;
}

/* 普通行的行号 */
#dataTable tbody .row-header {
    position: sticky !important;
    left: 0 !important;
    z-index: 110 !important;
}

/* 冻结行样式 */
#dataTable tbody tr.frozen-row {
    position: sticky !important;
    z-index: 105 !important;
    background: white;
}

/* 冻结行的所有单元格 */
#dataTable tbody tr.frozen-row td {
    background: #fffbf0 !important;
    border-bottom: 2px solid #ffd700 !important;
}

/* 冻结行的行号 - 需要更高的z-index */
#dataTable tbody tr.frozen-row .row-header {
    position: sticky !important;
    left: 0 !important;
    z-index: 115 !important;
    background: #fffbf0 !important;
    border-bottom: 2px solid #ffd700 !important;
    border-right: 2px solid #d0d7de !important;
}

/* 选中的行号样式 */
.selected-row .row-header {
    background-color: #d0e0ff !important;
    font-weight: bold;
}

/* 确保所有td和th都有正确的背景 */
#dataTable td {
    background: white;
}

/* Z-index 层级说明：
 * 150: 左上角单元格
 * 120: 表头
 * 115: 冻结行的行号
 * 110: 普通行号
 * 105: 冻结行内容
 */
