/**
 * Custom Website Chatbot - front-end styles.
 *
 * Everything is scoped under .sdcb-root and uses its own reset so the widget
 * neither inherits from nor leaks into the theme / Elementor styles.
 */

.sdcb-root {
	--sdcb-accent: #A50035;
	--sdcb-accent-deep: #6E0024;
	--sdcb-ink: #150810;
	--sdcb-text: #4a444c;
	--sdcb-muted: #7A7079;
	--sdcb-line: #e9dfe3;
	--sdcb-surface: #ffffff;
	--sdcb-bot-bg: #f6f2f4;
	--sdcb-radius: 16px;
	--sdcb-shadow: 0 18px 48px rgba(21, 8, 16, .22);
	--sdcb-side: right;

	position: fixed;
	bottom: 22px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	color: var(--sdcb-text);
}

.sdcb-root.sdcb-right { right: 22px; }
.sdcb-root.sdcb-left { left: 22px; }

.sdcb-root *, .sdcb-root *::before, .sdcb-root *::after { box-sizing: border-box; }

.sdcb-root button { font-family: inherit; }

/* ---------------------------------------------------------------- launcher */
.sdcb-root .sdcb-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sdcb-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(21, 8, 16, .26);
	transition: transform .18s ease, background-color .18s ease;
}

.sdcb-root .sdcb-launcher:hover { background: var(--sdcb-accent-deep); transform: translateY(-2px); }
.sdcb-root .sdcb-launcher:focus-visible { outline: 3px solid var(--sdcb-accent); outline-offset: 3px; }

.sdcb-root .sdcb-launcher__icon {
	position: absolute;
	display: flex;
	transition: opacity .16s ease, transform .16s ease;
}
.sdcb-root .sdcb-launcher__icon--close { opacity: 0; transform: rotate(-45deg) scale(.7); }

.sdcb-root[data-state="open"] .sdcb-launcher__icon--open { opacity: 0; transform: rotate(45deg) scale(.7); }
.sdcb-root[data-state="open"] .sdcb-launcher__icon--close { opacity: 1; transform: none; }

/* ------------------------------------------------------------------- panel */
.sdcb-root .sdcb-panel {
	position: absolute;
	bottom: 74px;
	width: 374px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 130px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--sdcb-surface);
	border: 1px solid var(--sdcb-line);
	border-radius: var(--sdcb-radius);
	box-shadow: var(--sdcb-shadow);
	opacity: 0;
	transform: translateY(12px) scale(.98);
	transition: opacity .18s ease, transform .18s ease;
}

.sdcb-root.sdcb-right .sdcb-panel { right: 0; transform-origin: bottom right; }
.sdcb-root.sdcb-left  .sdcb-panel { left: 0;  transform-origin: bottom left; }

.sdcb-root[data-state="open"] .sdcb-panel { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ header */
.sdcb-root .sdcb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 14px 14px 16px;
	background: linear-gradient(135deg, var(--sdcb-ink), var(--sdcb-accent));
	color: #fff;
	flex: 0 0 auto;
}

.sdcb-root .sdcb-header__id { display: flex; align-items: center; gap: 10px; min-width: 0; }

.sdcb-root .sdcb-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	flex: 0 0 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
}

.sdcb-root .sdcb-header__name {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sdcb-root .sdcb-header__status { margin: 2px 0 0; font-size: 12px; color: rgba(255, 255, 255, .78); }

.sdcb-root .sdcb-close {
	display: flex;
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	flex: 0 0 auto;
}
.sdcb-root .sdcb-close:hover { background: rgba(255, 255, 255, .16); }
.sdcb-root .sdcb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* --------------------------------------------------------------------- log */
.sdcb-root .sdcb-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 16px 14px 8px;
	background: #fff;
	scroll-behavior: smooth;
}

.sdcb-root .sdcb-msg { display: flex; margin-bottom: 12px; }
.sdcb-root .sdcb-msg--user { justify-content: flex-end; }

.sdcb-root .sdcb-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14.5px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.sdcb-root .sdcb-msg--bot .sdcb-bubble {
	background: var(--sdcb-bot-bg);
	color: var(--sdcb-ink);
	border-bottom-left-radius: 5px;
}

.sdcb-root .sdcb-msg--user .sdcb-bubble {
	background: var(--sdcb-accent);
	color: #fff;
	border-bottom-right-radius: 5px;
}

.sdcb-root .sdcb-bubble p { margin: 0 0 8px; }
.sdcb-root .sdcb-bubble p:last-child { margin-bottom: 0; }
.sdcb-root .sdcb-bubble a { color: var(--sdcb-accent); text-decoration: underline; }
.sdcb-root .sdcb-msg--user .sdcb-bubble a { color: #fff; }
.sdcb-root .sdcb-bubble ul, .sdcb-root .sdcb-bubble ol { margin: 6px 0; padding-left: 20px; }

.sdcb-root .sdcb-source {
	display: inline-block;
	margin-top: 8px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--sdcb-accent);
	text-decoration: none;
}
.sdcb-root .sdcb-source:hover { text-decoration: underline; }

/* ------------------------------------------------------------- suggestions */
.sdcb-root .sdcb-suggest { margin: -4px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }

.sdcb-root .sdcb-suggest__label {
	width: 100%;
	margin: 0 0 2px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .6px;
	text-transform: uppercase;
	color: var(--sdcb-muted);
}

