/**
 * CoreBot — Estilos públicos del widget.
 * Todos los colores/tamaños vienen de variables CSS inyectadas por
 * PHP (ver Corebot_Public::build_inline_css_variables). No hay
 * colores fijos "quemados" en este archivo.
 */

:root {
	--core-primary: #9E1F63;
	--core-secondary: #F15A29;
	--core-button: #9E1F63;
	--core-text: #222222;
	--core-header: #9E1F63;
	--core-chat-bg: #ffffff;
	--core-font: 'Oswald', Helvetica, Arial, sans-serif;
	--core-radius: 16px;
	--core-win-width: 380px;
	--core-win-height: 560px;
	--core-size: 88px;
	--core-offset-b: 24px;
	--core-offset-s: 24px;
}

#corebot-widget {
	position: fixed;
	bottom: var(--core-offset-b);
	z-index: 99990;
	font-family: var(--core-font);
	line-height: 1.4;
}

#corebot-widget.corebot-pos-bottom-right {
	right: var(--core-offset-s);
}

#corebot-widget.corebot-pos-bottom-left {
	left: var(--core-offset-s);
}

/* --- Mascota --- */

.corebot-mascot-button {
	width: var(--core-size);
	height: var(--core-size);
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	position: relative;
	display: block;
}

.corebot-mascot-button:focus-visible {
	outline: 3px solid var(--core-secondary);
	outline-offset: 4px;
	border-radius: 50%;
}

.corebot-mascot-button img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

.corebot-widget-animated .corebot-mascot-button img {
	animation: corebot-float 3.4s ease-in-out infinite;
}

.corebot-widget-animated .corebot-mascot-button:hover img {
	animation-play-state: paused;
	transform: scale(1.08) rotate(-4deg);
	transition: transform 0.25s ease;
}

@keyframes corebot-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
	.corebot-widget-animated .corebot-mascot-button img {
		animation: none;
	}
}

/* --- Burbuja de saludo --- */

.corebot-greeting-bubble {
	position: absolute;
	bottom: calc(100% + 10px);
	max-width: 220px;
	background: var(--core-chat-bg);
	color: var(--core-text);
	padding: 10px 14px;
	border-radius: var(--core-radius);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
	font-size: 13px;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.corebot-pos-bottom-right .corebot-greeting-bubble { right: 0; }
.corebot-pos-bottom-left .corebot-greeting-bubble { left: 0; }

.corebot-greeting-bubble.corebot-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* --- Ventana de chat --- */

.corebot-chat-window {
	position: absolute;
	bottom: calc(100% + 14px);
	width: var(--core-win-width);
	max-width: calc(100vw - 32px);
	height: var(--core-win-height);
	max-height: calc(100vh - 120px);
	background: var(--core-chat-bg);
	border-radius: var(--core-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.corebot-pos-bottom-right .corebot-chat-window { right: 0; }
.corebot-pos-bottom-left .corebot-chat-window { left: 0; }

.corebot-chat-window.corebot-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.corebot-chat-header {
	background: var(--core-header);
	color: #fff;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	flex-shrink: 0;
}

.corebot-chat-header img {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #fff;
	object-fit: contain;
}

.corebot-chat-header strong {
	font-size: 15px;
	letter-spacing: 0.02em;
}

.corebot-chat-close {
	margin-left: auto;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 6px;
	border-radius: 50%;
}

.corebot-chat-close:hover,
.corebot-chat-close:focus-visible {
	background: rgba(255, 255, 255, 0.18);
	outline: none;
}

.corebot-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--core-chat-bg);
}

.corebot-msg {
	max-width: 84%;
	padding: 9px 12px;
	border-radius: var(--core-radius);
	font-size: 13.5px;
	color: var(--core-text);
	word-wrap: break-word;
}

.corebot-msg-bot {
	background: #f2f2f4;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.corebot-msg-user {
	background: var(--core-primary);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.corebot-typing {
	font-size: 12px;
	color: #888;
	align-self: flex-start;
	padding-left: 4px;
	font-style: italic;
}

.corebot-quick-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 10px;
	flex-shrink: 0;
}

.corebot-quick-button {
	background: #f2f2f4;
	color: var(--core-text);
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 12px;
	cursor: pointer;
}

.corebot-quick-button:hover,
.corebot-quick-button:focus-visible {
	background: var(--core-primary);
	color: #fff;
	outline: none;
}

.corebot-chat-footer {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	flex-shrink: 0;
}

.corebot-chat-input {
	flex: 1;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 999px;
	padding: 9px 14px;
	font-size: 13.5px;
	font-family: inherit;
	color: var(--core-text);
	resize: none;
	max-height: 90px;
}

.corebot-chat-input:focus-visible {
	outline: 2px solid var(--core-primary);
	outline-offset: 1px;
}

.corebot-chat-send {
	background: var(--core-button);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}

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

.corebot-chat-send:focus-visible {
	outline: 2px solid var(--core-secondary);
	outline-offset: 2px;
}

.corebot-talk-human {
	display: block;
	text-align: center;
	font-size: 12px;
	padding: 8px;
	color: var(--core-secondary);
	text-decoration: none;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	flex-shrink: 0;
}

.corebot-talk-human:hover,
.corebot-talk-human:focus-visible {
	text-decoration: underline;
}

/* --- Responsive: celular --- */

@media (max-width: 480px) {
	.corebot-chat-window {
		width: calc(100vw - 24px);
		height: calc(100vh - 100px);
		max-height: none;
		right: 12px !important;
		left: 12px !important;
	}

	#corebot-widget.corebot-pos-bottom-left,
	#corebot-widget.corebot-pos-bottom-right {
		right: 12px;
		left: auto;
	}

	.corebot-mascot-button {
		width: calc(var(--core-size) * 0.82);
		height: calc(var(--core-size) * 0.82);
	}
}

.corebot-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}
