/**
 * 고객 채팅 위젯 — 인디고 계열 프리미엄 UI
 */
:root {
	--indigo-950: #1e1b4b;
	--indigo-900: #312e81;
	--indigo-800: #3730a3;
	--indigo-700: #4338ca;
	--indigo-600: #4f46e5;
	--indigo-500: #6366f1;
	--indigo-400: #818cf8;
	--indigo-100: #e0e7ff;
	--indigo-50: #eef2ff;
	--surface: #f4f6fb;
	--surface-elevated: #ffffff;
	--text-primary: #0f172a;
	--text-muted: #64748b;
	--shadow-sm: 0 1px 2px rgba(30, 27, 75, 0.06);
	--shadow-md: 0 4px 14px rgba(49, 46, 129, 0.12);
	--shadow-lg: 0 12px 40px rgba(30, 27, 75, 0.14);
	/* 카카오톡 대화방 톤 */
	--kakao-room-bg: #b2c7d9;
	--kakao-bubble-them: #ffffff;
	--kakao-bubble-me: #fee500;
	--kakao-text-me: #191919;
	--kakao-text-them: #000000;
	--kakao-bubble-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
	--radius-bubble-in: 4px 18px 18px 18px;
	--radius-bubble-out: 18px 4px 18px 18px;
	--font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: var(--kakao-room-bg);
	font-family: var(--font);
	color: var(--text-primary);
	-webkit-font-smoothing: antialiased;
}

body.supportchat-user-body {
	display: flex !important;
	flex-direction: column !important;
	min-height: 100vh;
	min-height: 100dvh;
	box-sizing: border-box;
}

.supportchat-user-body #chatContent {
	display: flex !important;
	flex-direction: column !important;
	justify-content: flex-start !important;
	align-items: stretch !important;
	flex: 0 0 auto;
	width: 100%;
	min-height: 0;
}

.supportchat-user-body .messageStyle {
	flex-shrink: 0;
}

.supportchat-user-body .chatContentView {
	flex: 1 1 auto;
	min-height: 0;
}

input:focus,
textarea:focus {
	outline: none;
	outline-offset: 0;
}

a,
textarea {
	text-decoration: none;
	color: inherit;
}

* {
	margin: 0;
	padding: 0;
	outline: none;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	box-sizing: border-box;
}

::-webkit-scrollbar {
	width: 6px;
}

::-webkit-scrollbar-thumb {
	background: rgba(79, 70, 229, 0.35);
	border-radius: 10px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-ms-scrollbar {
	width: 8px;
}

::-ms-scrollbar-thumb {
	background: var(--indigo-400);
	border-radius: 10px;
}

/* 메시지 행 */
.messageStyle {
	margin: 12px 14px;
	height: auto;
	overflow: hidden;
}

.messageStyle::after {
	content: "";
	display: table;
	clear: both;
}

.fade {
	opacity: 0;
	animation: fadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.messageView1_left {
	float: left;
	width: 42px;
	height: 42px;
}

.messageView1_right {
	float: right;
	width: 42px;
	height: 42px;
	margin-right: 2px;
	text-align: right;
}

.messageView2V_left {
	float: left;
	max-width: calc(100% - 84px);
	height: auto;
	overflow: visible;
}

.messageView2_left {
	float: left;
	clear: left;
	max-width: calc(100% - 0px);
	height: auto;
	overflow: visible;
	display: flow-root;
	text-align: left;
}

.messageView2V_right {
	float: right;
	max-width: calc(100% - 84px);
	height: auto;
	overflow: visible;
}

.messageView2_right {
	float: right;
	clear: right;
	max-width: calc(100% - 0px);
	height: auto;
	overflow: visible;
	display: flow-root;
	text-align: right;
}

/* 상담원 말풍선 — 카카오 '상대' 흰 말풍선 */
.messageContent_left {
	display: inline-block;
	vertical-align: top;
	max-width: min(100%, 78vw);
	padding: 10px 14px 9px;
	min-height: 20px;
	border-radius: var(--radius-bubble-in);
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	font-size: 15px;
	line-height: 1.4;
	letter-spacing: -0.02em;
	font-weight: 400;
	background: var(--kakao-bubble-them);
	color: var(--kakao-text-them);
	border: none;
	box-shadow: var(--kakao-bubble-shadow);
	text-align: left;
}

/* 내 말풍선 — 카카오 노란 말풍선 */
.messageContent_right {
	display: inline-block;
	vertical-align: top;
	max-width: min(100%, 78vw);
	padding: 10px 14px 9px;
	min-height: 20px;
	border-radius: var(--radius-bubble-out);
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	font-size: 15px;
	line-height: 1.4;
	letter-spacing: -0.02em;
	font-weight: 400;
	background: var(--kakao-bubble-me);
	color: var(--kakao-text-me);
	border: none;
	box-shadow: none;
	text-align: left;
}

.messagePicture_left {
	display: inline-block;
	vertical-align: top;
	max-width: min(100%, 78vw);
	padding: 4px;
	min-height: 20px;
	border-radius: var(--radius-bubble-in);
	background: var(--kakao-bubble-them);
	overflow: hidden;
	border: none;
	box-shadow: var(--kakao-bubble-shadow);
}

.messagePicture_right {
	display: inline-block;
	vertical-align: top;
	max-width: min(100%, 78vw);
	padding: 4px;
	min-height: 20px;
	border-radius: var(--radius-bubble-out);
	background: var(--kakao-bubble-me);
	overflow: hidden;
	box-shadow: none;
}

.messageView2VT1 {
	height: auto;
	min-height: 20px;
	line-height: 1.3;
	font-size: 12px;
	margin-bottom: 4px;
}

/* 상담원 이름 */
.messageView2VT1 span:first-child {
	color: rgba(0, 0, 0, 0.55);
	font-weight: 600;
}

.messageView2VT2 {
	margin: 0 0 0 8px;
	font-size: 11px;
	font-weight: 500;
	color: rgba(0, 0, 0, 0.38);
	letter-spacing: 0.02em;
}

.messageView2VT1[style*="right"] .messageView2VT2 {
	color: rgba(0, 0, 0, 0.38);
}

.avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #fff;
	box-shadow: 0 2px 10px rgba(79, 70, 229, 0.22);
}

.messageView1_right .avatar {
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	border-color: rgba(255, 255, 255, 0.9);
}

.pictureStyle {
	width: 100%;
	border-radius: 12px;
	display: block;
}

.fl {
	float: left;
}
.fr {
	float: right;
}

/* 전체 레이아웃 — 대화 영역은 카카오톡 방 배경색 */
.chatContainer {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	background: var(--kakao-room-bg);
	overflow: hidden;
}

.chatHeader {
	position: relative;
	overflow: hidden;
	color: #fff;
	background: linear-gradient(125deg, var(--indigo-900) 0%, var(--indigo-700) 45%, var(--indigo-600) 100%);
	box-shadow: var(--shadow-md);
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.chatHeader::after {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse 80% 120% at 100% -20%, rgba(255, 255, 255, 0.15), transparent 55%);
	pointer-events: none;
}

.chatHeader-inner {
	position: relative;
	z-index: 1;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 16px;
	box-sizing: border-box;
}

.chatHeader-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
	flex: 1;
}

