/* ────────────────────────────────────────────────────────────────
   [테스트시 메모] 전용 스타일시트
   - index.js 의 스킨 교체 로직(href 가 index.css / common.css 인 <link> 만 제거)에 걸리지 않도록
     별도 파일로 분리한다. 스킨을 쓰는 프로젝트에서도 메모 UI 모양이 유지된다.
   - 스킨 CSS 가 head 뒤쪽에 붙어도 이기도록, 스킨이 이미 갖고 있는 선택자
     (div.memos / #memobox / table.memo-table) 는 클래스를 더해 우선순위를 높여 덮어쓴다.
   - 클래스 접두사 gd-memo- 는 스킨/공통 CSS 어디에도 없는 이름이라 충돌하지 않는다.
   ──────────────────────────────────────────────────────────────── */

/* 색/치수 한 곳에서 관리 */
.gd-memo-wrap,
.gd-memo-editor,
.gd-memo-fab {
	--gd-memo-line: #e3e8ef;
	--gd-memo-text: #24303f;
	--gd-memo-sub: #7b8794;
	--gd-memo-blue: #2f7fe0;
	--gd-memo-blue-dark: #1e63ba;
	--gd-memo-green: #12a150;
	--gd-memo-red: #d0453b;
	--gd-memo-bg: #ffffff;
	--gd-memo-soft: #f5f7fa;
	--gd-memo-radius: 10px;
	--gd-memo-shadow: 0 2px 10px rgba(20, 30, 50, .10);
}

/* ── 메모 목록 영역 ───────────────────────────────────────────── */
div.memos.gd-memo-wrap {
	padding: 0;
	margin: 1.2em 0 2em;
	font-size: 13px;
	line-height: 1.55;
	color: var(--gd-memo-text);
	text-align: left;
}

div.memos.gd-memo-wrap:empty {
	display: none;
	margin: 0;
}

.gd-memo-wrap .gd-memo-listhead {
	display: flex;
	align-items: center;
	gap: .5em;
	margin: 0 0 .6em;
	padding: 0 .1em;
	font-weight: 700;
	font-size: 13px;
	color: var(--gd-memo-sub);
}

.gd-memo-wrap .gd-memo-listhead .gd-memo-count {
	display: inline-block;
	min-width: 1.6em;
	padding: 0 .45em;
	border-radius: 999px;
	background: var(--gd-memo-blue);
	color: #fff;
	font-size: 11px;
	line-height: 1.7;
	text-align: center;
}

/* ── 메모 카드(요청 1건 = 카드 1개) ──────────────────────────── */
.gd-memo-wrap .gd-memo-card {
	position: relative;
	margin: 0 0 .8em;
	border: 1px solid var(--gd-memo-line);
	border-left: 4px solid var(--gd-memo-blue);
	border-radius: var(--gd-memo-radius);
	background: var(--gd-memo-bg);
	box-shadow: var(--gd-memo-shadow);
	overflow: hidden;
}

.gd-memo-wrap .gd-memo-card.COMPLETE {
	border-left-color: var(--gd-memo-green);
	background: #fbfffc;
}

.gd-memo-wrap .gd-memo-card-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .45em;
	padding: .55em .75em;
	background: var(--gd-memo-soft);
	border-bottom: 1px solid var(--gd-memo-line);
}

.gd-memo-wrap .gd-memo-badge {
	display: inline-block;
	padding: .1em .55em;
	border-radius: 999px;
	background: var(--gd-memo-blue);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

.gd-memo-wrap .gd-memo-card.COMPLETE .gd-memo-badge {
	background: var(--gd-memo-green);
}

.gd-memo-wrap .gd-memo-qname {
	padding: .1em .5em;
	border: 1px solid var(--gd-memo-line);
	border-radius: 999px;
	background: #fff;
	color: var(--gd-memo-sub);
	font-size: 11px;
	white-space: nowrap;
}

.gd-memo-wrap .gd-memo-uid {
	max-width: 14em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--gd-memo-sub);
	font-size: 11.5px;
	cursor: pointer;
	border-bottom: 1px dashed transparent;
}

.gd-memo-wrap .gd-memo-uid:hover {
	color: var(--gd-memo-blue);
	border-bottom-color: var(--gd-memo-blue);
}

