/* 파일 올리기 - 점선 상자·파일 줄(칩)·진행 막대. 동작은 file-upload.js, 규칙은 claude_common/ui/file-upload.md */
.file-upload { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.file-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; } /* 진짜 파일 칸은 숨기고 상자가 연다 */

/* 놓을 자리 - 점선 상자. 비어 있으면 크게, 파일이 있으면 낮게 */
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  min-height: 132px; padding: 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--uk-border); border-radius: var(--uk-r-md); background: var(--uk-surface); color: var(--uk-muted);
  transition: border-color .12s, background-color .12s;
}
.file-upload.has-files .file-drop { min-height: 64px; flex-direction: row; gap: .6rem; }
.file-drop:hover,
.file-upload-input:focus-visible + .file-drop { border-color: var(--uk-brand); color: var(--uk-fg); }
.file-upload.is-drop .file-drop { border-color: var(--uk-brand); background: var(--uk-brand-light); color: var(--uk-brand-dark); }
.file-drop b { color: var(--uk-fg); font-size: 14.5px; font-weight: 600; }
.file-drop small { font-size: 12.5px; word-break: keep-all; }        /* 개수·크기·종류 제한을 상자 안에 적는다 */
.file-drop-icon { width: 28px; height: 28px; flex: none; color: var(--uk-brand); }

/* 전체 진행 - 올리는 동안만 */
.file-total { display: flex; flex-direction: column; gap: .3rem; font-size: 12.5px; color: var(--uk-muted); }
.file-total[hidden] { display: none; }
.file-bar { height: 6px; border-radius: var(--uk-r-pill); background: var(--uk-sunk); overflow: hidden; }
.file-bar > i { display: block; height: 100%; width: 0; background: var(--uk-brand); border-radius: inherit; transition: width .2s; }

