/* dash-edit.css — 교사 대시보드 «편집 중» 모양 (2026-10-14 · 대시보드 편집 개편 2단계 · 규칙 = docs/10_디자인/UI_규칙_누적장_0B.md R196)
 *   조작 코드는 js/dash-edit.js(편집할 때만 싣는다). 이 파일의 규칙은 편집 중 상태에만 걸린다 — 평소 대시보드 모양은 바뀌지 않는다.
 *   [keep-css] .dash-lifted .dash-flash .dash-dragging .dash-drag-on .dash-guides .dash-toast .dash-wmenu .dash-resize-e .dash-resize-s
 *   [keep-css] .dash-shelf .dash-ph-off .dash-ghost .wg-card .is-new .is-placed .is-hidden
 *   [keep-css] .wg-pv--list .wg-pv--cal .wg-pv--banner .wg-pv--kpi .wg-pv--todo .wg-pv--code .wg-pv--check .wg-pv--btn2
 *              — 전부 js/dash-edit.js·js/widget-modal.js 가 classList·className·템플릿으로 붙인다(일부는 'wg-pv--' + 모양 이름으로 조립).
 */

/* ── 제목줄(⠿)을 잡아야 끌린다(19번) — 본문은 끌리지 않는다 ── */
html.v2 .dash-widget.editing .dq-card-h { cursor: grab; user-select: none; touch-action: pan-y; }
html.v2 .dash-widget.editing .dq-card-h :is(button, a, input, select, textarea) { cursor: pointer; }
html.v2 .dq-w-ctrl .dq-w-grip { display: grid; place-items: center; width: 26px; height: 26px; color: var(--text-muted); user-select: none; touch-action: none; }
html.v2 .dq-w-ctrl .dq-w-more .ui-ico { width: 16px; height: 16px; }
html.v2 .dq-w-ctrl .dq-w-more[aria-expanded="true"] { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── 끄는 동안: 손을 따라 떠 있는 위젯 · 놓일 자리 · 칸 안내선 ── */
html.v2 .dash-widget.dash-lifted {
  position: fixed; z-index: 1000; margin: 0; pointer-events: none;
  box-shadow: var(--shadow-lg); opacity: .96;
}
html.dash-drag-on, html.dash-drag-on * { cursor: grabbing !important; user-select: none !important; }
html.v2 .dash-view { position: relative; }
html.v2 .dash-view > .dash-editbar { z-index: 20; }   /* 위로 굴렸을 때 위젯의 편집 단추(z 6)가 붙어 있는 편집 줄 위로 비치지 않게 */
.dash-guides {
  position: absolute; z-index: 2; pointer-events: none;
  display: grid; grid-template-columns: repeat(12, 1fr);
}
.dash-guides i {
  background: color-mix(in srgb, var(--primary) 5%, transparent);
  border-left: 1px dashed color-mix(in srgb, var(--primary) 30%, transparent);
  border-right: 1px dashed color-mix(in srgb, var(--primary) 30%, transparent);
}

/* ── 크기 손잡이: 모서리 = 둘 다 · 오른쪽 변 = 폭만 · 아래 변 = 키만(20번) ── */
html.v2 .dash-widget.editing .dash-resize { touch-action: none; z-index: 4; }
html.v2 .dash-widget.editing .dash-resize-e,
html.v2 .dash-widget.editing .dash-resize-s { position: absolute; z-index: 4; touch-action: none; }
html.v2 .dash-widget.editing .dash-resize-e { top: 28px; bottom: 28px; right: 0; width: 10px; cursor: ew-resize; }
html.v2 .dash-widget.editing .dash-resize-s { left: 28px; right: 28px; bottom: 0; height: 10px; cursor: ns-resize; }
html.v2 .dash-widget.editing .dash-resize-e::after,
html.v2 .dash-widget.editing .dash-resize-s::after {
  content: ''; position: absolute; border-radius: 3px; background: var(--primary); opacity: 0; transition: opacity .15s;
}
/* 짧은 알약 모양 — 길게 그리면 스크롤 막대로 읽힌다(손가락 화면에서 늘 보일 때 실제로 그렇게 보였다) */
html.v2 .dash-widget.editing .dash-resize-e::after { top: calc(50% - 14px); height: 28px; right: 2px; width: 6px; box-shadow: 0 0 0 2px var(--surface); }
html.v2 .dash-widget.editing .dash-resize-s::after { left: calc(50% - 14px); width: 28px; bottom: 2px; height: 6px; box-shadow: 0 0 0 2px var(--surface); }
html.v2 .dash-widget.editing:hover .dash-resize-e::after,
html.v2 .dash-widget.editing:hover .dash-resize-s::after { opacity: .45; }
html.v2 .dash-widget.editing .dash-resize-e:hover::after,
html.v2 .dash-widget.editing .dash-resize-s:hover::after { opacity: 1; }
/* 손가락으로 쓰는 화면 — 손잡이를 크게, 늘 보이게(13번 덧붙임) */
@media (pointer: coarse) {
  html.v2 .dash-widget.editing .dash-resize { width: 36px; height: 36px; opacity: 1; }
  html.v2 .dash-widget.editing .dash-resize-e { width: 18px; }
  html.v2 .dash-widget.editing .dash-resize-s { height: 18px; }
  html.v2 .dash-widget.editing .dash-resize-e::after,
  html.v2 .dash-widget.editing .dash-resize-s::after { opacity: .6; }
  html.v2 .dq-w-ctrl .dq-w-grip, html.v2 .dq-w-ctrl button { width: 36px; height: 36px; }
}

/* ── ⋯ 메뉴(9번) — 문제뱅킹 카드 ⋮ 메뉴와 같은 모양 ── */
.dash-wmenu {
  position: fixed; z-index: 1200; min-width: 208px; padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md);
}
.dash-wmenu > button {
  background: transparent; border: 0; padding: 8px 12px; text-align: left; white-space: nowrap;
  font: inherit; font-size: var(--text-sm); color: var(--text); border-radius: 6px; cursor: pointer;
}
.dash-wmenu button:hover { background: var(--bg-subtle); }
.dash-wmenu button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
.dash-wmenu button[aria-disabled="true"] { color: var(--text-muted); opacity: .55; cursor: default; background: transparent; }
.dash-wmenu > button.is-danger { color: var(--danger); }
.dash-wmenu > button.is-danger:hover { background: var(--danger-light); }
.dash-wmenu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.dash-wmenu-row { display: flex; align-items: center; gap: 4px; padding: 4px 8px; }
.dash-wmenu-lab { flex-shrink: 0; width: 22px; font-size: var(--text-xs); color: var(--text-muted); }
.dash-wmenu-row button {
  flex: 1; padding: 6px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  font: inherit; font-size: var(--text-xs); color: var(--text-body); cursor: pointer;
}
.dash-wmenu-row button[aria-checked="true"] { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 700; }