.gd-memo-wrap .gd-memo-date {
	color: var(--gd-memo-sub);
	font-size: 11.5px;
	white-space: nowrap;
}

.gd-memo-wrap .gd-memo-head-actions {
	display: flex;
	gap: .3em;
	margin-left: auto;
}

.gd-memo-wrap .gd-memo-body {
	padding: .75em .85em;
	white-space: pre-wrap;
	word-break: break-word;
	font-size: 13.5px;
}

/* ── 답글(댓글) ──────────────────────────────────────────────── */
.gd-memo-wrap .gd-memo-replies {
	border-top: 1px dashed var(--gd-memo-line);
	background: #fcfdff;
}

.gd-memo-wrap .gd-memo-reply {
	position: relative;
	padding: .55em .85em .6em 2.1em;
	border-bottom: 1px dashed var(--gd-memo-line);
}

.gd-memo-wrap .gd-memo-reply:last-child {
	border-bottom: 0;
}

/* 답글임을 나타내는 꺾인 화살표 */
.gd-memo-wrap .gd-memo-reply:before {
	content: "↳";
	position: absolute;
	left: .8em;
	top: .5em;
	color: var(--gd-memo-sub);
	font-size: 13px;
}

.gd-memo-wrap .gd-memo-reply-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4em;
	margin-bottom: .15em;
}

.gd-memo-wrap .gd-memo-reply-body {
	white-space: pre-wrap;
	word-break: break-word;
}

/* ── 답글 입력 ───────────────────────────────────────────────── */
.gd-memo-wrap .gd-memo-reply-form {
	display: flex;
	/* 입력칸 → 첨부 → 버튼줄 순으로 쌓는다(가로로 늘어서면 안 된다) */
	flex-direction: column;
	align-items: stretch;
	gap: .1em;
	padding: .55em .85em .7em 2.1em;
	border-top: 1px dashed var(--gd-memo-line);
	background: #fcfdff;
}

/* 답글칸에 파일을 끌어다 놓는 중 */
.gd-memo-wrap .gd-memo-reply-form.dragover {
	outline: 2px dashed var(--gd-memo-blue);
	outline-offset: -3px;
}

.gd-memo-wrap .gd-memo-reply-form.display-none {
	display: none !important;
}

.gd-memo-wrap .gd-memo-reply-input {
	flex: 1 1 auto;
	min-height: 2.6em;
	max-height: 12em;
	padding: .45em .55em;
	border: 1px solid var(--gd-memo-line);
	border-radius: 8px;
	background: #fff;
	color: var(--gd-memo-text);
	font-family: inherit;
	font-size: 13px;
	line-height: 1.5;
	resize: vertical;
	box-sizing: border-box;
	box-shadow: none;
}

.gd-memo-wrap .gd-memo-reply-input:focus {
	outline: none;
	border-color: var(--gd-memo-blue);
	box-shadow: 0 0 0 2px rgba(47, 127, 224, .15);
}

/* ── 버튼 ────────────────────────────────────────────────────── */
.gd-memo-wrap .gd-memo-btn,
.gd-memo-editor .gd-memo-btn {
	display: inline-block;
	padding: .28em .7em;
	border: 1px solid var(--gd-memo-line);
	border-radius: 6px;
	background: #fff;
	color: var(--gd-memo-text);
	font-family: inherit;
	font-size: 11.5px;
	line-height: 1.6;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none;
	text-shadow: none;
}

.gd-memo-wrap .gd-memo-btn:hover,
.gd-memo-editor .gd-memo-btn:hover {
	background: var(--gd-memo-soft);
}

.gd-memo-wrap .gd-memo-btn.primary,
.gd-memo-editor .gd-memo-btn.primary {
	border-color: var(--gd-memo-blue);
	background: var(--gd-memo-blue);
	color: #fff;
}

.gd-memo-wrap .gd-memo-btn.primary:hover,
.gd-memo-editor .gd-memo-btn.primary:hover {
	background: var(--gd-memo-blue-dark);
}

.gd-memo-wrap .gd-memo-btn.success {
	border-color: var(--gd-memo-green);
	color: var(--gd-memo-green);
}

.gd-memo-wrap .gd-memo-btn.success:hover {
	background: var(--gd-memo-green);
	color: #fff;
}

.gd-memo-wrap .gd-memo-btn.danger {
	border-color: #e6c3c0;
	color: var(--gd-memo-red);
}

