/* 실시간 상담 위젯. 모든 셀렉터는 #zen-livechat 아래에 둔다: 몰 테마 CSS 와 서로 오염되지 않게.
 * 색은 --zlc-color(버튼·창머리)·--zlc-bubble(내 말풍선). 위치·여백은 --zlc-x · --zlc-y · --zlc-my.
 */
#zen-livechat {
	--zlc-color: #1aa39a;
	--zlc-bubble: #1aa39a;
	--zlc-x: 24px;
	--zlc-y: 24px;
	--zlc-my: 80px;
	position: fixed;
	bottom: calc(var(--zlc-y) + env(safe-area-inset-bottom, 0px));
	z-index: 990;   /* 닫힌 버튼: 테마 퀵메뉴(980) 위, AI 추천 패널(1000)·모달·굿즈 디자이너보다 아래 */
	font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1f2328;
	letter-spacing: normal;
	text-align: left;
	/* 외부 사이트 본문에서 물려받는 글자 속성을 끊는다(섀도 DOM 도 상속은 막지 못한다) */
	font-weight: 400;
	font-style: normal;
	text-transform: none;
	word-spacing: normal;
	white-space: normal;
	direction: ltr;
}
/* 연 상담 창은 무엇보다 위에 둔다 */
#zen-livechat.zlc-open { z-index: 2147483000; }
/* 모달이 떠 있는 동안 닫힌 버튼은 감춘다: 어두운 막 위에 버튼만 떠 보이지 않게 */
body.dimmed #zen-livechat:not(.zlc-open) { display: none; }
/* AI 추천 오버레이가 열려 있어도 감춘다. 모바일 테마는 그 패널이 .pusher(z-index 2) 안에 있어 z-index 로는 이 버튼 아래로 깔린다 */
body:has(.ai-reco-backdrop.open) #zen-livechat:not(.zlc-open) { display: none; }
#zen-livechat.zlc-right { right: var(--zlc-x); }
#zen-livechat.zlc-left { left: var(--zlc-x); }
#zen-livechat *, #zen-livechat *::before, #zen-livechat *::after { box-sizing: border-box; }
#zen-livechat button { font: inherit; cursor: pointer; }
#zen-livechat svg { display: block; width: 100%; height: 100%; }

/* 띄움 버튼 */
#zen-livechat .zlc-launcher {
	position: relative;
	width: 60px;
	height: 60px;
	padding: 16px;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--zlc-color);
	color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	transition: transform .18s ease;
}
#zen-livechat.zlc-left .zlc-launcher { margin-right: auto; }
#zen-livechat .zlc-launcher:hover { transform: scale(1.06); }
#zen-livechat .zlc-launcher:focus-visible { outline: 3px solid rgba(0, 0, 0, .25); outline-offset: 2px; }
#zen-livechat .zlc-ico-close { display: none; padding: 3px; }
/* 몰이 올린 아이콘: 그림 자체가 버튼이다. 바탕·여백을 걷고 그림 모양 그대로 그림자를 준다 */
#zen-livechat .zlc-launcher.zlc-has-icon { padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
#zen-livechat.zlc-open .zlc-launcher.zlc-has-icon { padding: 16px; background: var(--zlc-color); box-shadow: 0 6px 20px rgba(0, 0, 0, .22); border-radius: 50%; }
#zen-livechat .zlc-icon-img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .2)); }
#zen-livechat.zlc-open .zlc-ico-open { display: none; }
#zen-livechat.zlc-open .zlc-ico-close { display: block; }
#zen-livechat .zlc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: #e5484d;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid #fff;
}
#zen-livechat .zlc-badge[hidden] { display: none; }
/* 안 본 말풍선 표시 점 */
#zen-livechat .zlc-dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #e5484d;
	border: 2px solid #fff;
}
#zen-livechat .zlc-dot[hidden] { display: none; }

/* 닫힌 버튼 옆 말풍선: 버튼 세로 가운데에 맞춘다 */
#zen-livechat .zlc-teaser {
	position: absolute;
	bottom: 10px;
	display: flex;
	align-items: center;
	max-width: calc(100vw - var(--zlc-x) - 96px);
	height: 40px;
	padding: 0 6px 0 18px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}
