/**
 * 拖拽排序样式
 * 用于卡片视图的拖拽排序功能
 * 原因：外置内联样式，优化首屏加载性能
 * 相关文件：views/stats/card.html
 */

/* 拖拽手柄样式 */
.server-card:hover .drag-handle {
    opacity: 0.5;
}

.server-card.sortable-chosen .drag-handle,
.server-card.sortable-drag .drag-handle {
    opacity: 1 !important;
    cursor: grabbing !important;
}

/* 拖拽禁用时的提示 - 使用伪元素简化 */
.drag-disabled {
    cursor: not-allowed !important;
    position: relative;
}

.drag-disabled:hover::after {
    content: '拖拽已禁用';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* 拖拽动画增强 */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed rgba(99, 102, 241, 0.5);
}

.sortable-drag {
    opacity: 0.9 !important;
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* 拖拽手柄旋转样式 */
.drag-handle i {
    transform: rotate(90deg) !important;
}

.sortable-chosen {
    opacity: 0.8;
}

/* 拖拽时的过渡动画 - 调整为不影响拖拽的属性 */
.server-card {
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* 拖拽时禁用过渡效果，避免抖动 */
.dragging-active .server-card {
    transition: none;
}

/* 拖拽交互反馈样式 */
.server-card.drop-target {
    background-color: rgba(99, 102, 241, 0.1) !important;
    border: 2px solid rgba(99, 102, 241, 0.5) !important;
    /* 移除transform避免抖动 */
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    /* 添加过渡效果使变化更平滑 */
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.server-card.dragging-item {
    opacity: 0.9;
    transform: scale(1.02);
    z-index: 1000;
    /* 防止拖拽时的过渡效果 */
    transition: none !important;
}

/* 交换动画 */
.server-card.swap-animation {
    animation: swapPulse 0.3s ease-in-out;
}

@keyframes swapPulse {
    0% {
        background-color: transparent;
        opacity: 1;
    }
    50% {
        background-color: rgba(99, 102, 241, 0.15);
        opacity: 0.9;
    }
    100% {
        background-color: transparent;
        opacity: 1;
    }
}

/* 拖拽时的指针 */
.dragging-active .server-card {
    cursor: grab;
}

.dragging-active .server-card.sortable-drag {
    cursor: grabbing !important;
}

/* 拖拽预览位置指示器 */
.sortable-swap-highlight {
    background-color: rgba(99, 102, 241, 0.2) !important;
    border: 2px dashed rgba(99, 102, 241, 0.6) !important;
}