/* ── 되돌리기 알림(10번) ── */
.dash-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 1100; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px;
  background: var(--text); color: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); word-break: keep-all;
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.dash-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.dash-toast-undo {
  flex-shrink: 0; padding: 4px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  font: inherit; font-weight: 700; color: color-mix(in srgb, var(--primary) 45%, var(--surface));
}
.dash-toast-undo:hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }

/* ── 숨긴 위젯 보관함(3단계 · 15번) — 편집 중 그리드 바로 아래 · 위젯을 끌어 놓으면 숨는다 ── */
.dash-shelf {
  margin-top: var(--dash-gap, 20px); padding: 12px 16px; min-height: 64px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.dash-shelf.is-target { border-color: var(--primary); background: var(--primary-light); }
/* 놓으면 숨긴다는 말은 제목 바로 옆(왼쪽)에 — 오른쪽은 끌고 있는 위젯에 가려진다(실화면 2026-10-15) */
.dash-shelf.is-target::after { content: '여기에 놓으면 숨겨요'; order: 1; font-size: var(--text-sm); font-weight: 700; color: var(--primary); }
.dash-shelf-empty, .dash-shelf-list { order: 2; }
.dash-shelf.is-target .dash-shelf-empty { display: none; }
.dash-grid.dash-ph-off > .dash-drop-ph { opacity: .35; color: transparent; }
.dash-shelf-h { margin: 0; font-size: var(--text-sm); font-weight: 700; color: var(--text); white-space: nowrap; }
.dash-shelf-h span { margin-left: 4px; color: var(--text-muted); font-weight: 600; }
.dash-shelf-empty { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
.dash-shelf-list { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-shelf-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle); cursor: pointer;
  font: inherit; font-size: var(--text-sm); color: var(--text-body);
}
.dash-shelf-chip .ui-ico { width: 16px; height: 16px; }
.dash-shelf-chip b { color: var(--primary); font-weight: 700; }
.dash-shelf-chip:hover { border-color: var(--primary); background: var(--primary-light); }
/* 갤러리에서 끌어 오는 동안 손을 따라오는 이름표 카드 */
html.v2 .dash-widget.dash-ghost { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--text-base); color: var(--text); border-style: dashed; border-color: var(--primary); }

