/* CSS for SortableJS drag & drop functionality */

/* Make table headers have normal cursor by default */
.alpaga-table thead th {
    user-select: none;
    position: relative;
    cursor: default;
}

/* Add dedicated drag handle */
.alpaga-table thead th .drag-handle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 16px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.alpaga-table thead th .drag-handle:hover {
    opacity: 1;
    color: #666;
}

.alpaga-table thead th .drag-handle::before {
    content: "⋮⋮";
    line-height: 1;
}

/* Visual feedback during drag */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f0f0f0;
}

.sortable-chosen {
    background-color: #e3f2fd;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sortable-drag {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: rotate(2deg);
    z-index: 1000;
}

/* Add a subtle drag handle indicator */
.alpaga-table thead th:hover {
    background-color: #f5f5f5;
    transition: background-color 0.2s ease;
}

/* Ensure the sort links still work */
.alpaga-table thead th a.alpaga-sort-link {
    pointer-events: auto;
    display: block;
    width: calc(100% - 16px); /* Leave space for drag handle */
    height: 100%;
    text-decoration: none;
    color: inherit;
    padding-right: 16px; /* Ensure text doesn't overlap drag handle */
    box-sizing: border-box;
}

.alpaga-table thead th a.alpaga-sort-link:hover {
    text-decoration: underline;
}

/* Prevent text selection during drag */
.alpaga-table thead th.sortable-chosen * {
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .alpaga-table thead th .drag-handle {
        display: none;
    }
}