#zen-livechat.zlc-right .zlc-teaser { right: 72px; }
#zen-livechat.zlc-left .zlc-teaser { left: 72px; }
#zen-livechat .zlc-teaser.zlc-teaser-in { opacity: 1; transform: none; pointer-events: auto; }
#zen-livechat.zlc-open .zlc-teaser { display: none; }
#zen-livechat .zlc-teaser-text {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #1f2328;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#zen-livechat .zlc-teaser-x {
	flex: none;
	width: 26px;
	height: 26px;
	margin-left: 6px;
	padding: 7px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #8b949e;
}
#zen-livechat .zlc-teaser-x:hover { background: #f1f3f5; color: #1f2328; }

/* 창 */
#zen-livechat .zlc-panel {
	position: absolute;
	bottom: 74px;
	width: 380px;
	height: min(640px, calc(100vh - var(--zlc-y) - 110px));
	display: flex;
	flex-direction: column;
	background: #f7f8fa;
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
#zen-livechat.zlc-right .zlc-panel { right: 0; }
#zen-livechat.zlc-left .zlc-panel { left: 0; transform-origin: bottom left; }
#zen-livechat.zlc-open .zlc-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .18s ease, transform .18s ease;
}

#zen-livechat .zlc-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 12px 14px 16px;
	background: var(--zlc-color);
	color: #fff;
}
#zen-livechat .zlc-avatar {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .22);
	font-size: 17px;
	font-weight: 700;
	line-height: 38px;
	text-align: center;
}
#zen-livechat .zlc-info { flex: 1 1 auto; min-width: 0; }
#zen-livechat .zlc-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#zen-livechat .zlc-status { font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#zen-livechat .zlc-status.is-on::before,
#zen-livechat .zlc-status.is-off::before {
	content: '';
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 5px;
	border-radius: 50%;
	vertical-align: 1px;
	background: #7CFC9A;
}
#zen-livechat .zlc-status.is-off::before { background: rgba(255, 255, 255, .55); }
#zen-livechat .zlc-end {
	flex: 0 0 auto;
	display: none;
	padding: 4px 10px;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: 14px;
	background: transparent;
	color: #fff;
	font-size: 12px;
}
#zen-livechat.zlc-has-room .zlc-end { display: block; }
#zen-livechat .zlc-x {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	padding: 7px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
}
#zen-livechat .zlc-x:hover { background: rgba(255, 255, 255, .15); }

/* 운영시간 보기: 머리 상태 아래 작은 링크 → 머리 밑으로 요일별 판이 펼쳐진다 */
#zen-livechat .zlc-hours-btn { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; padding: 0; border: 0; background: transparent; color: #fff; opacity: .85; font-size: 12px; cursor: pointer; }
#zen-livechat .zlc-hours-btn:hover { opacity: 1; }
#zen-livechat .zlc-hours-btn::after { content: '\203A'; display: inline-block; transition: transform .15s; }
#zen-livechat .zlc-hours-btn.open::after { transform: rotate(90deg); }
#zen-livechat .zlc-hours-panel { flex: 0 0 auto; max-height: 45%; overflow-y: auto; padding: 10px 16px 12px; border-bottom: 1px solid #eef0f3; background: #fff; font-size: 13px; }
#zen-livechat .zlc-hours-panel[hidden] { display: none; }
#zen-livechat .zlc-hours-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
#zen-livechat .zlc-hours-day { flex: 0 0 auto; color: #6b7280; }
#zen-livechat .zlc-hours-time { color: #111827; text-align: right; }
#zen-livechat .zlc-hours-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e5e7eb; font-size: 12px; color: #6b7280; white-space: pre-line; }

/* 대화 */
#zen-livechat .zlc-body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 14px 14px 8px;
}
#zen-livechat .zlc-intro {
	margin-bottom: 12px;
	padding: 14px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
#zen-livechat .zlc-greeting { white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; }
#zen-livechat .zlc-hours { margin-top: 8px; font-size: 12px; color: #6b7280; white-space: pre-line; }
/* 운영시간이 아닐 때 다음 운영 시작(시계 아이콘) */
#zen-livechat .zlc-next { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font-size: 13px; font-weight: 600; color: #4b5563; }
#zen-livechat .zlc-next::before {
	content: '';
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 3'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 3'/%3E%3C/svg%3E") center / contain no-repeat;
}
#zen-livechat .zlc-away {
	margin-top: 10px;
	padding: 8px 10px;
	border-radius: 10px;
	background: #f3f4f6;
	font-size: 13px;
	color: #4b5563;
	white-space: pre-line;
}