.gd-memo-wrap .gd-memo-btn.danger:hover {
	background: var(--gd-memo-red);
	color: #fff;
}

.gd-memo-editor .gd-memo-btn {
	padding: .45em 1.1em;
	font-size: 13px;
}

/* ── 메모 작성 패널 ──────────────────────────────────────────── */
.gd-memo-editor {
	position: fixed;
	left: 1em;
	bottom: 4.2em;
	z-index: 100000;
	/* 처음 크기 — 머리줄을 끌어 옮기거나 오른쪽 아래 모서리로 크기를 바꾸면 그 값이 기억된다 */
	width: 34em;
	height: 26em;
	max-width: calc(100vw - 2em);
	max-height: calc(100vh - 2em);
	display: flex;
	flex-direction: column;
	border: 1px solid var(--gd-memo-line);
	border-radius: 12px;
	background: var(--gd-memo-bg);
	box-shadow: 0 8px 26px rgba(20, 30, 50, .22);
	color: var(--gd-memo-text);
	font-size: 13px;
	text-align: left;
	overflow: hidden;
}

.gd-memo-editor.display-none {
	display: none !important;
}

.gd-memo-editor .gd-memo-editor-head {
	display: flex;
	align-items: center;
	gap: .4em;
	padding: .6em .8em;
	background: var(--gd-memo-soft);
	border-bottom: 1px solid var(--gd-memo-line);
	font-weight: 700;
	flex: 0 0 auto;
	/* 머리줄을 끌면 패널이 움직인다 */
	cursor: move;
	user-select: none;
}

/* 끄는 곳임을 알리는 손잡이 표시 */
.gd-memo-editor .gd-memo-editor-grip {
	width: .9em;
	height: 1em;
	background-image: radial-gradient(currentColor 1px, transparent 1px);
	background-size: 4px 4px;
	background-position: 0 2px;
	color: #b6bfcb;
	flex: 0 0 auto;
}

/* 끄는 동안에는 글자가 선택되지 않게 */
.gd-memo-editor.dragging,
.gd-memo-editor.dragging * {
	user-select: none;
}

/* 파일을 끌어다 놓는 중 */
.gd-memo-editor.dragover {
	outline: 2px dashed var(--gd-memo-blue);
	outline-offset: -4px;
}

/* 오른쪽 아래 크기 조절 손잡이 */
.gd-memo-editor .gd-memo-editor-resize {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 16px;
	height: 16px;
	cursor: nwse-resize;
	background-image: linear-gradient(135deg, transparent 50%, #c3cbd6 50%, #c3cbd6 62%, transparent 62%, transparent 74%, #c3cbd6 74%, #c3cbd6 86%, transparent 86%);
}

.gd-memo-editor .gd-memo-editor-target {
	margin-left: auto;
	max-width: 11em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--gd-memo-sub);
	font-size: 11.5px;
	font-weight: 400;
}

.gd-memo-editor .gd-memo-editor-close {
	width: 1.7em;
	height: 1.7em;
	padding: 0;
	margin-left: .3em;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--gd-memo-sub);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.gd-memo-editor .gd-memo-editor-close:hover {
	background: #e7ebf1;
	color: var(--gd-memo-text);
}

.gd-memo-editor .gd-memo-editor-body {
	padding: .7em .8em .2em;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: auto;
}

/* 스킨의 #memobox(노란 메모지 모양) 규칙을 이긴다 — id 하나(1,0,0)보다 높은 (1,1,0) */
.gd-memo-editor #memobox,
.gd-memo-editor .gd-memo-textarea {
	display: block;
	width: 100%;
	/* 패널 높이에 맞춰 늘어난다(패널 크기를 조절하면 함께 커진다) */
	flex: 1 1 auto;
	height: auto;
	min-height: 7em;
	padding: .6em;
	border: 1px solid var(--gd-memo-line);
	border-radius: 8px;
	background: #fff;
	color: var(--gd-memo-text);
	font-family: inherit;
	font-size: 13.5px;
	line-height: 1.55;
	box-shadow: none;
	box-sizing: border-box;
	resize: vertical;
}

.gd-memo-editor #memobox:focus,
.gd-memo-editor .gd-memo-textarea:focus {
	outline: none;
	border-color: var(--gd-memo-blue);
	box-shadow: 0 0 0 2px rgba(47, 127, 224, .15);
}