.chatHeader-avatarWrap {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.18);
	backdrop-filter: blur(8px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chatHeader_pc {
	min-height: 56px;
}

.chatHeader_mb {
	min-height: 48px;
}

.chatHeader_pc .chatHeader-inner {
	min-height: 56px;
}

.chatHeader_mb .chatHeader-inner {
	min-height: 48px;
	padding: 0 12px;
}

.chatHeader_mb .chatHeader-avatarWrap {
	width: 34px;
	height: 34px;
	border-radius: 12px;
}

.chatHeader_mb .chatHeader-hours {
	height: 34px;
	min-height: 34px;
	font-size: 10px;
	padding: 0 10px;
	line-height: 1;
}

.chatHeaderP {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 10px;
}

.chatHeaderP_pc {
	width: 28px;
	height: 28px;
	margin: 0;
	float: none;
	border-radius: 8px;
}

.chatHeaderP_mb {
	width: 24px;
	height: 24px;
	margin: 0;
	float: none;
	border-radius: 6px;
}

.chatHeaderT {
	font-weight: 700;
	letter-spacing: -0.02em;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0;
	padding: 0;
	display: inline-flex;
	align-items: center;
	line-height: 1.2;
}

.chatHeaderT_pc {
	float: none;
	width: auto;
	max-width: min(52%, 220px);
	height: auto;
	font-size: 15px;
	font-weight: 700;
}

.chatHeaderT_mb {
	float: none;
	max-width: 42vw;
	height: auto;
	font-size: 14px;
	font-weight: 700;
}

.chatHeader-inner .chatHeader-hours.cstime {
	margin: 0;
	vertical-align: unset;
}

.chatHeader-hours {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	height: 40px;
	min-height: 40px;
	padding: 0 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.22);
	white-space: nowrap;
	box-sizing: border-box;
	font-size: 11px;
	font-weight: 600;
	opacity: 0.92;
	letter-spacing: 0.02em;
	line-height: 1;
}

.chatContentView {
	flex: 1;
	padding: 12px 0 10px;
	overflow-x: hidden;
	overflow-y: auto;
	background: transparent;
}

#chatContent {
	height: auto;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* 입력 영역 — 첨부·입력·전송 한 줄 중앙 정렬 */
.chatInput_pc {
	display: flex;
	align-items: center;
	padding: 14px 14px max(20px, env(safe-area-inset-bottom, 0px));
	gap: 8px;
	background: var(--surface-elevated);
	border-top: 1px solid rgba(99, 102, 241, 0.1);
	box-shadow: 0 -4px 24px rgba(30, 27, 75, 0.06);
}