/* 자주 묻는 질문(상담 전 아코디언) */
#zen-livechat .zlc-faq { margin-bottom: 12px; }
#zen-livechat .zlc-faq-title { margin: 4px 2px 8px; font-size: 12px; font-weight: 700; color: #6b7280; }
#zen-livechat .zlc-faq-item { margin-bottom: 6px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; }
#zen-livechat .zlc-faq-q {
	display: block;
	width: 100%;
	margin: 0;
	padding: 11px 36px 11px 14px;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: #1f2328;
	text-align: left;
	cursor: pointer;
	position: relative;
	word-break: keep-all;
	overflow-wrap: anywhere;
}
#zen-livechat .zlc-faq-q::after {
	content: '';
	position: absolute;
	right: 15px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid #9aa0a6;
	border-bottom: 2px solid #9aa0a6;
	transform: translateY(-65%) rotate(45deg);
	transition: transform .15s ease;
}
#zen-livechat .zlc-faq-item.open .zlc-faq-q::after { transform: translateY(-30%) rotate(-135deg); }
#zen-livechat .zlc-faq-item.open .zlc-faq-q { color: var(--zlc-color); font-weight: 600; }
#zen-livechat .zlc-faq-a {
	padding: 0 14px 12px;
	font-size: 13px;
	line-height: 1.6;
	color: #4b5563;
	white-space: pre-line;
	word-break: break-word;
	overflow-wrap: anywhere;
}
#zen-livechat .zlc-faq-a[hidden] { display: none; }
#zen-livechat .zlc-faq-ask {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 10px;
	border: 1px solid var(--zlc-color);
	border-radius: 12px;
	background: transparent;
	color: var(--zlc-color);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
#zen-livechat .zlc-faq-ask:hover { background: var(--zlc-color); color: #fff; }
#zen-livechat .zlc-faq-dim .zlc-faq-ask { opacity: .4; }
#zen-livechat .zlc-day {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 8px;
	font-size: 11px;
	color: #9aa0a6;
	white-space: nowrap;
}
#zen-livechat .zlc-day::before,
#zen-livechat .zlc-day::after { content: ''; flex: 1 1 auto; height: 1px; background: rgba(0, 0, 0, .08); }
#zen-livechat .zlc-msg { display: flex; align-items: flex-end; gap: 6px; margin: 6px 0; }
#zen-livechat .zlc-me { flex-direction: row-reverse; }
#zen-livechat .zlc-bubble {
	max-width: 78%;
	padding: 9px 12px;
	border-radius: 16px;
	white-space: pre-wrap;
	word-break: break-word;
	overflow-wrap: anywhere;
}
#zen-livechat .zlc-them .zlc-bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
#zen-livechat .zlc-me .zlc-bubble { background: var(--zlc-bubble); color: #fff; border-bottom-right-radius: 4px; }
#zen-livechat .zlc-time { flex: 0 0 auto; font-size: 10px; color: #9aa0a6; white-space: nowrap; }
#zen-livechat .zlc-sys { margin: 10px auto; max-width: 90%; font-size: 12px; color: #6b7280; text-align: center; white-space: pre-line; }

#zen-livechat .zlc-restart,
#zen-livechat .zlc-contact button,
#zen-livechat .zlc-yes {
	display: block;
	margin: 10px auto;
	padding: 8px 18px;
	border: 0;
	border-radius: 18px;
	background: var(--zlc-color);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
}
#zen-livechat .zlc-contact,
#zen-livechat .zlc-confirm {
	margin: 10px 0;
	padding: 12px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
	font-size: 13px;
	text-align: center;
}
#zen-livechat .zlc-contact-q { margin-bottom: 8px; }
#zen-livechat .zlc-contact input {
	display: block;
	width: 100%;
	margin: 0 0 6px;
	padding: 8px 10px;
	border: 1px solid #d6d9de;
	border-radius: 8px;
	background: #fff;
	font: inherit;
	font-size: 14px;
	color: inherit;
}
#zen-livechat .zlc-contact input:focus { outline: 0; border-color: var(--zlc-color); }
#zen-livechat .zlc-contact button { margin-bottom: 0; }
#zen-livechat .zlc-contact-msg { margin-top: 6px; font-size: 12px; color: #c0392b; }
#zen-livechat .zlc-contact-msg:empty { display: none; }
#zen-livechat .zlc-confirm .zlc-yes,
#zen-livechat .zlc-confirm .zlc-no { display: inline-block; margin: 10px 4px 0; }
#zen-livechat .zlc-no { padding: 8px 18px; border: 1px solid #d6d9de; border-radius: 18px; background: #fff; color: #374151; font-size: 13px; }

