/**
 * IBSOL AI Chatbot - front-end styles.
 *
 * All selectors are prefixed with "ibs-" and the stylesheet is injected into a
 * shadow root, so Elementor and theme styles can not interfere with the widget.
 *
 * @package IBSOL_Chatbot
 */

:host {
	all: initial;
}

.ibs-wrap {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1e2a3a;
	-webkit-text-size-adjust: 100%;
}

/* ---------------------------------------------------------------- launcher */

.ibs-launcher-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.ibs-launcher {
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #0b3d91 0%, #1257c4 100%);
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 26px rgba(11, 61, 145, 0.38);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.ibs-launcher:hover,
.ibs-launcher:focus-visible {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 14px 32px rgba(11, 61, 145, 0.45);
	outline: none;
}

.ibs-launcher:focus-visible {
	box-shadow: 0 0 0 3px rgba(242, 140, 40, 0.55), 0 14px 32px rgba(11, 61, 145, 0.45);
}

.ibs-launcher svg {
	width: 26px;
	height: 26px;
}

/* ----------------------------------------------------------------- tooltip */

.ibs-tooltip {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 240px;
	background: #ffffff;
	border: 1px solid #e2e8f2;
	border-radius: 12px;
	box-shadow: 0 12px 28px rgba(16, 40, 80, 0.18);
	padding: 12px 30px 12px 14px;
	font-size: 13px;
	color: #1e2a3a;
	z-index: 2;
}

.ibs-tooltip[hidden] {
	display: none;
}

.ibs-tooltip-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: transparent;
	border: 0;
	color: #8093aa;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 4px;
}

.ibs-tooltip-close:hover {
	color: #0b3d91;
}

/* ------------------------------------------------------------------- panel */

.ibs-panel {
	width: 370px;
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 18px 48px rgba(16, 40, 80, 0.24);
	border: 1px solid #e2e8f2;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: ibs-slide-in 0.22s ease-out;
}

.ibs-panel[hidden] {
	display: none;
}

@keyframes ibs-slide-in {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ibs-panel {
		animation: none;
	}
}

/* ------------------------------------------------------------------ header */

.ibs-header {
	background: #0b3d91;
	color: #ffffff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex: 0 0 auto;
}

.ibs-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.ibs-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #f28c28;
	color: #ffffff;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.ibs-header-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: #ffffff;
}

.ibs-header-status {
	margin: 1px 0 0;
	font-size: 12px;
	color: #c9dbf6;
}

.ibs-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ibs-header-btn {
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.5);
	color: #ffffff;
	font-size: 12.5px;
	padding: 7px 11px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
}

.ibs-header-btn:hover,
.ibs-header-btn:focus-visible {
	background: #f28c28;
	border-color: #f28c28;
	outline: none;
}

.ibs-close {
	background: transparent;
	border: 0;
	color: #ffffff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
}

.ibs-close:hover {
	color: #f28c28;
}

/* -------------------------------------------------------------------- body */

.ibs-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 14px;
	background: #f5f7fb;
	overscroll-behavior: contain;
}

.ibs-msg {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
	align-items: flex-end;
}

.ibs-msg-user {
	flex-direction: row-reverse;
}

.ibs-msg-system {
	justify-content: center;
	margin: 10px 0;
}

