/**
 * CSKYUAV-AIBOT widget styles.
 * Scoped under .cks-aibot to avoid clashing with the theme.
 */

.cks-aibot {
	position: fixed;
	bottom: 20px;
	inset-inline-end: 20px;
	z-index: 99999;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

/* Author rules (display:flex / display:inline-flex) outrank the UA [hidden]
   rule. Without this, the panel and typing dots are ALWAYS visible and the
   widget cannot start collapsed. */
.cks-aibot [hidden] { display: none !important; }

/* ---- launcher ---------------------------------------------------------- */
.cks-aibot__launcher {
	position: relative;
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #6a5cff, #22c1dc);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(30, 30, 60, .35);
	display: grid;
	place-items: center;
	transition: transform .15s ease;
}
.cks-aibot__launcher:hover { transform: translateY(-2px); }
.cks-aibot__launcher-icon { font-size: 24px; line-height: 1; }
.cks-aibot__launcher-dot {
	position: absolute;
	top: 2px;
	inset-inline-end: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #ffd60a;
	border: 2px solid #fff;
}

/* ---- teaser ------------------------------------------------------------ */
.cks-aibot__teaser {
	position: absolute;
	bottom: 68px;
	inset-inline-end: 0;
	max-width: 240px;
	padding: 10px 14px;
	border: 0;
	border-radius: 14px 14px 2px 14px;
	background: #fff;
	color: #1c1c2b;
	box-shadow: 0 8px 24px rgba(20, 20, 50, .22);
	cursor: pointer;
	text-align: start;
	animation: cks-aibot-pop .25s ease;
}
@keyframes cks-aibot-pop {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ---- panel ------------------------------------------------------------- */
.cks-aibot__panel {
	position: absolute;
	bottom: 68px;
	inset-inline-end: 0;
	width: min(360px, calc(100vw - 32px));
	height: min(520px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 16px 48px rgba(15, 15, 40, .3);
}

.cks-aibot__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: linear-gradient(135deg, #6a5cff, #22c1dc);
	color: #fff;
}
.cks-aibot__avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	display: grid;
	place-items: center;
	font-size: 20px;
}
.cks-aibot__head-text { flex: 1; min-width: 0; }
.cks-aibot__head-name { font-weight: 700; }
.cks-aibot__head-status { font-size: 11px; opacity: .85; }
.cks-aibot__close {
	background: none;
	border: 0;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	padding: 4px 8px;
}

.cks-aibot__body {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f6f7fb;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cks-aibot__msg {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}
.cks-aibot__msg--bot,
.cks-aibot__msg--agent {
	align-self: flex-start;
	background: #fff;
	color: #1c1c2b;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 3px rgba(20, 20, 50, .08);
}
.cks-aibot__msg--agent { border-inline-start: 3px solid #f4a900; }
.cks-aibot__msg--user {
	align-self: flex-end;
	background: #6a5cff;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.cks-aibot__typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px;
}
.cks-aibot__typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa0b5;
	animation: cks-aibot-blink 1.2s infinite;
}
.cks-aibot__typing span:nth-child(2) { animation-delay: .2s; }
.cks-aibot__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cks-aibot-blink {
	0%, 60%, 100% { opacity: .3; }
	30% { opacity: 1; }
}

/* ---- chips ------------------------------------------------------------- */
.cks-aibot__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 12px;
	background: #f6f7fb;
}
.cks-aibot__chip {
	border: 1px solid #d9dcea;
	background: #fff;
	color: #4a4a68;
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 12px;
	cursor: pointer;
}
.cks-aibot__chip:hover { border-color: #6a5cff; color: #6a5cff; }

/* ---- form -------------------------------------------------------------- */
.cks-aibot__form {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #eceef5;
}
.cks-aibot__input {
	flex: 1;
	min-width: 0;
	border: 1px solid #d9dcea;
	border-radius: 10px;
	padding: 9px 12px;
	font: inherit;
	outline: none;
}
.cks-aibot__input:focus { border-color: #6a5cff; }
.cks-aibot__send {
	width: 40px;
	border: 0;
	border-radius: 10px;
	background: #6a5cff;
	color: #fff;
	cursor: pointer;
	font-size: 16px;
}
.cks-aibot__send:hover { background: #5847e6; }

/* ---- pre-chat inquiry form --------------------------------------------- */
.cks-aibot__lead {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px 16px 16px;
	background: #fff;
}
.cks-aibot__lead-title { margin: 0 0 6px; font-size: 15px; color: #1c2033; }
.cks-aibot__lead-intro { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #6b7186; }
.cks-aibot__lead-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cks-aibot__lead-label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #4a5064; }
.cks-aibot__lead-label:last-of-type { grid-column: 1 / -1; }
.cks-aibot__lead-field {
	box-sizing: border-box;
	width: 100%;
	border: 1px solid #d9dcea;
	border-radius: 8px;
	padding: 7px 9px;
	font: inherit;
	font-size: 13px;
	outline: none;
}
.cks-aibot__lead-field:focus { border-color: #6a5cff; }
textarea.cks-aibot__lead-field { resize: vertical; min-height: 48px; }
.cks-aibot__lead-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.cks-aibot__lead-err {
	grid-column: 1 / -1;
	background: #fff2f2;
	border: 1px solid #ffd4d4;
	border-radius: 6px;
	padding: 6px 9px;
	color: #b42318;
	font-size: 12px;
}
.cks-aibot__lead-submit {
	grid-column: 1 / -1;
	border: 0;
	border-radius: 9px;
	background: #6a5cff;
	color: #fff;
	font-size: 13px;
	padding: 9px 12px;
	cursor: pointer;
}
.cks-aibot__lead-submit:hover { background: #5847e6; }
.cks-aibot__lead-skip {
	grid-column: 1 / -1;
	border: 1px solid #d7d9e6;
	border-radius: 9px;
	background: #fff;
	color: #4a5064;
	font-size: 12px;
	padding: 8px 12px;
	cursor: pointer;
}
.cks-aibot__lead-skip:hover { background: #f4f5fa; }
.cks-aibot__lead-submit:disabled,
.cks-aibot__send:disabled { opacity: .55; cursor: default; }
.cks-aibot__input:disabled { background: #f4f5fa; cursor: not-allowed; }
@media (max-width: 480px) {
	.cks-aibot__lead-form { grid-template-columns: 1fr; }
}

/* ---- RTL --------------------------------------------------------------- */
.cks-aibot--rtl .cks-aibot__msg--bot { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.cks-aibot--rtl .cks-aibot__msg--user { border-bottom-left-radius: 4px; border-bottom-right-radius: 14px; }

/* ---- mobile ------------------------------------------------------------ */
@media (max-width: 480px) {
	.cks-aibot { bottom: 14px; inset-inline-end: 14px; }
	.cks-aibot__panel {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
	}
	.cks-aibot__teaser { max-width: 200px; }
}
