/**
 * 表格列宽修复
 * 强制设置各列宽度，确保内容列不会过大挤压其他字段
 */

/* 强制设置表格布局为固定布局 */
.data-table {
    table-layout: fixed !important;
    width: 100% !important;
    background-color: #ffffff !important;
    /* 强制移除表格圆角 */
    border-radius: 0 !important;
}

/* 表格行和单元格白色背景 */
.data-table tbody tr {
    background-color: #ffffff !important;
}

/* 确保表体单元格有与表头一致的行高 */
.data-table tbody td {
    background-color: #ffffff !important;
    border-right: 1px solid #dee2e6 !important;
    padding: 6px 8px !important; /* 与余额列表表内容行高一致 */
    vertical-align: middle !important;
    height: 32px !important; /* 固定表体行高 */
    line-height: 1.2 !important;
    font-size: 0.875rem !important;
}

/* 最后一列不需要右边框 */
.data-table tbody td:last-child {
    border-right: none !important;
}

/* 表头列分割线 */
.data-table thead th {
    border-right: 1px solid #dee2e6 !important;
    background-color: #f8f9fa !important;
}

/* 表头最后一列不需要右边框 */
.data-table thead th:last-child {
    border-right: none !important;
}

/* 强制设置各列宽度 - 与app.js中的colgroup保持一致 */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 0.35rem 0.3rem !important;
}

/* 表头多选框特殊样式 - 确保完全居中 */
.data-table th:nth-child(1) {
    display: table-cell !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.data-table th:nth-child(1) input[type="checkbox"] {
    margin: 0 auto !important;
    display: inline-block !important;
    vertical-align: middle !important;
    transform: scale(1.1) !important;
}

/* 多选框特殊样式 - 确保完全居中 */
.data-table td:nth-child(1) {
    display: table-cell !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.data-table td:nth-child(1) input[type="checkbox"] {
    margin: 0 auto !important;
    display: inline-block !important;
    vertical-align: middle !important;
    transform: scale(1.1) !important;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
}

/* 内容列 - 减小宽度到230px */
.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
}

.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.data-table th:nth-child(10),
.data-table td:nth-child(10) {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

.data-table th:nth-child(11),
.data-table td:nth-child(11) {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

/* 确保colgroup的列定义也被强制应用 */
.data-table colgroup col:nth-child(1) { width: 35px !important; }
.data-table colgroup col:nth-child(2) { width: 35px !important; }
.data-table colgroup col:nth-child(3) { width: 35px !important; }
.data-table colgroup col:nth-child(4) { width: 110px !important; }
.data-table colgroup col:nth-child(5) { width: 70px !important; }
.data-table colgroup col:nth-child(6) { width: 80px !important; }
.data-table colgroup col:nth-child(7) { width: 80px !important; }
.data-table colgroup col:nth-child(8) { width: 230px !important; }
.data-table colgroup col:nth-child(9) { width: 100px !important; }
.data-table colgroup col:nth-child(10) { width: 140px !important; }
.data-table colgroup col:nth-child(11) { width: 140px !important; }

/* 表格总宽度控制 - 宽度保持不变 */
.data-table {
    width: 100% !important;
    min-width: 1135px !important; /* 所有列宽度的总和：35+35+35+110+70+80+80+230+100+140+140 */
}

/* 表格容器允许水平滚动 */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 200px) !important; /* 设置最大高度，为页面其他元素留出空间 */
    border: 1px solid #dee2e6 !important;
    border-radius: 0 !important; /* 改为直角，确保边框角完整显示 */
}

/* 确保表格在小屏幕上可以滚动查看 */
@media (max-width: 992px) {
    .data-table {
        min-width: 1145px !important;
    }
}

/* 强制多选框完全居中 - 使用更自然的居中方案 */
.data-table th:first-child,
.data-table td:first-child {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
    padding: 0.35rem 0.3rem !important;
    text-align: center !important;
    vertical-align: middle !important;
    position: relative !important;
}

.data-table th:first-child .form-check-input,
.data-table td:first-child .form-check-input,
.data-table th:first-child input[type="checkbox"],
.data-table td:first-child input[type="checkbox"] {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(1.1) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 固定表头样式 */
.data-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background-color: #f8f9fa !important;
    /* 强制移除表头圆角 */
    border-radius: 0 !important;
}

/* 确保表头单元格有正确的背景色，防止内容透过 */
.data-table thead th {
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    border-right: 1px solid #dee2e6 !important;
    position: relative !important;
    z-index: 11 !important;
    padding: 6px 8px !important; /* 与余额列表表内容行高一致 */
    vertical-align: middle !important;
    height: 32px !important; /* 固定表头行高 */
    line-height: 1.2 !important;
    font-size: 0.875rem !important;
    /* 强制移除表头单元格圆角 */
    border-radius: 0 !important;
}

/* 强制移除表头第一个和最后一个单元格的圆角 */
.data-table thead th:first-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.data-table thead th:last-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* 内容列宽度设置 - 减小宽度 */
.data-table th.content-column,
.data-table td.content-column {
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
    text-align: left !important;
    padding-left: 8px !important;
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* 账户列宽度设置 - 扩大宽度 */
.data-table th.account-column,
.data-table td.account-column {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
} 