/* ── 위젯 추가 갤러리(3단계 · 14번) — 크기 고정 창 · 왼쪽 분류 · 오른쪽 그림 카드(본문만 스크롤) ── */
#widgetDialog .dialog-modal { width: min(880px, 94vw); max-width: min(880px, 94vw); height: min(600px, 88vh); }
#widgetDialog .dialog-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
#widgetPickerList { flex: 1; min-height: 0; display: flex; }
.wg-gal { flex: 1; min-height: 0; display: grid; grid-template-columns: 150px 1fr; gap: 16px; }
.wg-cats { display: flex; flex-direction: column; gap: 2px; }
.wg-cat {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font: inherit; font-size: var(--text-sm); color: var(--text-body); text-align: left;
}
.wg-cat span { font-size: var(--text-xs); color: var(--text-muted); }
.wg-cat:hover { background: var(--bg-subtle); }
.wg-cat[aria-pressed="true"] { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.wg-cards { min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: start; padding: 2px; }
.wg-empty { grid-column: 1 / -1; margin: 24px 0; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.wg-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.wg-card.is-new { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.wg-card.is-placed { background: var(--bg-subtle); }
.wg-tx b { display: flex; align-items: center; gap: 6px; font-size: var(--text-base); color: var(--text); }
.wg-tx b .ui-ico { width: 16px; height: 16px; }
.wg-tx > span { display: block; margin-top: 2px; height: 36px; overflow: hidden; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.6; word-break: keep-all; }
.wg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.wg-sizes { display: inline-flex; gap: 3px; }
.wg-sizes button { padding: 3px 7px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); cursor: pointer; font: inherit; font-size: var(--text-xs); color: var(--text-body); }
.wg-sizes button[aria-pressed="true"] { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.wg-foot .btn { margin-left: auto; }
.wg-badge { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
/* 그림 미리보기 — 모양만(실제 화면 아님) */
.wg-pv { height: 64px; padding: 8px; border-radius: 8px; background: var(--bg-subtle); display: grid; gap: 4px; overflow: hidden; }
.wg-pv i { display: block; border-radius: var(--radius-xs); background: var(--border); font-style: normal; }
.wg-pv--list, .wg-pv--todo, .wg-pv--check { grid-auto-rows: 1fr; }
.wg-pv--todo i { border-left: 6px solid color-mix(in srgb, var(--warning) 60%, var(--border)); }
.wg-pv--check i { border-left: 6px solid color-mix(in srgb, var(--success) 60%, var(--border)); }
.wg-pv--cal { grid-template-columns: repeat(5, 1fr); }
.wg-pv--cal i:nth-child(3), .wg-pv--cal i:nth-child(9) { background: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.wg-pv--banner { grid-template-columns: 6px 1fr; }
.wg-pv--banner i:first-child { background: var(--primary); }   /* 수업 진행 안내 카드의 왼쪽 띠(평소 = 다음에 열 수업 = 테마 주 색) */
.wg-pv--kpi { grid-template-columns: repeat(3, 1fr); }
.wg-pv--code { place-items: center; }
.wg-pv--code i { padding: 6px 12px; background: var(--primary-light); color: var(--primary); font-weight: 800; letter-spacing: .1em; font-size: var(--text-sm); }
.wg-pv--btn2 { grid-template-columns: 1fr 1fr; }
.wg-pv--btn2 i { background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 760px) {
  .wg-gal { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .wg-cats { flex-direction: row; flex-wrap: wrap; }
  .wg-cards { grid-template-columns: 1fr; }
}

/* ── 옮기거나 넣은 위젯을 0.7초 표시(Atlassian 지침) ── */
@keyframes dashFlash {
  from { background-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary); }
  to   { box-shadow: 0 0 0 0 transparent; }
}
html.v2 .dash-widget.dash-flash { animation: dashFlash .7s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .dash-toast { transition: none; }
  html.v2 .dash-widget.editing .dash-resize-e::after,
  html.v2 .dash-widget.editing .dash-resize-s::after { transition: none; }
}
