/* Nexo Creativo CR - Chatbot widget styles */

#nexo-chatbot-root {
	/* Defaults; the inline style attribute overrides these per-install. */
	--nexo-bubble:      #000000;
	--nexo-accent:      #d30b4e;
	--nexo-accent-rgb:  211,11,78;
	--nexo-send-bg:     #d30b4e;
	--nexo-send-icon:   #ffffff;
	--nexo-user-bg:     #000000;
	--nexo-user-text:   #ffffff;
	--nexo-bot-bg:      #f3f5f9;
	--nexo-bot-text:    #1d2433;
	--nexo-input-text:  #1d2433;
	--nexo-input-bg:    #ffffff;
	--nexo-bg:          #ffffff;
	--nexo-muted:       #6b7280;
	--nexo-radius:      18px;
	--nexo-shadow:      0 12px 30px rgba(0, 0, 0, 0.18);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--nexo-input-text);
	position: fixed;
	bottom: 24px;
	z-index: 999990;
	box-sizing: border-box;
}
#nexo-chatbot-root *,
#nexo-chatbot-root *::before,
#nexo-chatbot-root *::after { box-sizing: border-box; }

/* Position fallbacks (inline style on root takes precedence). */
.nexo-chatbot--right { right: 24px; left: auto; }
.nexo-chatbot--left  { left: 24px;  right: auto; }
#nexo-chatbot-root[data-position="right"] { right: 24px; left: auto; }
#nexo-chatbot-root[data-position="left"]  { left: 24px;  right: auto; }

/* Floating bubble */
.nexo-chatbot__bubble {
	width: 60px; height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--nexo-bubble);
	color: #ffffff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: var(--nexo-shadow);
	transition: transform 0.18s ease, background 0.18s ease;
}
.nexo-chatbot__bubble:hover { transform: translateY(-2px); }
.nexo-chatbot__bubble:focus-visible {
	outline: 3px solid var(--nexo-accent);
	outline-offset: 3px;
}
.nexo-chatbot--open .nexo-chatbot__bubble { background: var(--nexo-accent); }

/* Panel */
.nexo-chatbot__panel {
	position: absolute;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: var(--nexo-bg);
	border-radius: var(--nexo-radius);
	box-shadow: var(--nexo-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	animation: nexo-pop 0.22s ease;
}
.nexo-chatbot--left .nexo-chatbot__panel,
#nexo-chatbot-root[data-position="left"] .nexo-chatbot__panel {
	right: auto; left: 0;
	transform-origin: bottom left;
}
.nexo-chatbot--right .nexo-chatbot__panel,
#nexo-chatbot-root[data-position="right"] .nexo-chatbot__panel {
	right: 0; left: auto;
}

@keyframes nexo-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.nexo-chatbot__header {
	background: var(--nexo-bubble);
	color: #ffffff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 64px;
}
.nexo-chatbot__brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-width: 0;
	flex: 1 1 auto;
}
.nexo-chatbot__logo {
	display: block;
	height: 32px;
	width: auto;
	max-width: 220px;
	object-fit: contain;
}
.nexo-chatbot__status {
	display: block;
	color: rgba(255, 255, 255, 0.75);
	font-size: 11px;
	letter-spacing: 0.2px;
}
.nexo-chatbot__close {
	background: transparent; border: 0; color: #ffffff;
	font-size: 26px; line-height: 1; cursor: pointer;
	padding: 4px 10px; border-radius: 8px;
	flex-shrink: 0;
}
.nexo-chatbot__close:hover { background: rgba(255, 255, 255, 0.12); }