/* 파일 줄 - 그림(사진은 썸네일, 그 밖은 확장자) · 이름 · 크기/상태 · 막대 · [다시] · × */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.file-list:empty { display: none; }
.file-item {
  display: grid; grid-template-columns: 14px 40px minmax(0, 1fr) auto; align-items: center; column-gap: .65rem;
  cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none;
  padding: .45rem .5rem; border: 1px solid var(--uk-line); border-radius: var(--uk-r-md); background: var(--uk-surface);
}
.file-handle { grid-row: span 2; color: var(--uk-muted); font-size: 13px; letter-spacing: -2px; text-align: center; opacity: .7; } /* 끌어 순서 바꾸기 손잡이(줄 어디를 잡아도 된다) */
.file-item:focus-visible { outline: 2px solid var(--uk-brand); outline-offset: 2px; }
.file-thumb {
  grid-row: span 2; width: 40px; height: 40px; border-radius: var(--uk-r-sm); background: var(--uk-sunk) center / cover no-repeat;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--uk-muted); text-transform: uppercase; overflow: hidden;
}
/* 파일마다 진행 - 올리는 동안 썸네일 위에 옅은 막 + 퍼센트 + 아래 막대(2026-10-05) */
.file-thumb { position: relative; }
.file-thumb[data-pct]::before {
  content: attr(data-pct); position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--uk-scrim); color: var(--uk-on-strong); font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none;
}
.file-thumb[data-pct]::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p, 0%);
  background: var(--uk-brand); transition: width .2s;
}
.file-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { grid-column: 3; font-size: 12px; color: var(--uk-muted); display: flex; align-items: center; gap: .5rem; min-width: 0; }
.file-acts { grid-column: 4; grid-row: 1 / span 2; display: flex; gap: .2rem; }
.file-btn {
  min-width: 30px; height: 30px; padding: 0 .55rem; border: 0; border-radius: var(--uk-r-sm); background: none;
  color: var(--uk-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.file-btn:hover { background: var(--uk-head); color: var(--uk-fg); }
.file-btn.is-x { font-size: 18px; line-height: 1; }
.file-item.is-done .file-meta { color: var(--uk-ok); }
.file-item.is-error { border-color: var(--uk-danger); background: var(--uk-danger-light); }
.file-item.is-error .file-meta { color: var(--uk-danger); }
.file-item:not(.is-error) [data-file-retry],
.file-item.no-retry [data-file-retry] { display: none; } /* 종류·크기 오류는 다시 올려도 같다 */

/* ── 끌어서 순서 바꾸기 ── 자리에 남은 줄은 흐리게, 고스트는 손가락·마우스를 따라온다(목록형은 위아래로만) */
.file-item.is-dragging { opacity: .3; }
.file-list.is-sorting, .file-list.is-sorting .file-item { cursor: grabbing; }
.file-ghost {
  position: fixed; left: 0; top: 0; z-index: 2147483000; margin: 0; pointer-events: none; list-style: none;
  box-shadow: var(--uk-up-lg); opacity: .95; border-color: var(--uk-brand) !important;
}

/* ── 바둑판형(data-layout="grid") ── 80px 정사각 썸네일, 이름은 툴팁, × 는 오른쪽 위, 진행은 아래 띠 */
.file-list.is-grid { display: grid; grid-template-columns: repeat(auto-fill, 80px); gap: 8px; }
.file-list.is-grid .file-item, .file-ghost:not(:has(.file-handle)) {
  display: block; width: 80px; height: 80px; padding: 0; overflow: hidden;
  border: 1px solid var(--uk-line); border-radius: var(--uk-r-sm); touch-action: none;
}
.file-list.is-grid .file-item { position: relative; } /* 고스트는 위 .file-ghost의 fixed 그대로 */
.file-list.is-grid .file-thumb, .file-ghost:not(:has(.file-handle)) .file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; font-size: 12px; }
.file-list.is-grid .file-name, .file-ghost:not(:has(.file-handle)) .file-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* 이름은 툴팁(title)·읽기 프로그램용 */
.file-list.is-grid .file-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: 10.5px;
  background: var(--uk-surface); color: var(--uk-muted); justify-content: center; opacity: .92;
}
.file-list.is-grid .file-item.is-done .file-meta { display: none; }             /* 다 올라가면 사진만 */
.file-list.is-grid .file-item.is-uploading .file-meta { display: none; }      /* 진행은 썸네일 위에 */
.file-list.is-grid .file-thumb[data-pct]::before { font-size: 13px; }
.file-list.is-grid .file-item.is-error .file-meta > span:first-child,
.file-list.is-grid .file-item.is-error .file-meta { display: block; color: var(--uk-danger); text-align: center; line-height: 1.25; }
.file-list.is-grid .file-acts, .file-ghost:not(:has(.file-handle)) .file-acts { position: absolute; top: 3px; right: 3px; flex-direction: column; gap: 3px; }
.file-list.is-grid .file-btn { min-width: 24px; height: 24px; padding: 0 .3rem; border-radius: 50%; background: var(--uk-surface); box-shadow: var(--uk-up-sm); }
.file-list.is-grid .file-btn[data-file-retry] { border-radius: var(--uk-r-pill); font-size: 11px; }
.file-list.is-grid .file-btn.is-x { font-size: 15px; }
.file-list.is-grid .file-item.is-error { border-width: 2px; border-color: var(--uk-danger); }

.file-spin { width: 12px; height: 12px; flex: none; border: 2px solid var(--uk-border); border-top-color: var(--uk-brand); border-radius: 50%; animation: file-spin .7s linear infinite; }
@keyframes file-spin { to { transform: rotate(360deg); } }

/* 화면 전체에 놓기 - 파일을 든 채 화면에 들어오면 덮는 막 */
.file-drop-overlay {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; pointer-events: none;
  background: var(--uk-scrim);
}
.file-drop-overlay > div {
  padding: 2rem 2.5rem; border: 2px dashed var(--uk-brand); border-radius: var(--uk-r-lg); background: var(--uk-surface);
  text-align: center; color: var(--uk-muted); box-shadow: var(--uk-up-lg); max-width: calc(100vw - 32px);
}
.file-drop-overlay b { display: block; color: var(--uk-fg); font-size: 18px; margin-bottom: .25rem; }

@media (max-width: 767px) {
  .file-drop { min-height: 104px; }
  .file-upload.has-files .file-drop { flex-direction: column; gap: .2rem; } /* 좁으면 안내 글이 옆으로 밀려 세 줄로 꺾인다 */
  .file-meta .file-bar { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .file-bar > i { transition: none; } .file-spin { animation-duration: 1.5s; } }
