.skc-chat-widget {
	--skc-primary: #2563eb;
	--skc-on-primary: #ffffff;
	--skc-surface: #ffffff;
	--skc-text: #1f2328;
	--skc-border: #e2e5e9;
	--skc-bg-user: var(--skc-primary);
	--skc-bg-assistant: #f2f3f5;
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.skc-chat-widget.skc-position-bottom-right { right: 20px; }
.skc-chat-widget.skc-position-bottom-left { left: 20px; }

.skc-chat-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--skc-primary);
	color: var(--skc-on-primary);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
	transition: transform 0.15s ease;
}

.skc-chat-toggle:hover { transform: scale(1.05); }

.skc-chat-toggle:focus-visible {
	outline: 3px solid #ffffff;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--skc-primary);
}

.skc-chat-panel {
	position: absolute;
	bottom: 76px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 560px;
	max-height: calc(100vh - 140px);
	background: var(--skc-surface);
	color: var(--skc-text);
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--skc-border);
}

.skc-position-bottom-right .skc-chat-panel { right: 0; }
.skc-position-bottom-left .skc-chat-panel { left: 0; }

.skc-chat-panel[hidden] { display: none; }

.skc-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--skc-primary);
	color: var(--skc-on-primary);
	flex-shrink: 0;
}

.skc-chat-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.skc-chat-title {
	font-size: 16px;
	margin: 0;
	flex-grow: 1;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.skc-chat-header-actions {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.skc-chat-icon-btn {
	background: transparent;
	border: none;
	color: var(--skc-on-primary);
	cursor: pointer;
	padding: 6px;
	border-radius: 6px;
	display: flex;
}

.skc-chat-icon-btn:hover { background: rgba(255, 255, 255, 0.15); }

.skc-chat-icon-btn:focus-visible,
.skc-chat-send:focus-visible,
.skc-chat-input:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.skc-chat-messages {
	flex-grow: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.skc-message {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	line-height: 1.45;
	font-size: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.skc-message-user {
	align-self: flex-end;
	background: var(--skc-bg-user);
	color: var(--skc-on-primary);
	border-bottom-right-radius: 4px;
}

.skc-message-assistant {
	align-self: flex-start;
	background: var(--skc-bg-assistant);
	color: var(--skc-text);
	border-bottom-left-radius: 4px;
}

.skc-message-error {
	align-self: flex-start;
	background: #fdecea;
	color: #611a15;
	border: 1px solid #f5c6cb;
}

.skc-message-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 12px 14px;
	background: var(--skc-bg-assistant);
	border-radius: 14px;
}

.skc-message-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa0a6;
	animation: skc-typing 1.2s infinite ease-in-out;
}

.skc-message-typing span:nth-child(2) { animation-delay: 0.2s; }
.skc-message-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes skc-typing {
	0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}

.skc-message-sources {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	font-size: 12px;
}

.skc-message-sources ul {
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
}

.skc-message-sources a {
	color: var(--skc-primary);
	text-decoration: underline;
}

.skc-chat-privacy {
	font-size: 11px;
	color: #6b7280;
	padding: 0 16px 6px;
	margin: 0;
	flex-shrink: 0;
}

.skc-chat-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--skc-border);
	flex-shrink: 0;
}

.skc-chat-input {
	flex-grow: 1;
	resize: none;
	max-height: 100px;
	border: 1px solid var(--skc-border);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
}

.skc-chat-send {
	background: var(--skc-primary);
	color: var(--skc-on-primary);
	border: none;
	border-radius: 10px;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.skc-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

@media (max-width: 480px) {
	.skc-chat-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 110px);
		bottom: 76px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.skc-chat-toggle,
	.skc-message-typing span {
		transition: none;
		animation: none;
	}
}