.gd-memo-editor .gd-memo-editor-foot {
	display: flex;
	align-items: center;
	gap: .4em;
	padding: .6em 1.3em .8em .8em;
	flex: 0 0 auto;
}

.gd-memo-editor .gd-memo-hint {
	margin-right: auto;
	color: var(--gd-memo-sub);
	font-size: 11.5px;
}

/* ── [메모하기] 버튼 ─────────────────────────────────────────── */
/* 스킨의 `div.tools > div.tool-buttons > button` 규칙(0,2,3)보다 높은 선택자로 쓴다 */
div.tools > div.tool-buttons > button.add-memo.gd-memo-fab,
button.add-memo.gd-memo-fab {
	padding: .4em .9em;
	border: 0;
	border-radius: 999px;
	background: var(--gd-memo-blue);
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.7;
	box-shadow: 0 3px 10px rgba(47, 127, 224, .35);
	text-shadow: none;
	cursor: pointer;
}

button.add-memo.gd-memo-fab:hover {
	background: var(--gd-memo-blue-dark);
}

/* 건수 뱃지를 눌러도 버튼이 눌린 것으로 처리되게 한다
   (Survey.on 은 evt.target 이 선택자와 정확히 일치할 때만 동작한다) */
button.add-memo.gd-memo-fab .gd-memo-fab-count {
	pointer-events: none;
	display: inline-block;
	margin-left: .35em;
	padding: 0 .4em;
	border-radius: 999px;
	background: rgba(255, 255, 255, .28);
	font-size: 11px;
}

/* ── 첨부파일 ────────────────────────────────────────────────── */
.gd-memo-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: .4em;
	margin: .5em 0 .1em;
}

.gd-memo-attachments:empty {
	display: none;
}

.gd-memo-attach-item {
	position: relative;
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	border: 1px solid var(--gd-memo-line);
	border-radius: 8px;
	background: var(--gd-memo-soft);
	overflow: hidden;
}

.gd-memo-attach-item > a {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	text-decoration: none;
}

.gd-memo-attach-item.image > a {
	line-height: 0;
}

.gd-memo-attach-item.image img {
	display: block;
	width: 88px;
	height: 88px;
	object-fit: cover;
}

.gd-memo-attach-name {
	display: inline-block;
	max-width: 16em;
	padding: .35em .6em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--gd-memo-blue);
	font-size: 12px;
}

/* 작성 중일 때만 보이는 [첨부 빼기] */
.gd-memo-attach-del {
	position: absolute;
	right: 2px;
	top: 2px;
	width: 18px;
	height: 18px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(20, 30, 50, .6);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
}

.gd-memo-attach-del:hover {
	background: var(--gd-memo-red);
}

/* [파일 첨부] — label 안의 input 은 감춘다 */
.gd-memo-attach {
	position: relative;
	overflow: hidden;
	cursor: pointer;
}

.gd-memo-attach input.gd-memo-file-input {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.gd-memo-editor .gd-memo-files {
	flex: 0 0 auto;
}

/* [메모 내용 Ai채팅에 자동적용] 로 자동으로 달린 답글도 보통 답글과 똑같이 보인다.
   메모를 남긴 사람에게 "AI 가 답했다 / 답하는 중이다" 를 드러내지 않기 위해 전용 표시를 두지 않는다. */

/* ── 답글 입력칸 아래 버튼줄 ─────────────────────────────────── */
.gd-memo-reply-foot {
	display: flex;
	align-items: center;
	gap: .4em;
	margin-top: .4em;
}

/* [파일 첨부] 는 왼쪽, 등록/취소는 오른쪽 */
.gd-memo-reply-foot .gd-memo-attach {
	margin-right: auto;
}

/* ── 좁은 화면 ───────────────────────────────────────────────── */
@media (max-width: 640px) {
	.gd-memo-editor {
		left: .6em;
		right: .6em;
		bottom: 3.8em;
		width: auto;
		height: 60vh;
	}

	.gd-memo-attach-item.image img {
		width: 68px;
		height: 68px;
	}

	.gd-memo-wrap .gd-memo-head-actions {
		width: 100%;
		margin-left: 0;
	}

	.gd-memo-wrap .gd-memo-reply-form {
		padding-left: 1.1em;
	}
}
