/*
 * 슬기 챗봇 위젯 스타일
 * - 이 파일 안의 모든 선택자는 .seulgi-chat-widget 로 시작하는 위젯 전용 클래스만 사용한다.
 * - .alignwide 등 워드프레스 전역 공유 클래스는 절대 건드리지 않는다.
 * - 사이트 전역 여백 원칙(20px)을 패널 내부 여백에 적용한다.
 */

.seulgi-chat-widget,
.seulgi-chat-widget * {
	box-sizing: border-box;
}

.seulgi-chat-widget {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

/* 플로팅 토글 버튼 */
.seulgi-chat-toggle {
	width: 56px;
	height: 56px;
	min-width: 44px;
	min-height: 44px;
	border-radius: 50%;
	background: #333333;
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	font-size: 24px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
	transition: background 0.2s ease;
}

.seulgi-chat-toggle:hover,
.seulgi-chat-toggle:focus-visible {
	background: #4a4a4a;
}

.seulgi-chat-toggle:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

/* 토글 버튼 안 아이콘/닫기 표시 전환용 */
.seulgi-chat-toggle .seulgi-chat-toggle-icon-open {
	display: inline-block;
}
.seulgi-chat-toggle .seulgi-chat-toggle-icon-close {
	display: none;
}
.seulgi-chat-widget.is-open .seulgi-chat-toggle .seulgi-chat-toggle-icon-open {
	display: none;
}
.seulgi-chat-widget.is-open .seulgi-chat-toggle .seulgi-chat-toggle-icon-close {
	display: inline-block;
}

/* 채팅 패널 */
.seulgi-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(56px + 12px);
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #000000;
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.seulgi-chat-widget:not(.is-open) .seulgi-chat-panel {
	display: none;
}

/* 헤더 */
.seulgi-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
}

.seulgi-chat-title-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
}

.seulgi-chat-title {
	font-size: 16px;
	font-weight: 800;
	color: #ffffff;
	margin: 0;
}

.seulgi-chat-clock {
	font-size: 12px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.6);
}

.seulgi-chat-close {
	background: transparent;
	border: none;
	color: #ffffff;
	font-size: 20px;
	line-height: 1;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 6px;
}

.seulgi-chat-close:hover,
.seulgi-chat-close:focus-visible {
	background: #333333;
}

.seulgi-chat-close:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: -2px;
}

/* 메시지 영역 */
.seulgi-chat-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.seulgi-chat-bubble {
	max-width: 80%;
	padding: 12px 16px;
	border-radius: 14px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	word-break: break-word;
	white-space: pre-wrap;
}

.seulgi-chat-bubble--bot {
	align-self: flex-start;
	background: #1a1a1a;
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-bottom-left-radius: 4px;
}

.seulgi-chat-bubble--user {
	align-self: flex-end;
	background: #333333;
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.seulgi-chat-bubble--loading {
	align-self: flex-start;
	background: #1a1a1a;
	color: #999999;
	border: 1px solid rgba(255, 255, 255, 0.2);
	font-style: italic;
}

.seulgi-chat-bubble--error {
	align-self: flex-start;
	background: #1a1a1a;
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 입력 영역 */
.seulgi-chat-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
}

.seulgi-chat-input {
	flex: 1 1 auto;
	resize: none;
	min-height: 44px;
	max-height: 96px;
	padding: 10px 14px;
	background: #1a1a1a;
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
}

.seulgi-chat-input::placeholder {
	color: #999999;
}

.seulgi-chat-input:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 1px;
}

.seulgi-chat-send {
	flex-shrink: 0;
	min-width: 44px;
	min-height: 44px;
	padding: 0 16px;
	background: #333333;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease;
}

.seulgi-chat-send:hover,
.seulgi-chat-send:focus-visible {
	background: #4a4a4a;
}

.seulgi-chat-send:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.seulgi-chat-send:disabled {
	background: #333333;
	color: #999999;
	cursor: not-allowed;
}

/* 스크롤바(선택적, 크로미움 계열) */
.seulgi-chat-messages::-webkit-scrollbar {
	width: 6px;
}
.seulgi-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
}

/* 모바일 대응 (600px 이하) */
@media (max-width: 600px) {
	.seulgi-chat-widget {
		right: 12px;
		bottom: 12px;
	}

	.seulgi-chat-panel {
		width: calc(100vw - 24px);
		max-width: calc(100vw - 24px);
		height: calc(100vh - 100px);
		max-height: calc(100vh - 100px);
		bottom: calc(56px + 12px);
		right: 0;
	}

	.seulgi-chat-header,
	.seulgi-chat-messages,
	.seulgi-chat-input-row {
		padding: 16px;
	}
}
