/* ============================================================
   iPlan — 칸반 보드 스타일 (Phase 3)
   드래그앤드롭 보드, 컬럼, 카드 스타일
   ============================================================ */

/* ── 칸반 보드 컨테이너 ── */
.ip-kanban-board {
  display: flex;
  gap: var(--s-4);
  padding: var(--s-4);
  overflow-x: auto;
  overflow-y: hidden;
  height: calc(100vh - var(--ip-topbar-h) - var(--ip-quickadd-h) - var(--s-7));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.ip-kanban-board::-webkit-scrollbar {
  height: 6px;
}

.ip-kanban-board::-webkit-scrollbar-track {
  background: transparent;
}

.ip-kanban-board::-webkit-scrollbar-thumb {
  background: var(--surface-w3);
  border-radius: var(--radius-full);
}

/* ── 칸반 컬럼 ── */
.ip-kanban-col {
  flex: 0 0 var(--ip-kanban-col-w);
  min-width: var(--ip-kanban-col-min-w);
  max-width: var(--ip-kanban-col-max-w);
  background: var(--bg-raised);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.ip-kanban-col.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-dim);
}

/* ── 컬럼 헤더 ── */
.ip-kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-subtle);
  gap: var(--s-2);
  flex-shrink: 0;
}

.ip-kanban-col-header-left {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.ip-kanban-col-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ip-kanban-col-count {
  font-size: var(--text-xs);
  color: var(--text-faint);
  background: var(--surface-w2);
  padding: var(--s-0) var(--s-2);
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ip-kanban-col-actions {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-shrink: 0;
}

.ip-kanban-col-actions button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: var(--s-1);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration-fast), background var(--duration-fast);
}

.ip-kanban-col-actions button:hover {
  color: var(--text-main);
  background: var(--surface-hover);
}

/* ── 카드 리스트 (스크롤 가능) ── */
.ip-kanban-cards {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-height: 60px;
}

.ip-kanban-cards::-webkit-scrollbar {
  width: 4px;
}

.ip-kanban-cards::-webkit-scrollbar-thumb {
  background: var(--surface-w3);
  border-radius: var(--radius-full);
}

/* 빈 컬럼 드롭 영역 */
.ip-kanban-cards-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  border: 1px dashed var(--line-subtle);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  font-size: var(--text-xs);
}

/* ── 칸반 카드 ── */
.ip-kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: var(--s-3);
  cursor: grab;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast), border-color var(--duration-fast);
  user-select: none;
  position: relative;
}

.ip-kanban-card:hover {
  border-color: var(--surface-w4);
  box-shadow: var(--shadow-sm);
}

.ip-kanban-card:active {
  cursor: grabbing;
}

.ip-kanban-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.ip-kanban-card.drag-ghost {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

/* 카드 제목 */
.ip-kanban-card-title {
  font-size: var(--text-sm);
  color: var(--text-main);
  line-height: var(--leading-normal);
  word-break: break-word;
}

.ip-kanban-card.done .ip-kanban-card-title {
  text-decoration: line-through;
  color: var(--text-faint);
}

/* 카드 체크박스 */
.ip-kanban-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}

.ip-kanban-card-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-faint);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all var(--duration-fast);
}

.ip-kanban-card-check:hover {
  border-color: var(--accent);
}

.ip-kanban-card-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.ip-kanban-card-check.checked::after {
  content: '';
  width: 6px;
  height: 3px;
  border-left: 2px solid var(--bg-base);
  border-bottom: 2px solid var(--bg-base);
  transform: rotate(-45deg) translateY(-1px);
}

/* 우선순위 카드 보더 */
.ip-kanban-card[data-priority="urgent"] { border-left: 3px solid var(--ip-priority-urgent); }
.ip-kanban-card[data-priority="high"]   { border-left: 3px solid var(--ip-priority-high); }
.ip-kanban-card[data-priority="medium"] { border-left: 3px solid var(--ip-priority-medium); }
.ip-kanban-card[data-priority="low"]    { border-left: 3px solid var(--ip-priority-low); }

/* 카드 메타 (마감일, 프로젝트 색상) */
.ip-kanban-card-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  flex-wrap: wrap;
}

.ip-kanban-card-due {
  font-size: var(--text-xs);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.ip-kanban-card-due.overdue {
  color: var(--danger);
}

.ip-kanban-card-project {
  font-size: var(--text-xs);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

/* ── 컬럼 추가 버튼 ── */
.ip-kanban-add-col {
  flex: 0 0 var(--ip-kanban-col-w);
  min-width: var(--ip-kanban-col-min-w);
  max-width: var(--ip-kanban-col-max-w);
  display: flex;
  align-items: flex-start;
  padding-top: var(--s-4);
}

.ip-kanban-add-col-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  color: var(--text-faint);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.ip-kanban-add-col-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── 컬럼 추가 인라인 폼 ── */
.ip-kanban-add-col-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.ip-kanban-add-col-form input {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text-main);
  font-size: var(--text-sm);
  font-family: var(--font-family);
  outline: none;
}

.ip-kanban-add-col-form input:focus {
  border-color: var(--accent);
}

.ip-kanban-add-col-form-actions {
  display: flex;
  gap: var(--s-2);
}

/* ── 컬럼 이름 편집 ── */
.ip-kanban-col-name-input {
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: var(--s-0) var(--s-1);
  color: var(--text-main);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-family);
  outline: none;
  width: 100%;
}

/* ── 카드 추가 버튼 (컬럼 하단) ── */
.ip-kanban-add-card {
  padding: var(--s-2);
  flex-shrink: 0;
}

.ip-kanban-add-card-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--duration-fast);
}

.ip-kanban-add-card-btn:hover {
  background: var(--surface-hover);
  color: var(--text-sub);
}

/* ── 드래그 플레이스홀더 ── */
.ip-kanban-placeholder {
  background: var(--accent-dim);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  min-height: 40px;
  transition: all var(--duration-fast);
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .ip-kanban-board {
    height: calc(100vh - var(--ip-topbar-h) - var(--ip-bottombar-h) - var(--s-4));
    padding: var(--s-2);
    gap: var(--s-3);
  }

  .ip-kanban-col {
    flex: 0 0 85vw;
    min-width: 260px;
    max-width: 85vw;
  }

  .ip-kanban-add-col {
    flex: 0 0 85vw;
    min-width: 260px;
    max-width: 85vw;
  }
}

@media (max-width: 640px) {
  .ip-kanban-col {
    flex: 0 0 90vw;
  }

  .ip-kanban-add-col {
    flex: 0 0 90vw;
  }
}
