#wpckb-chat-root {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#wpckb-chat-root.wpckb-position-bottom-right {
	right: 20px;
}

#wpckb-chat-root.wpckb-position-bottom-left {
	left: 20px;
}

.wpckb-toggle {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--wpckb-color, #2563eb);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	padding: 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpckb-toggle:hover {
	filter: brightness(1.05);
}

.wpckb-toggle-avatar {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 20%;
	animation: wpckb-idle-float 3.2s ease-in-out infinite;
}

.wpckb-header-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	object-position: 50% 20%;
	overflow: hidden;
	flex: none;
}

@keyframes wpckb-idle-float {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50% { transform: translateY(-3px) rotate(-2deg); }
}

@keyframes wpckb-wave {
	0%, 100% { transform: rotate(0deg) scale(1); }
	15% { transform: rotate(-6deg) scale(1.02); }
	30% { transform: rotate(5deg) scale(1.02); }
	45% { transform: rotate(-5deg) scale(1.02); }
	60% { transform: rotate(4deg) scale(1.02); }
	75% { transform: rotate(-2deg) scale(1.01); }
}

.wpckb-wave-anim {
	animation: wpckb-wave 1.1s ease-in-out 2;
	transform-origin: 50% 90%;
}

.wpckb-panel {
	position: absolute;
	bottom: 74px;
	/* .wpckb-greet-overlay se ancla a este contenedor (position: relative más abajo) */
	width: 360px;
	max-width: 90vw;
	height: 500px;
	max-height: 75vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

#wpckb-chat-root.wpckb-position-bottom-right .wpckb-panel {
	right: 0;
}

#wpckb-chat-root.wpckb-position-bottom-left .wpckb-panel {
	left: 0;
}

.wpckb-panel.wpckb-open {
	display: flex;
}

.wpckb-header {
	background: var(--wpckb-color, #2563eb);
	color: #fff;
	padding: 10px 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.wpckb-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpckb-header-right {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: none;
}

.wpckb-header button {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
}

.wpckb-close-btn,
.wpckb-mute-btn {
	font-size: 18px;
	padding: 2px 4px;
	opacity: 0.9;
}

.wpckb-close-btn:hover,
.wpckb-mute-btn:hover {
	opacity: 1;
}

.wpckb-lang-toggle {
	display: flex;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	padding: 2px;
}

.wpckb-lang-toggle button {
	font-size: 11px !important;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 999px;
	color: rgba(255, 255, 255, 0.85);
}

.wpckb-lang-toggle button.wpckb-lang-active {
	background: #fff;
	color: var(--wpckb-color, #2563eb);
}

.wpckb-greet-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	background: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.35s ease;
	cursor: pointer;
}

.wpckb-greet-overlay.wpckb-greet-open {
	opacity: 1;
	pointer-events: auto;
}

.wpckb-greet-avatar {
	max-height: 55%;
	max-width: 70%;
	object-fit: contain;
	transform-origin: 50% 90%;
}

.wpckb-greet-bubble {
	background: #f7f7f8;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	padding: 10px 16px;
	font-size: 14px;
	color: #1f2937;
	max-width: 90%;
}

.wpckb-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f7f7f8;
}

.wpckb-msg {
	max-width: 85%;
	padding: 9px 12px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.wpckb-msg-user {
	align-self: flex-end;
	background: var(--wpckb-color, #2563eb);
	color: #fff;
	border-bottom-right-radius: 2px;
}

.wpckb-msg-assistant {
	align-self: flex-start;
	background: #fff;
	color: #1f2937;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 2px;
}

.wpckb-msg-error {
	align-self: center;
	background: #fee2e2;
	color: #991b1b;
	font-size: 13px;
}

.wpckb-sources {
	margin-top: 8px;
	padding-top: 6px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 12px;
}

.wpckb-sources-label {
	font-weight: 600;
	opacity: 0.6;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.wpckb-sources a {
	color: var(--wpckb-color, #2563eb);
	text-decoration: underline;
	word-break: break-word;
}

.wpckb-sources a:hover {
	text-decoration: none;
}

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

.wpckb-input-row textarea {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	max-height: 80px;
	font-family: inherit;
}

.wpckb-input-row button {
	background: var(--wpckb-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0 16px;
	cursor: pointer;
	font-size: 14px;
}

.wpckb-input-row button:disabled {
	opacity: 0.6;
	cursor: default;
}

.wpckb-mic-btn {
	flex: none;
	width: 40px;
	padding: 0 !important;
	font-size: 16px !important;
	position: relative;
}

.wpckb-mic-btn.is-listening {
	background: #dc2626;
	animation: wpckb-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes wpckb-mic-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
	50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.wpckb-chat-inline {
	position: relative;
	max-width: 480px;
}