.chatInput_mb {
	display: flex;
	align-items: center;
	padding: 8px 10px max(10px, env(safe-area-inset-bottom, 0px));
	gap: 6px;
	background: var(--surface-elevated);
	border-top: 1px solid rgba(99, 102, 241, 0.1);
	box-shadow: 0 -4px 24px rgba(30, 27, 75, 0.06);
}

.sendPictureView {
	display: flex;
	margin-right: 0;
	text-align: center;
	align-items: center;
	align-self: center;
	flex-shrink: 0;
}

.sendPicture {
	width: 36px;
	height: 36px;
	min-width: 36px;
	min-height: 36px;
	border-radius: 10px;
	background: var(--indigo-50);
	border: 1px solid rgba(99, 102, 241, 0.2);
	color: var(--indigo-600);
	font-size: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.sendPicture:hover {
	background: var(--indigo-100);
	color: var(--indigo-800);
	transform: translateY(-1px);
	box-shadow: var(--shadow-sm);
}

.sendPicture:active {
	transform: scale(0.96);
}

.textContent {
	flex: 1;
	align-self: center;
	min-width: 0;
	border: 1px solid rgba(99, 102, 241, 0.18);
	border-radius: 18px;
	padding: 6px 12px;
	font-size: 13px;
	outline: none;
	resize: none;
	min-height: 36px;
	max-height: 100px;
	height: 36px;
	line-height: 22px;
	transition: border-color 0.2s, box-shadow 0.2s, height 0.15s ease;
	font-family: var(--font);
	font-weight: 500;
	background: #fafbff;
	color: var(--text-primary);
	overflow-y: auto;
}

.textContent::placeholder {
	color: #94a3b8;
	font-weight: 400;
}

.textContent:focus {
	border-color: var(--indigo-500);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
	background: #fff;
}

.sendText {
	width: 36px;
	height: 36px;
	min-width: 36px;
	min-height: 36px;
	align-self: center;
	flex-shrink: 0;
	border-radius: 10px;
	background: linear-gradient(145deg, var(--indigo-600), var(--indigo-500));
	color: #fff;
	border: none;
	margin-left: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
	box-shadow: 0 3px 12px rgba(79, 70, 229, 0.38);
	font-size: 13px;
}

.sendText:hover {
	filter: brightness(1.06);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.sendText:active {
	transform: scale(0.96);
}

.chatContentView::-webkit-scrollbar {
	width: 6px;
}

.chatContentView::-webkit-scrollbar-track {
	background: transparent;
}

.chatContentView::-webkit-scrollbar-thumb {
	background: rgba(79, 70, 229, 0.3);
	border-radius: 10px;
}

.chatContentView::-webkit-scrollbar-thumb:hover {
	background: rgba(79, 70, 229, 0.45);
}

/* ---------- iframe·모바일 좁은 폭 (서버는 pc로 줘도 뷰포트만 좁을 때) ---------- */
@media (max-width: 480px) {
	.messageStyle {
		margin: 10px 10px;
	}

	.messageView1_left,
	.messageView1_right {
		width: 38px;
		height: 38px;
	}

	.messageView2V_left,
	.messageView2V_right {
		max-width: calc(100% - 76px);
	}

	.avatar {
		width: 32px;
		height: 32px;
	}

	.messageContent_left,
	.messageContent_right {
		font-size: 13px;
		padding: 9px 12px;
	}

	.chatHeader_pc .chatHeader-inner,
	.chatHeader_mb .chatHeader-inner {
		padding: 0 10px;
		gap: 8px;
	}

	.chatHeader_pc .chatHeaderT_pc,
	.chatHeader_mb .chatHeaderT_mb {
		font-size: 14px;
		max-width: min(52vw, 200px);
	}

	.chatHeader-hours,
	.chatHeader_mb .chatHeader-hours {
		font-size: 10px;
		padding: 0 8px;
		height: 36px;
		min-height: 36px;
		line-height: 1;
	}

	.chatInput_pc,
	.chatInput_mb {
		padding: 10px 10px max(14px, env(safe-area-inset-bottom, 0px));
		gap: 6px;
	}

	.sendPicture,
	.sendText {
		width: 40px;
		height: 40px;
		min-width: 40px;
		min-height: 40px;
	}

	.textContent {
		font-size: 16px; /* iOS 줌 방지용 최소 권장 */
		min-height: 40px;
		height: 40px;
		line-height: 24px;
		padding: 7px 12px;
	}
}

@media (max-width: 360px) {
	.messageView2V_left,
	.messageView2V_right {
		max-width: calc(100% - 68px);
	}

	.chatHeaderT_pc,
	.chatHeaderT_mb {
		max-width: 40vw;
	}
}
