/**
 * 排序题样式
 *
 * 轻量列表风格，两阶段交互：
 * - 点击排序（主要交互）
 * - 拖拽微调（辅助交互）
 */

/* ==================== 提示文本 ==================== */
.ranking-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 13px;
    color: #0369a1;
}

.ranking-hint-icon {
    font-size: 16px;
}

/* ==================== 排序列表容器 ==================== */
.ranking-sortable-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

/* ==================== 排序项基础样式 ==================== */
.sortable-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 悬停效果 */
.sortable-item:hover {
    background-color: #f9fafb;
}

/* 已排序项高亮 */
.sortable-item.ranked {
    background-color: #eef2ff;
    border-color: #6366f1;
}

/* ==================== 序号样式 ==================== */
.rank-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #9ca3af;
    background: #f3f4f6;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* 已排序项的序号 - Indigo 高亮 */
.rank-number.ranked {
    background: #4f46e5;
    color: white;
}

/* ==================== 选项文本 ==================== */
.option-text {
    flex: 1;
    font-size: 15px;
    color: #6b7280;
    line-height: 1.5;
    transition: color 0.2s ease;
}

/* 已排序项的文本恢复主色 */
.sortable-item.ranked .option-text {
    color: #111827;
    font-weight: 500;
}

/* ==================== 拖拽手柄 ==================== */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: transparent;
    font-size: 16px;
    cursor: default;
    flex-shrink: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

/* 仅已排序项显示拖拽手柄 */
.drag-handle.visible {
    color: #9ca3af;
    cursor: grab;
    pointer-events: auto;
}

.drag-handle.visible:active {
    cursor: grabbing;
}

.sortable-item:hover .drag-handle.visible {
    color: #6366f1;
}

/* ==================== 点击反馈动画 ==================== */
.sortable-item.click-feedback {
    background-color: #eef2ff;
}

/* ==================== 拖拽状态样式 ==================== */
.sortable-ghost {
    opacity: 0.4;
    background: #eef2ff !important;
    border: 2px dashed #818cf8 !important;
}

.sortable-ghost .rank-number {
    opacity: 0.5;
}

.sortable-chosen {
    background: #eef2ff !important;
    transform: scale(1.01);
}

.sortable-drag {
    opacity: 1 !important;
    cursor: grabbing !important;
    transform: rotate(1deg) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.sortable-fallback {
    opacity: 0.9;
    background: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    border-radius: 8px;
}

/* 拖拽时的全局样式 */
body.is-dragging {
    cursor: grabbing !important;
}

body.is-dragging * {
    cursor: grabbing !important;
}

/* ==================== 移动端优化 ==================== */
@media (max-width: 768px) {
    .ranking-sortable-list {
        gap: 8px;
    }

    .sortable-item {
        padding: 16px 14px;
        min-height: 56px;
    }

    .rank-number {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 14px;
    }

    .drag-handle.visible {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    .option-text {
        font-size: 16px;
    }

    .sortable-drag {
        transform: rotate(2deg) scale(1.04);
    }
}

/* ==================== 平板优化 ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .sortable-item {
        padding: 14px 16px;
    }
}

/* ==================== 无障碍优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    .sortable-item,
    .rank-number,
    .drag-handle {
        transition: none !important;
    }

    .sortable-item.click-feedback {
        background-color: transparent;
    }

    .sortable-drag {
        transform: none !important;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .drag-handle {
        display: none !important;
    }

    .sortable-item {
        cursor: default;
    }
}