.nexo-chatbot__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fbfcfd;
}
.nexo-chatbot__messages::-webkit-scrollbar { width: 8px; }
.nexo-chatbot__messages::-webkit-scrollbar-thumb { background: #d4d8e0; border-radius: 4px; }

.nexo-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.nexo-msg--bot {
	background: var(--nexo-bot-bg);
	color: var(--nexo-bot-text);
	border-top-left-radius: 4px;
	align-self: flex-start;
}
.nexo-msg--user {
	background: var(--nexo-user-bg);
	color: var(--nexo-user-text);
	border-top-right-radius: 4px;
	align-self: flex-end;
}
.nexo-msg--system {
	font-size: 12px;
	color: var(--nexo-muted);
	align-self: center;
	background: transparent;
	padding: 4px 8px;
}
.nexo-msg a {
	color: var(--nexo-accent);
	text-decoration: underline;
}
.nexo-msg--user a { color: var(--nexo-user-text); }

.nexo-msg--typing {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--nexo-muted);
	font-style: italic;
}
.nexo-msg--typing .dot {
	width: 6px; height: 6px;
	background: var(--nexo-muted);
	border-radius: 50%;
	animation: nexo-typing 1s infinite;
}
.nexo-msg--typing .dot:nth-child(2) { animation-delay: 0.15s; }
.nexo-msg--typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes nexo-typing {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

.nexo-chatbot__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e6e9ef;
	background: var(--nexo-input-bg);
	position: relative;
}
.nexo-chatbot__form textarea {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #d4d8e0;
	border-radius: 12px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	color: var(--nexo-input-text);
	background: var(--nexo-input-bg);
	max-height: 120px;
	min-height: 40px;
	width: 100%;
	caret-color: var(--nexo-input-text);
}
.nexo-chatbot__form textarea::placeholder {
	color: var(--nexo-muted);
	opacity: 0.85;
}
.nexo-chatbot__form textarea:focus {
	outline: none;
	border-color: var(--nexo-accent);
	box-shadow: 0 0 0 3px rgba(var(--nexo-accent-rgb), 0.18);
}
.nexo-chatbot__send {
	background: var(--nexo-send-bg);
	color: var(--nexo-send-icon);
	border: 0;
	width: 40px; height: 40px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer; flex-shrink: 0;
	transition: opacity 0.18s ease;
}
.nexo-chatbot__send:disabled { opacity: 0.5; cursor: not-allowed; }
.nexo-chatbot__send:hover:not(:disabled) { opacity: 0.9; }
.nexo-chatbot__send svg { fill: var(--nexo-send-icon); }
.nexo-chatbot__send svg path { fill: var(--nexo-send-icon); }

.nexo-chatbot__footer {
	padding: 6px 14px 10px;
	text-align: center;
	background: #ffffff;
	border-top: 1px solid #f0f2f7;
}
.nexo-chatbot__footer small,
.nexo-chatbot__footer a {
	color: var(--nexo-muted);
	font-size: 11px;
}
.nexo-chatbot__footer a:hover { color: var(--nexo-accent); }

/* Cloudflare Turnstile container.
   Starts collapsed; when CF needs interaction (interaction-only mode) the
   widget grows the container and becomes interactive. */
.nexo-chatbot__turnstile {
	min-height: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.2s ease;
}
.nexo-chatbot__turnstile:not(:empty) {
	max-height: 80px;
	padding: 4px 12px 0;
}
/* When CF inserts an iframe (challenge needed), make sure it can receive clicks. */
.nexo-chatbot__turnstile iframe {
	pointer-events: auto !important;
}
.nexo-chatbot__panel[hidden] { display: none !important; }

@media (max-width: 480px) {
	#nexo-chatbot-root { bottom: 16px; }
	.nexo-chatbot--right,
	#nexo-chatbot-root[data-position="right"] { right: 16px; left: auto; }
	.nexo-chatbot--left,
	#nexo-chatbot-root[data-position="left"]  { left: 16px;  right: auto; }
	.nexo-chatbot__panel {
		width: calc(100vw - 32px);
		height: 70vh;
		bottom: 76px;
	}
	.nexo-chatbot__logo { height: 28px; max-width: 180px; }
}

/* Header actions: finalize + close buttons grouped */
.nexo-chatbot__header-actions {
	display: flex;
	gap: 4px;
	align-items: center;
	flex-shrink: 0;
}
.nexo-chatbot__finalize {
	background: transparent;
	border: 1px solid rgba(255,255,255,0.25);
	color: #ffffff;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.nexo-chatbot__finalize:hover {
	background: rgba(255,255,255,0.18);
	border-color: rgba(255,255,255,0.45);
}
.nexo-chatbot__finalize svg { fill: currentColor; }

/* Misuse warning system message */
.nexo-msg--warn {
	font-size: 12.5px;
	font-weight: 500;
	color: #b91c1c;
	background: #fff1f2;
	border: 1px solid #fecaca;
	border-radius: 10px;
	padding: 8px 12px;
	align-self: stretch;
	text-align: center;
}
