/* 自定义样式 */
body {
    max-width: 100%;
    overflow-x: hidden;
}

.sortable {
    cursor: pointer;
    position: relative;
}

.sortable:hover {
    background-color: #f3f4f6;
}

.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.5;
}

.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* 可调整列宽 */
.resizable {
    position: relative;
}

.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    user-select: none;
}

.resize-handle:hover, 
.resize-handle.active {
    background-color: #cbd5e0;
}

/* 图片样式 */
.cell-image {
    width: 100%;
    max-width: 150px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: contain;
}

.cell-image:hover {
    transform: scale(1.05);
}

/* 图片列居中样式 */
.image-cell-centered {
    text-align: center;
    padding: 4px !important;
    vertical-align: middle;
}

.image-cell-centered img {
    display: inline-block;
    margin: 0 auto;
}

/* 表格滚动样式 */
#tableWrapper {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
}

/* 长文本单元格样式 */
.cell-text {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.cell-text:hover {
    -webkit-line-clamp: initial; /* 悬停时显示全部内容 */
    white-space: normal;
    word-break: break-word;
}

/* 图片模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* 浮动工具栏样式 */
.delete-btn {
    color: #ef4444;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #fef2f2;
    border: none;
    transition: all 0.2s;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.delete-btn:hover {
    color: #ffffff;
    background-color: #ef4444;
}

/* 操作列单元格样式 */
td:has(.delete-btn) {
    padding: 0 !important;
    position: relative;
    height: 100%;
}

/* 表格行样式，确保行有高度 */
#dataTable tbody tr {
    height: 1px; /* 触发高度计算 */
}

#dataTable tbody td {
    height: inherit;
}

/* 斑马纹样式 - 使用CSS处理以提高性能 */
#dataTable tbody tr:nth-child(odd) {
    background-color: white;
}

#dataTable tbody tr:nth-child(even) {
    background-color: #f9fafb; /* gray-50 */
}

/* 复选框单元格样式 */
.checkbox-cell {
    padding: 0 !important;
    position: relative;
    text-align: center;
    vertical-align: middle;
}

/* 确保sticky列的背景色跟随行背景色 */
#dataTable tbody tr:nth-child(odd) .checkbox-cell,
#dataTable tbody tr:nth-child(odd) .checkbox-cell label {
    background-color: white !important;
}

#dataTable tbody tr:nth-child(even) .checkbox-cell,
#dataTable tbody tr:nth-child(even) .checkbox-cell label {
    background-color: #f9fafb !important;
}

.checkbox-cell label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
    margin: 0;
    transition: background-color 0.2s;
}

.checkbox-cell label:hover {
    background-color: #dbeafe !important;
}

.checkbox-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    pointer-events: none;
}

/* 悬浮操作条样式 */
.floating-action-bar {
    position: fixed;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    z-index: 45;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s, transform 0.3s;
}

.floating-action-bar.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.action-bar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-bar-btn:hover:not(:disabled) {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.action-bar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.action-bar-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.action-bar-btn-danger {
    background-color: #ef4444;
}

.action-bar-btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.action-bar-btn i {
    font-size: 16px;
}

/* 当前定位行的高亮样式 */
.row-focused {
    outline: 3px solid #f59e0b;
    outline-offset: -3px;
    position: relative;
    z-index: 5;
}

.row-focused td {
    background-color: #fef3c7 !important;
}

/* 悬浮横向滚动条样式 */
.floating-scrollbar-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 12px;
    background-color: rgba(229, 231, 235, 0.7);
    border-radius: 6px;
    z-index: 40;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s;
    opacity: 0;
}

.floating-scrollbar-container:hover {
    opacity: 1 !important;
}

.floating-scrollbar-container.active {
    opacity: 0.8;
}

.floating-scrollbar-thumb {
    position: absolute;
    height: 100%;
    background-color: rgba(107, 114, 128, 0.7);
    border-radius: 6px;
    cursor: grab;
    transition: background-color 0.2s;
}

.floating-scrollbar-thumb:hover,
.floating-scrollbar-thumb.dragging {
    background-color: rgba(75, 85, 99, 0.9);
    cursor: grabbing;
}

/* 列显示/隐藏菜单样式 */
.column-toggle-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 250px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 30;
    margin-top: 5px;
}

.column-checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    transition: background-color 0.2s;
}

.column-checkbox-item:hover {
    background-color: #f3f4f6;
}

.column-checkbox-item label {
    margin-left: 8px;
    cursor: pointer;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 隐藏列样式 */
.column-hidden {
    display: none;
}