.sdcb-root .sdcb-chip {
	max-width: 100%;
	min-width: 0;             /* flex items will not shrink below min-content */
	white-space: normal;      /* Hello Elementor resets buttons to nowrap */
	overflow-wrap: anywhere;
	line-height: 1.45;
	padding: 7px 12px;
	border: 1px solid var(--sdcb-line);
	border-radius: 14px;
	background: #fff;
	color: var(--sdcb-ink);
	font-size: 13px;
	text-align: left;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}
.sdcb-root .sdcb-chip:hover { background: #fdedf2; border-color: var(--sdcb-accent); }
.sdcb-root .sdcb-chip:focus-visible { outline: 2px solid var(--sdcb-accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ typing */
.sdcb-root .sdcb-typing { display: flex; gap: 4px; padding: 12px 14px; }
.sdcb-root .sdcb-typing span {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--sdcb-muted);
	animation: sdcb-bounce 1.2s infinite ease-in-out;
}
.sdcb-root .sdcb-typing span:nth-child(2) { animation-delay: .15s; }
.sdcb-root .sdcb-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes sdcb-bounce{
	0%, 60%, 100%{ transform: translateY(0); opacity: .45; }
	30%{ transform: translateY(-5px); opacity: 1; }
}

/* -------------------------------------------------------------- lead form */
.sdcb-root .sdcb-lead {
	margin: 0 0 12px;
	padding: 14px;
	border: 1px solid var(--sdcb-line);
	border-radius: 12px;
	background: #fbf8f9;
}

.sdcb-root .sdcb-lead__title { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--sdcb-ink); }

.sdcb-root .sdcb-field { margin-bottom: 8px; }

.sdcb-root .sdcb-field input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--sdcb-line);
	border-radius: 9px;
	background: #fff;
	font-size: 14px;
	color: var(--sdcb-ink);
}
.sdcb-root .sdcb-field input:focus {
	outline: none;
	border-color: var(--sdcb-accent);
	box-shadow: 0 0 0 3px rgba(165, 0, 53, .12);
}

.sdcb-root .sdcb-error {
	margin: 4px 0 0;
	font-size: 12.5px;
	color: #b3261e;
}

.sdcb-root .sdcb-actions { display: flex; gap: 8px; margin-top: 4px; }

.sdcb-root .sdcb-btn {
	flex: 1 1 auto;
	white-space: normal;
	padding: 10px 14px;
	border: 0;
	border-radius: 9px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.sdcb-root .sdcb-btn--primary { background: var(--sdcb-accent); color: #fff; }
.sdcb-root .sdcb-btn--primary:hover { background: var(--sdcb-accent-deep); }
.sdcb-root .sdcb-btn--ghost { background: #fff; color: var(--sdcb-ink); border: 1px solid var(--sdcb-line); flex: 0 0 auto; }
.sdcb-root .sdcb-btn:disabled { opacity: .6; cursor: not-allowed; }
.sdcb-root .sdcb-btn:focus-visible { outline: 2px solid var(--sdcb-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- composer */
.sdcb-root .sdcb-composer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--sdcb-line);
	background: #fff;
	flex: 0 0 auto;
}

.sdcb-root .sdcb-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 11px 14px;
	border: 1px solid var(--sdcb-line);
	border-radius: 999px;
	background: #fff;
	font-size: 15px; /* >=16px on mobile below, to stop iOS zoom */
	color: var(--sdcb-ink);
}
.sdcb-root .sdcb-input:focus {
	outline: none;
	border-color: var(--sdcb-accent);
	box-shadow: 0 0 0 3px rgba(165, 0, 53, .12);
}

.sdcb-root .sdcb-send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	padding: 0;   /* theme/Elementor set button padding; reset it here */
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sdcb-accent);
	color: #fff;
	cursor: pointer;
}
.sdcb-root .sdcb-send:hover { background: var(--sdcb-accent-deep); }
.sdcb-root .sdcb-send:disabled { opacity: .5; cursor: not-allowed; }
.sdcb-root .sdcb-send:focus-visible { outline: 2px solid var(--sdcb-accent); outline-offset: 2px; }

.sdcb-root .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ----------------------------------------------------------- tablet/mobile */
@media (max-width: 782px){
	.sdcb-root .sdcb-panel { width: 340px; height: 500px; }
}

@media (max-width: 600px){
	.sdcb-root { bottom: 16px; }
	.sdcb-root.sdcb-right { right: 16px; }
	.sdcb-root.sdcb-left { left: 16px; }

	.sdcb-root .sdcb-launcher { width: 54px; height: 54px; }

	/* Full-screen sheet: the panel is fixed to the viewport so the composer is
	   always reachable and the keyboard cannot push it out of view. */
	.sdcb-root .sdcb-panel {
		position: fixed;
		inset: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	.sdcb-root .sdcb-bubble { max-width: 88%; font-size: 15px; }
	.sdcb-root .sdcb-input { font-size: 16px; } /* prevents iOS input zoom */

	.sdcb-root .sdcb-composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
	.sdcb-root .sdcb-header { padding-top: calc(14px + env(safe-area-inset-top)); }

	/* Hide the launcher while the sheet is open so it cannot overlap content. */
	.sdcb-root[data-state="open"] .sdcb-launcher { display: none; }
}

@media (prefers-reduced-motion: reduce){
	.sdcb-root .sdcb-panel, .sdcb-root .sdcb-launcher, .sdcb-root .sdcb-launcher__icon { transition: none; }
	.sdcb-root .sdcb-log { scroll-behavior: auto; }
	.sdcb-root .sdcb-typing span { animation: none; opacity: .6; }
}