.ibs-msg-avatar {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: #0b3d91;
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.ibs-bubble {
	background: #ffffff;
	border: 1px solid #e4eaf3;
	border-radius: 14px 14px 14px 4px;
	padding: 10px 13px;
	max-width: 84%;
	box-shadow: 0 1px 2px rgba(16, 40, 80, 0.06);
	overflow-wrap: anywhere;
	word-break: break-word;
}

.ibs-bubble p {
	margin: 0 0 8px;
}

.ibs-bubble p:last-child {
	margin-bottom: 0;
}

.ibs-bubble ul {
	margin: 6px 0 6px 4px;
	padding-left: 18px;
}

.ibs-bubble li {
	margin: 3px 0;
}

.ibs-bubble a {
	color: #0b3d91;
	font-weight: 600;
}

.ibs-msg-user .ibs-bubble {
	background: #0b3d91;
	border-color: #0b3d91;
	color: #ffffff;
	border-radius: 14px 14px 4px 14px;
}

.ibs-msg-user .ibs-bubble a {
	color: #ffd9ae;
}

.ibs-msg-error .ibs-bubble {
	border-color: #f3c0a0;
	background: #fff7f1;
}

.ibs-msg-typing .ibs-bubble {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 14px 16px;
}

.ibs-dot-typing {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #8ea3bf;
	display: inline-block;
	animation: ibs-blink 1.2s infinite ease-in-out;
}

.ibs-dot-typing:nth-child(2) {
	animation-delay: 0.2s;
}

.ibs-dot-typing:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes ibs-blink {
	0%,
	60%,
	100% {
		opacity: 0.25;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.ibs-team-cta .ibs-button {
	font-size: 13px;
}

/* ------------------------------------------------------------ quick replies */

.ibs-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 12px;
	background: #ffffff;
	border-top: 1px solid #eef1f7;
	flex: 0 0 auto;
}

.ibs-quick-replies:empty {
	display: none;
}

.ibs-chip {
	background: #f2f6fd;
	border: 1px solid #c9daf4;
	color: #0b3d91;
	border-radius: 999px;
	padding: 7px 12px;
	font-size: 12.5px;
	cursor: pointer;
	font-family: inherit;
}

.ibs-chip:hover,
.ibs-chip:focus-visible {
	background: #0b3d91;
	border-color: #0b3d91;
	color: #ffffff;
	outline: none;
}

/* ---------------------------------------------------------------- composer */

.ibs-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #ffffff;
	border-top: 1px solid #eef1f7;
	flex: 0 0 auto;
}

.ibs-input {
	width: 100%;
	border: 1px solid #d5dde9;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	color: #1e2a3a;
	background: #ffffff;
	box-sizing: border-box;
}

.ibs-input:focus {
	outline: none;
	border-color: #0b3d91;
	box-shadow: 0 0 0 3px rgba(11, 61, 145, 0.12);
}

.ibs-textarea {
	resize: none;
	max-height: 120px;
	overflow-y: auto;
	line-height: 1.45;
}

.ibs-send {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: #f28c28;
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	transition: background 0.15s ease;
}

.ibs-send:hover,
.ibs-send:focus-visible {
	background: #d97a1c;
	outline: none;
}

.ibs-send:disabled {
	opacity: 0.55;
	cursor: default;
}

/* ------------------------------------------------------------------- footer */

.ibs-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 12px;
	background: #ffffff;
	border-top: 1px solid #eef1f7;
	font-size: 11.5px;
	color: #7a8aa0;
	flex: 0 0 auto;
	flex-wrap: wrap;
}

.ibs-privacy a {
	color: #0b3d91;
}

.ibs-whatsapp {
	color: #128c4a;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.ibs-whatsapp:hover {
	text-decoration: underline;
}

/* ---------------------------------------------------------------- lead form */

.ibs-lead-form {
	background: #ffffff;
	border: 1px solid #dfe6f1;
	border-radius: 14px;
	padding: 16px;
	margin: 4px 0 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	box-shadow: 0 4px 14px rgba(16, 40, 80, 0.08);
}

.ibs-lead-title {
	margin: 0;
	font-size: 15px;
	color: #0b3d91;
}

.ibs-lead-intro {
	margin: 0;
	font-size: 12.5px;
	color: #6b7b90;
}

.ibs-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ibs-field-label {
	font-size: 12px;
	font-weight: 600;
	color: #5a6b80;
}

.ibs-field-consent {
	flex-direction: row;
	align-items: flex-start;
	gap: 8px;
	font-size: 12px;
	color: #5a6b80;
}

.ibs-field-consent input {
	margin-top: 2px;
}

.ibs-consent-text a {
	color: #0b3d91;
}

.ibs-honeypot {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.ibs-lead-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 2px;
}

.ibs-lead-status {
	margin: 0;
	font-size: 12.5px;
	color: #4a5a6e;
}

.ibs-lead-status-error {
	color: #b23c17;
}

.ibs-button {
	font-family: inherit;
	font-size: 13px;
	border-radius: 8px;
	padding: 10px 14px;
	cursor: pointer;
	border: 1px solid transparent;
}

.ibs-button-primary {
	background: #0b3d91;
	color: #ffffff;
}

.ibs-button-primary:hover,
.ibs-button-primary:focus-visible {
	background: #0a3378;
	outline: none;
}

.ibs-button-ghost {
	background: transparent;
	border-color: #c9daf4;
	color: #0b3d91;
}

.ibs-button-ghost:hover,
.ibs-button-ghost:focus-visible {
	background: #f2f6fd;
	outline: none;
}

/* ------------------------------------------------------------------- helper */

.ibs-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------- mobile */

@media (max-width: 768px) {
	.ibs-wrap {
		right: 12px;
		bottom: 12px;
	}

	.ibs-launcher {
		width: 54px;
		height: 54px;
	}

	.ibs-panel {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100%;
		max-height: none;
		border-radius: 0;
		border: 0;
		z-index: 2147483000;
	}

	.ibs-tooltip {
		width: 210px;
	}
}
