/* Перетаскивание карточек канбана (public/js/screens/kanban-drag.js) — как в Битрикс24 на десктопе. */

@media (min-width: 1024px) {
  @media (hover: hover) and (pointer: fine) {
    .dl-board [data-cards] > [data-id] { cursor: grab; }
  }
  body.dl-dragging, body.dl-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

  /* Карточка в руке: приподнята, наклонена, с тенью; чуть просвечивает, как в Битриксе */
  .dl-kfloat {
    position: fixed;
    z-index: 70;
    margin: 0 !important;
    pointer-events: none;
    will-change: translate;
    box-shadow: var(--shadow-card);
    transition: rotate 150ms var(--ease-out), box-shadow 150ms var(--ease-out), opacity 150ms var(--ease-out), scale 150ms var(--ease-out);
  }
  .dl-kfloat.lifted { rotate: 3deg; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.12); }
  /* Фон карточки плотный (сквозь неё не просвечивает доска), а содержимое приглушено — как в Битриксе */
  .dl-kfloat > * { transition: opacity 150ms var(--ease-out); }
  .dl-kfloat.lifted > * { opacity: 0.72; }
  .dl-kfloat.settling { transition-property: translate, rotate, box-shadow, opacity; transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
  .dl-kfloat.dropping { transition: opacity 120ms ease-out, scale 120ms ease-out; opacity: 0; scale: 0.9; }

  /* След на старом месте */
  .dl-kcard.dragging { opacity: 0.38; box-shadow: none; }

  /* Серое место, куда встанет карточка; раскрывается плавно — соседние карточки раздвигаются */
  .dl-kslot {
    height: var(--h);
    margin-bottom: 8px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent);
    animation: dl-slot-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  /* Полоса завершающих стадий внизу, как в Битриксе: сплошные цветные сегменты во всю ширину */
  .dl-dropbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    display: flex;
    gap: 0;
    height: 64px;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    animation: dl-bar-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .dl-drop {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    background: var(--c);
    color: var(--on, #fff);
    font-weight: 500;
    font-size: 15px;
    box-shadow: none;
    transition: filter 120ms, box-shadow 120ms;
  }
  .dl-drop + .dl-drop { border-left: 1px solid rgba(255, 255, 255, 0.18); }
  .dl-drop.over { filter: brightness(1.12) saturate(1.1); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6); transform: none; }
  .dl-drop.del { --c: #8a929c; }
}

@keyframes dl-slot-in { from { height: 0; margin-bottom: 0; opacity: 0; } }
@keyframes dl-bar-up { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .dl-kfloat, .dl-kslot, .dl-dropbar { transition: none !important; animation: none !important; }
}
