/* Metalogy Spatial Editor — 동영상 넣기 창 · 동영상 종류 칸 (v1.18.0, assets/ix-video.js)
   + 끌어 순서 바꾸기 모양 (assets/ix-media.js dragSort — Context 슬라이드 창 등이 함께 쓴다).
   편집기 변수(--accent · --line · --text · --muted · --dim · --field)와 .modal · .btn · .seg · .switch · .drop-zone 모양을 따른다. */

/* ---------------------------------------------------------------- 창 */

dialog.ixv-modal { width: min(920px, calc(100vw - 32px)); }
/* 머리 · 아래 줄은 그대로, 가운데만 스크롤 (열려 있을 때만 flex — 닫힌 dialog 는 보이면 안 된다) */
dialog.ixv-modal[open] { display: flex; flex-direction: column; }
.ixv-modal > .modal-head, .ixv-modal > .modal-foot { flex: none; }
.ixv-modal > .modal-body { flex: 1 1 auto; min-height: 0; padding-top: 14px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff22 transparent; }
dialog.ixv-modal.is-dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }

.ixv-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px 22px; align-items: start; }
.ixv-col { min-width: 0; display: grid; gap: 12px; align-content: start; }
.ixv-side { gap: 14px; }

/* 탭 '파일' · '링크' */
.ixv-tabs { justify-self: start; }
.ixv-tabs .seg-btn { height: 30px; padding: 0 16px; }
.ixv-tabs .seg-btn[aria-selected="true"] { background: var(--gradient); color: #fff; }
.ixv-pane { display: grid; gap: 10px; min-width: 0; animation: ixv-in .28s cubic-bezier(.22,.68,.2,1) both; }
@keyframes ixv-in { from { opacity: 0; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .ixv-pane { animation: none; } }

/* 16:9 무대 (미리보기 · 링크 카드) */
.ixv-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #ffffff1f; border-radius: 10px; background: #000; }
.ixv-stage > video, .ixv-stage > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.ixv-stage > video { object-fit: contain; }
.ixv-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 파일 놓는 칸 — 미리보기와 같은 크기 */
.ixv-drop { width: 100%; aspect-ratio: 16 / 9; align-content: center; padding: 18px; background: #ffffff04; font: inherit; color: var(--muted); }
.ixv-drop strong { color: var(--text); font-size: 14px; font-weight: 600; }
.ixv-drop .hint { margin: 0; max-width: 34em; }
.ixv-drop svg { width: 34px; height: 34px; color: #7fe6c8; }
.ixv-drop[aria-busy="true"] { cursor: not-allowed; opacity: .7; }

/* 파일 정보 */
.ixv-info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 16px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #ffffff05; font-size: 12.5px; line-height: 1.55; }
.ixv-info dt { color: var(--dim); white-space: nowrap; }
.ixv-info dd { margin: 0; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ixv-row-actions { justify-content: flex-end; }

/* 안내 · 오류 줄 */
.ixv-modal .ixv-msg { margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff06; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.ixv-modal .ixv-msg[data-kind="bad"] { border-color: #ff6b8144; background: #ff6b8114; color: #ffc2cd; }
.ixv-modal .ixv-msg[data-kind="warn"] { border-color: #ffd47944; background: #ffd47912; color: #ffe2a3; }
.ixv-modal .ixv-msg[data-kind="info"] { border-color: #1b60e144; background: #1b60e114; color: #c8d6ee; }
.ixv-modal .ixv-msg[data-kind="busy"] { display: flex; align-items: center; gap: 8px; }
.ixv-modal .ixv-msg[data-kind="busy"]::before { content: ''; flex: none; width: 12px; height: 12px; border: 2px solid #ffffff2e; border-top-color: var(--accent); border-radius: 50%; animation: ixv-spin .8s linear infinite; }
@keyframes ixv-spin { to { transform: rotate(360deg); } }

/* 링크 */
.ixv-url-row { display: flex; gap: 6px; }
.ixv-url-row .field { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.ixv-modal .ixv-supported { margin: -2px 0 0; }
.ixv-card { display: grid; gap: 10px; }
.ixv-ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; color: var(--muted); font-size: 13px; background: radial-gradient(circle at 50% 45%, #16222c, #05080b 70%); }
/* 그림이 없을 때: 가운데 재생 단추 아래에 공급자 이름만 (아이콘은 재생 단추가 대신) */
.ixv-ph svg { display: none; }
.ixv-ph span { transform: translateY(54px); }
/* 메타로지 모양 재생 단추 (뷰어 슬라이드 화살표와 같은 결) */
.ixv-play {
  position: absolute; left: 50%; top: 50%; z-index: 2; display: grid; place-items: center; width: 60px; height: 60px; margin: -30px 0 0 -30px; padding: 0;
  border: 1.5px solid #3a5264; border-radius: 50%; background: #0b1116cc; color: #fff; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: border-color .25s, background-color .25s, transform .25s;
}
.ixv-play svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.ixv-play:hover, .ixv-play:focus-visible { border-color: var(--accent); background: #19382f; transform: scale(1.06); }
.ixv-card-meta { display: grid; gap: 3px; min-width: 0; }
.ixv-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.ixv-card-title { font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; line-height: 1.45; }
.ixv-card-title.is-empty { font-weight: 500; color: var(--dim); font-size: 12.5px; }
.ixv-card-sub { font-size: 12px; color: var(--muted); }
.ixv-card-sub:empty { display: none; }
.ixv-card-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--dim); }

/* 배지 (공급자 · 파일) */
.ixv-badge { display: inline-flex; align-items: center; justify-self: start; height: 20px; padding: 0 9px; border: 1px solid #2fd3a855; border-radius: 99px; background: #2fd3a81a; color: #9ff0d8; font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.ixv-badge.is-empty { border-color: #ffd47955; background: #ffd47914; color: #ffe2a3; }

/* 오른쪽: 제목 · 썸네일 · 재생 */
.ixv-block { display: grid; gap: 6px; min-width: 0; }
.ixv-block + .ixv-block { padding-top: 12px; border-top: 1px solid #ffffff0f; }
.ixv-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ixv-label { font-size: 12px; font-weight: 600; color: #d5dde6; }
.ixv-count { font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.ixv-thumb { display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #ffffff24; border-radius: 9px; background: #0b1116; }
.ixv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ixv-thumb > span { padding: 10px; font-size: 12px; color: var(--dim); text-align: center; }
.ixv-thumb.is-empty { border-style: dashed; }
.ixv-thumb.is-empty img, .ixv-thumb:not(.is-empty) > span { display: none; }
.ixv-thumb.is-broken img { opacity: .25; }
.ixv-modal .ixv-thumb-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.ixv-thumb-actions { gap: 4px; }
.ixv-modal .ixv-thumb-block .hint { margin: 2px 0 0; }
.ixv-opt { min-height: 32px; }
.ixv-opt label small { margin-left: 6px; font-size: 11px; }
.ixv-modal .ixv-caps { margin: 2px 0 0; }

/* 아래 줄 */
.ixv-foot { align-items: center; padding-top: 12px; border-top: 1px solid #ffffff0f; }
.ixv-foot-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.ixv-foot .btn.primary { min-width: 96px; }

/* 좁은 화면: 한 줄로 */
@media (max-width: 760px) {
  .ixv-grid { grid-template-columns: minmax(0, 1fr); }
  .ixv-side .ixv-thumb { max-width: 420px; }
}
@media (max-width: 520px) {
  dialog.ixv-modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .ixv-modal > .modal-head { padding: 14px 16px 0; }
  .ixv-modal > .modal-body { padding: 12px 16px 16px; }
  .ixv-modal > .modal-foot { flex-wrap: wrap; padding: 10px 16px 16px; }
  .ixv-foot-note { flex-basis: 100%; white-space: normal; }
  .ixv-drop { aspect-ratio: auto; min-height: 160px; }
}

/* ---------------------------------------------------------------- 편집 칸 (동영상 종류) */

.ixv-sum { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; margin: 2px 0 8px; padding: 8px; border: 1px solid #ffffff14; border-radius: 10px; background: #ffffff05; }
.ixv-sum-media { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; border: 1px solid #ffffff1a; background: #0b1116; color: #7fe6c8; }
.ixv-sum-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ixv-sum-ph svg { width: 22px; height: 22px; opacity: .8; }
.ixv-sum-main { display: grid; gap: 2px; min-width: 0; }
.ixv-sum-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--text); }
.ixv-sum-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ixv-sum-sub:empty { display: none; }
.ixv-sec-actions { margin-bottom: 4px; }
.ixv-section .ixv-opt { min-height: 30px; }
.ixv-section .ixv-caps { margin: 4px 0 0; }

/* ---------------------------------------------------------------- 끌어 순서 바꾸기 (ix-media.js dragSort) */

.ix-sort-active { user-select: none; -webkit-user-select: none; }
.ix-sort-active > *, .ix-sort-armed { -webkit-touch-callout: none; }
.ix-sort-armed { box-shadow: 0 0 0 2px #2fd3a8aa; transition: box-shadow .2s; }
.ix-sort-dragging { box-shadow: 0 14px 34px #000a, 0 0 0 2px var(--accent) !important; opacity: .96; cursor: grabbing; }
html.ix-sort-busy, html.ix-sort-busy * { cursor: grabbing !important; }