/* 입력 */
#zen-livechat .zlc-foot {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px 10px 10px 14px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}
#zen-livechat .zlc-input {
	flex: 1 1 auto;
	min-height: 38px;
	max-height: 120px;
	margin: 0;
	padding: 8px 2px;
	border: 0;
	outline: 0;
	resize: none;
	background: transparent;
	font: inherit;
	font-size: 15px;
	color: inherit;
	box-shadow: none;
}
#zen-livechat .zlc-emoji-btn {
	flex: 0 0 auto;
	width: 34px;
	height: 38px;
	padding: 7px 4px;
	margin-left: -6px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #9aa0a6;
}
#zen-livechat .zlc-emoji-btn:hover,
#zen-livechat .zlc-emoji-btn.is-on { color: var(--zlc-color); }

/* 이모지 선택판: 대화와 입력칸 사이에 끼워 대화 영역을 줄인다 */
#zen-livechat .zlc-emoji {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	height: 220px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}
#zen-livechat .zlc-emoji[hidden] { display: none; }
#zen-livechat .zlc-emoji-tabs {
	flex: 0 0 auto;
	display: flex;
	gap: 2px;
	padding: 6px 8px 0;
	border-bottom: 1px solid #f0f1f3;
}
#zen-livechat .zlc-emoji-tab {
	width: 36px;
	height: 32px;
	padding: 0;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	font-size: 18px;
	line-height: 30px;
	opacity: .55;
}
#zen-livechat .zlc-emoji-tab.is-on { opacity: 1; border-bottom-color: var(--zlc-color); }
#zen-livechat .zlc-emoji-grid {
	flex: 1 1 auto;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
	align-content: start;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px 8px;
}
#zen-livechat .zlc-emoji-item {
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	font-size: 22px;
	line-height: 38px;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
#zen-livechat .zlc-emoji-item:hover { background: #f3f4f6; }
#zen-livechat .zlc-emoji-empty { grid-column: 1 / -1; padding: 24px 0; font-size: 13px; color: #9aa0a6; text-align: center; }

#zen-livechat .zlc-send {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	padding: 9px;
	border: 0;
	border-radius: 50%;
	background: var(--zlc-color);
	color: #fff;
}
#zen-livechat .zlc-send:disabled { opacity: .5; cursor: default; }

/* 모바일: 하단 메뉴 위로 올리고, 열면 화면을 거의 다 쓴다. 입력창 글자 16px 미만이면 iOS 가 화면을 확대한다. */
@media (max-width: 768px) {
	#zen-livechat { bottom: calc(var(--zlc-my) + env(safe-area-inset-bottom, 0px)); }
	#zen-livechat.zlc-hide-mobile { display: none; }
	/* 화면 아래 고정 바 위로(chat.js 가 바 높이를 재서 --zlc-lift 로 준다). 앱 보정·배너 규칙보다 이겨야 해서 !important */
	#zen-livechat.zlc-over-bar:not(.zlc-open) { bottom: var(--zlc-lift) !important; }
	#zen-livechat .zlc-launcher { width: 54px; height: 54px; padding: 14px; }
	#zen-livechat .zlc-teaser { bottom: 7px; }
	/* 모바일 위치·옆 여백(zlc-mleft/mright, --zlc-mx)이 PC 값을 덮는다 */
	#zen-livechat.zlc-mright { right: var(--zlc-mx); left: auto; }
	#zen-livechat.zlc-mleft { left: var(--zlc-mx); right: auto; }
	#zen-livechat.zlc-mright .zlc-launcher { margin-right: 0; }
	#zen-livechat.zlc-mleft .zlc-launcher { margin-right: auto; }
	#zen-livechat.zlc-mright .zlc-teaser { right: 64px; left: auto; max-width: calc(100vw - var(--zlc-mx) - 88px); }
	#zen-livechat.zlc-mleft .zlc-teaser { left: 64px; right: auto; max-width: calc(100vw - var(--zlc-mx) - 88px); }
	#zen-livechat .zlc-input { font-size: 16px; }
	#zen-livechat.zlc-open { top: 0; right: 0; left: 0; bottom: 0; }
	#zen-livechat.zlc-open .zlc-launcher { display: none; }
	#zen-livechat .zlc-panel {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		height: auto;
		border-radius: 0;
		padding-top: env(safe-area-inset-top, 0px);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	#zen-livechat.zlc-right .zlc-panel,
	#zen-livechat.zlc-left .zlc-panel { right: 0; left: 0; }
}
