/* Site Knowledge AI Chat – widget styles */
:root {
	--skc-primary: #2563eb;
	--skc-bg: #ffffff;
	--skc-surface: #f5f6f8;
	--skc-text: #111827;
	--skc-muted: #6b7280;
	--skc-border: #e5e7eb;
	--skc-radius: 18px;
	--skc-shadow: 0 18px 50px rgba(15, 23, 42, .22);
	--skc-z: 99999;
}

.skc-root, .skc-root * { box-sizing: border-box; }
.skc-root {
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--skc-text);
	-webkit-font-smoothing: antialiased;
}

/* Floating mode --------------------------------------------------------- */
.skc-mode-floating { position: fixed; bottom: 22px; z-index: var(--skc-z); }
.skc-pos-right.skc-mode-floating { right: 22px; }
.skc-pos-left.skc-mode-floating { left: 22px; }

.skc-launcher {
	width: 58px; height: 58px; border-radius: 50%;
	border: 0; padding: 0; cursor: pointer;
	background: var(--skc-primary); color: #fff;
	box-shadow: 0 10px 28px rgba(15, 23, 42, .28);
	display: flex; align-items: center; justify-content: center;
	transition: transform .18s ease, box-shadow .18s ease;
	position: relative;
}
.skc-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(15, 23, 42, .32); }
.skc-launcher:focus-visible { outline: 3px solid rgba(37, 99, 235, .4); outline-offset: 3px; }
.skc-launcher span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity .18s ease, transform .18s ease; }
.skc-launcher-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.skc-open .skc-launcher-open { opacity: 0; transform: rotate(90deg) scale(.6); }
.skc-open .skc-launcher-close { opacity: 1; transform: none; }

.skc-mode-floating .skc-panel {
	position: absolute; bottom: 74px;
	width: 390px; max-width: calc(100vw - 44px);
	height: 600px; max-height: calc(100vh - 120px);
	opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.skc-pos-right.skc-mode-floating .skc-panel { right: 0; }
.skc-pos-left.skc-mode-floating .skc-panel { left: 0; transform-origin: bottom left; }
.skc-mode-floating.skc-open .skc-panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

/* Inline mode ----------------------------------------------------------- */
.skc-inline { width: 100%; max-width: 100%; }
.skc-mode-inline, .skc-mode-inline .skc-panel { width: 100%; height: 100%; }

/* Panel ----------------------------------------------------------------- */
.skc-panel {
	display: flex; flex-direction: column;
	background: var(--skc-bg);
	border-radius: var(--skc-radius);
	box-shadow: var(--skc-shadow);
	overflow: hidden;
	border: 1px solid rgba(15, 23, 42, .06);
}

.skc-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 14px 14px 16px;
	background: var(--skc-primary); color: #fff;
}
.skc-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.skc-avatar {
	width: 36px; height: 36px; border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.skc-avatar svg { width: 20px; height: 20px; }
.skc-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skc-actions { display: flex; gap: 2px; }
.skc-icon-btn {
	width: 36px; height: 36px; border-radius: 10px; border: 0; padding: 0;
	background: transparent; color: #fff; cursor: pointer; opacity: .85;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s ease, opacity .15s ease;
}
.skc-icon-btn:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.skc-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.skc-messages {
	flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
	padding: 18px 16px 10px;
	background: var(--skc-surface);
	display: flex; flex-direction: column; gap: 10px;
	scroll-behavior: smooth;
}

.skc-msg { display: flex; flex-direction: column; max-width: 86%; }
.skc-msg-user { align-self: flex-end; align-items: flex-end; }
.skc-msg-assistant { align-self: flex-start; align-items: flex-start; }

.skc-bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px; line-height: 1.5;
	word-wrap: break-word; overflow-wrap: anywhere;
	white-space: normal;
}
.skc-msg-user .skc-bubble { background: var(--skc-primary); color: #fff; border-bottom-right-radius: 5px; }
.skc-msg-assistant .skc-bubble { background: var(--skc-bg); color: var(--skc-text); border: 1px solid var(--skc-border); border-bottom-left-radius: 5px; }
.skc-msg-user .skc-bubble a { color: #fff; text-decoration: underline; }
.skc-msg-assistant .skc-bubble a { color: var(--skc-primary); text-decoration: underline; }

.skc-msg-notice {
	align-self: center; max-width: 90%;
	font-size: 12.5px; color: #991b1b;
	background: #fee2e2; border-radius: 10px; padding: 7px 12px; text-align: center;
}

.skc-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--skc-muted); align-items: center; }
.skc-sources-label { margin-right: 2px; }
.skc-source {
	color: var(--skc-primary); text-decoration: none;
	background: var(--skc-bg); border: 1px solid var(--skc-border);
	border-radius: 999px; padding: 2px 10px;
	max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.skc-source:hover { border-color: var(--skc-primary); }

.skc-typing .skc-bubble { display: flex; gap: 5px; padding: 13px 16px; }
.skc-typing span {
	width: 7px; height: 7px; border-radius: 50%; background: var(--skc-muted);
	animation: skc-bounce 1.2s infinite ease-in-out;
}
.skc-typing span:nth-child(2) { animation-delay: .15s; }
.skc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes skc-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

.skc-form {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--skc-border);
	background: var(--skc-bg);
	margin: 0;
}
.skc-input {
	flex: 1 1 auto; resize: none;
	min-height: 42px; max-height: 120px;
	padding: 10px 14px;
	border: 1px solid var(--skc-border); border-radius: 14px;
	background: var(--skc-surface); color: var(--skc-text);
	font: inherit; font-size: 14.5px; line-height: 1.4;
	outline: none; margin: 0; box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.skc-input:focus { border-color: var(--skc-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); background: var(--skc-bg); }
.skc-input::placeholder { color: var(--skc-muted); }
.skc-send {
	flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
	border: 0; padding: 0; cursor: pointer;
	background: var(--skc-primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
	transition: transform .15s ease, opacity .15s ease;
}
.skc-send:hover { transform: scale(1.05); }
.skc-send:disabled { opacity: .5; cursor: default; transform: none; }
.skc-send svg { margin-left: 2px; }

.skc-footer {
	padding: 6px 12px 9px;
	font-size: 11px; text-align: center; color: var(--skc-muted);
	background: var(--skc-bg);
}

/* Mobile ---------------------------------------------------------------- */
@media (max-width: 520px) {
	.skc-mode-floating.skc-open .skc-panel {
		position: fixed; inset: 0;
		width: 100%; max-width: none; height: 100%; max-height: none;
		border-radius: 0; border: 0;
	}
	.skc-mode-floating .skc-panel { transform-origin: center bottom; }
	.skc-open .skc-launcher { display: none; }
	.skc-msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
	.skc-root * { transition: none !important; animation-duration: 0s !important; }
}
