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

.aisc-toggle {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	padding: 0;
	overflow: hidden;
	cursor: grab;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	background: #fff;
	touch-action: none;
}

.aisc-toggle.dragging {
	cursor: grabbing;
}

.aisc-toggle.aisc-shake {
	animation: aisc-vibrate 0.6s ease-in-out;
}

@keyframes aisc-vibrate {
	0%, 100% { transform: translate(0, 0) rotate(0); }
	10% { transform: translate(-3px, -2px) rotate(-6deg); }
	20% { transform: translate(3px, 2px) rotate(6deg); }
	30% { transform: translate(-3px, 2px) rotate(-4deg); }
	40% { transform: translate(3px, -2px) rotate(4deg); }
	50% { transform: translate(-2px, -1px) rotate(-2deg); }
	60% { transform: translate(2px, 1px) rotate(2deg); }
	70% { transform: translate(-2px, 1px) rotate(-1deg); }
	80% { transform: translate(2px, -1px) rotate(1deg); }
	90% { transform: translate(-1px, 0) rotate(0); }
}

.aisc-toggle img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	-webkit-user-drag: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.aisc-window {
	position: fixed;
	bottom: 96px;
	right: 20px;
	width: 340px;
	max-width: calc(100vw - 32px);
	height: 480px;
	max-height: calc(100vh - 140px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.aisc-window[hidden] {
	display: none;
}

.aisc-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: #1f2937;
	color: #fff;
}

.aisc-header-photo {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.aisc-header-info {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
	flex: 1;
}

.aisc-header-info span {
	font-size: 12px;
	opacity: 0.75;
}

.aisc-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
}

.aisc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f5f6f8;
}

.aisc-msg {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.aisc-msg.user {
	align-self: flex-end;
	background: #2563eb;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.aisc-msg.bot {
	align-self: flex-start;
	background: #fff;
	color: #111;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}

.aisc-msg.typing {
	font-style: italic;
	opacity: 0.6;
}

.aisc-msg.bot a {
	color: #2563eb;
	text-decoration: underline;
	word-break: break-all;
}

.aisc-form {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}

.aisc-form textarea {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	max-height: 80px;
}

.aisc-form button {
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0 14px;
	cursor: pointer;
	font-size: 16px;
}

@media (max-width: 480px) {
	.aisc-window {
		right: 16px;
		width: calc(100vw - 32px);
	}
}
