/* TechBerry Assistant — DIYA-style light chat widget */

.aiba-root {
	--aiba-accent: #0B59DB;
	--aiba-bg: #ffffff;
	--aiba-text: #000000;
	--aiba-muted: #8a8a8a;
	--aiba-bubble: #ececec;
	--aiba-user-bubble: #e8f0fc;
	--aiba-border: #e6e6e6;
	--aiba-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	--aiba-radius: 16px;
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--aiba-text);
	pointer-events: none;
}

.aiba-root *,
.aiba-root *::before,
.aiba-root *::after {
	box-sizing: border-box;
}

.aiba-pos-right { right: 22px; }
.aiba-pos-left { left: 22px; }

.aiba-launcher,
.aiba-panel,
.aiba-close,
.aiba-send,
.aiba-teaser,
.aiba-dock,
.aiba-suggestion {
	pointer-events: auto;
}

/* Closed-state dock: avatar + greeting teaser */
.aiba-dock {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	max-width: min(420px, calc(100vw - 28px));
}

.aiba-pos-right .aiba-dock {
	flex-direction: row; /* teaser left, avatar right */
}

.aiba-pos-left .aiba-dock {
	flex-direction: row; /* avatar left, teaser right */
}

.aiba-pos-left .aiba-teaser {
	order: 2;
}

.aiba-pos-left .aiba-launcher {
	order: 1;
}

.aiba-pos-right .aiba-teaser {
	order: 1;
}

.aiba-pos-right .aiba-launcher {
	order: 2;
}

.aiba-root.is-open .aiba-dock {
	display: none;
}

/* Greeting popup bubble */
.aiba-teaser {
	position: relative;
	display: none;
	align-items: flex-start;
	max-width: min(300px, calc(100vw - 110px));
	margin: 0;
	padding: 14px 16px;
	border: 0;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
	color: #000000;
	text-align: left;
	cursor: pointer;
	font: inherit;
	line-height: 1.35;
	animation: aiba-teaser-in 0.35s ease;
}

.aiba-teaser.is-visible {
	display: inline-flex;
}

.aiba-teaser[hidden] {
	display: none !important;
}

.aiba-teaser__accent {
	position: absolute;
	top: 0;
	left: 12px;
	width: 36px;
	height: 3px;
	border-radius: 0 0 3px 3px;
	background: var(--aiba-accent);
}

.aiba-teaser__text {
	display: block;
	white-space: pre-line;
	font-size: 13px;
	font-weight: 500;
	color: #000000;
}

/* Launcher — circular photo + badge */
.aiba-launcher {
	position: relative;
	width: 64px;
	height: 64px;
	border: 0;
	padding: 0;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: visible;
	flex-shrink: 0;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aiba-launcher:hover,
.aiba-launcher:focus-visible {
	transform: translateY(-2px) scale(1.03);
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
	outline: none;
}

.aiba-launcher__img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	display: block;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.aiba-badge {
	position: absolute;
	top: -6px;
	left: -6px;
	z-index: 2;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: #e53935;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

@keyframes aiba-teaser-in {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.aiba-root.is-open {
	width: min(360px, calc(100vw - 28px));
	height: min(520px, calc(100vh - 40px));
}

/* Panel */
.aiba-panel {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
	height: 100%;
	max-height: min(520px, calc(100vh - 40px));
	display: flex;
	flex-direction: column;
	background: var(--aiba-bg);
	border-radius: var(--aiba-radius);
	box-shadow: var(--aiba-shadow);
	overflow: hidden;
	overscroll-behavior: contain;
	touch-action: manipulation;
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px) scale(0.97);
	transform-origin: bottom right;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
}

.aiba-pos-left .aiba-panel {
	transform-origin: bottom left;
}

.aiba-pos-right .aiba-panel {
	transform-origin: bottom right;
}

.aiba-root.is-open .aiba-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.aiba-panel[hidden] {
	display: none !important;
}

/* Purple header like DIYA example */
.aiba-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	background: var(--aiba-accent);
	color: #fff;
	flex-shrink: 0;
}

.aiba-header__identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.aiba-header__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
	border: 2px solid rgba(255, 255, 255, 0.85);
	flex-shrink: 0;
}

.aiba-header__name {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aiba-header__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.aiba-header__chat-icon {
	display: inline-flex;
	color: rgba(255, 255, 255, 0.95);
	opacity: 0.9;
}

.aiba-close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.aiba-close:hover,
.aiba-close:focus-visible {
	background: rgba(255, 255, 255, 0.15);
	outline: none;
}

/* Messages */
.aiba-messages {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	padding: 16px 14px 8px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: #fff;
	scroll-behavior: auto;
	min-height: 0;
}

.aiba-messages::-webkit-scrollbar {
	width: 5px;
}

.aiba-messages::-webkit-scrollbar-thumb {
	background: #d0d0d0;
	border-radius: 999px;
}

.aiba-msg {
	display: flex;
	flex-direction: column;
	max-width: 92%;
	animation: aiba-fade-in 0.2s ease;
}

.aiba-msg--bot {
	align-self: flex-start;
}

.aiba-msg--user {
	align-self: flex-end;
	align-items: flex-end;
}

.aiba-msg__meta {
	font-size: 11px;
	font-weight: 650;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--aiba-muted);
	margin-bottom: 4px;
	padding-left: 44px;
}

.aiba-msg--user .aiba-msg__meta {
	padding-left: 0;
	padding-right: 4px;
}

.aiba-msg__row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.aiba-msg--user .aiba-msg__row {
	flex-direction: row-reverse;
}

.aiba-msg__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: #f3f3f3;
	border: 1px solid #e5e5e5;
}

.aiba-msg__bubble {
	padding: 10px 12px;
	border-radius: 14px;
	word-break: break-word;
	font-size: 13.5px;
	color: #000000 !important;
}

.aiba-msg--bot .aiba-msg__bubble,
.aiba-msg--bot .aiba-msg__bubble p,
.aiba-msg--bot .aiba-msg__bubble li,
.aiba-msg--bot .aiba-msg__bubble strong,
.aiba-msg--user .aiba-msg__bubble {
	color: #000000 !important;
}

.aiba-msg--bot .aiba-msg__bubble {
	background: var(--aiba-bubble);
	border-bottom-left-radius: 4px;
}

.aiba-msg--user .aiba-msg__bubble {
	background: var(--aiba-user-bubble);
	border: 1px solid color-mix(in srgb, var(--aiba-accent) 18%, #ddd);
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}

.aiba-msg--error .aiba-msg__bubble,
.aiba-msg--error .aiba-msg__bubble p {
	background: #fde8eb;
	color: #8a1f2f !important;
}

.aiba-msg__time {
	margin-top: 4px;
	font-size: 11px;
	color: var(--aiba-muted);
	padding-left: 44px;
}

.aiba-msg--user .aiba-msg__time {
	padding-left: 0;
	padding-right: 4px;
	text-align: right;
}

/* Recommended questions ("You can also ask:") */
.aiba-suggestions {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	margin: 6px 0 14px;
	padding-left: 44px;
	padding-right: 8px;
	pointer-events: auto;
}

.aiba-suggestions__label {
	font-size: 12px;
	line-height: 1.3;
	color: #8a8a8a;
	margin: 0 0 8px;
}

.aiba-suggestions__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-start;
}

.aiba-suggestion {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1.5px solid var(--aiba-accent, #0B59DB);
	background: #ffffff;
	color: var(--aiba-accent, #0B59DB) !important;
	font: inherit;
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
	max-width: 100%;
	white-space: normal;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.aiba-suggestion:hover,
.aiba-suggestion:focus {
	outline: none;
	background: color-mix(in srgb, var(--aiba-accent, #0B59DB) 8%, #fff);
	color: var(--aiba-accent, #0B59DB) !important;
}

.aiba-suggestion:focus-visible {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--aiba-accent, #0B59DB) 25%, transparent);
}

.aiba-suggestion:active {
	background: color-mix(in srgb, var(--aiba-accent, #0B59DB) 14%, #fff);
}

.aiba-root.is-sending .aiba-suggestion,
.aiba-suggestion:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	pointer-events: none;
}

.aiba-msg__bubble p {
	margin: 0 0 0.5em;
}

.aiba-msg__bubble p:last-child {
	margin-bottom: 0;
}

.aiba-msg__bubble h1,
.aiba-msg__bubble h2,
.aiba-msg__bubble h3 {
	margin: 0.3em 0 0.35em;
	font-size: 0.95em;
	font-weight: 700;
	color: var(--aiba-accent);
}

.aiba-msg__bubble ul {
	margin: 0.35em 0 0.55em;
	padding-left: 1.25em;
	list-style: disc;
}

.aiba-msg__bubble ul.aiba-service-list {
	margin: 0.5em 0 0.6em;
	padding-left: 1.35em;
	list-style-type: disc;
	list-style-position: outside;
}

.aiba-msg__bubble ul.aiba-service-list li {
	margin: 0.45em 0;
	padding-left: 0.2em;
	line-height: 1.45;
}

.aiba-msg__bubble li .aiba-cat,
.aiba-msg__bubble strong.aiba-cat {
	color: #000000 !important;
	font-weight: 700;
}

.aiba-msg__bubble a.aiba-link {
	color: var(--aiba-accent) !important;
	font-weight: 600;
	text-decoration: underline;
	word-break: break-all;
}

.aiba-msg__bubble a.aiba-link:hover,
.aiba-msg__bubble a.aiba-link:focus {
	filter: brightness(0.9);
}

/* Typing status line under messages */
.aiba-typing-status {
	padding: 0 16px 10px;
	font-size: 12px;
	color: #444;
	background: #fff;
	flex-shrink: 0;
}

.aiba-typing-status[hidden] {
	display: none !important;
}

/* Composer */
.aiba-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px 12px;
	border-top: 1px solid var(--aiba-border);
	background: #fff;
	flex-shrink: 0;
}

.aiba-input {
	flex: 1;
	min-height: 40px;
	max-height: 110px;
	resize: none;
	border: 0;
	padding: 10px 4px;
	background: transparent;
	color: var(--aiba-text);
	font: inherit;
	line-height: 1.4;
	outline: none;
}

.aiba-input::placeholder {
	color: #9a9a9a;
}

.aiba-send {
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: var(--aiba-accent);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: filter 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.aiba-send:hover:not(:disabled),
.aiba-send:focus-visible:not(:disabled) {
	filter: brightness(1.08);
	transform: translateY(-1px);
	outline: none;
}

.aiba-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.aiba-root .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

@keyframes aiba-fade-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
	.aiba-root {
		bottom: 12px;
	}

	.aiba-pos-right {
		right: 12px;
	}

	.aiba-pos-left {
		left: 12px;
	}

	.aiba-launcher {
		width: 56px;
		height: 56px;
		border-radius: 50%;
	}

	.aiba-launcher__img {
		width: 56px;
		height: 56px;
		border-radius: 50%;
	}

	.aiba-teaser {
		max-width: min(200px, calc(100vw - 100px));
		padding: 10px 12px;
	}

	.aiba-teaser__text {
		font-size: 12px;
	}

	.aiba-badge {
		min-width: 20px;
		height: 20px;
		line-height: 20px;
		font-size: 11px;
		top: -5px;
		left: -5px;
	}

	/* Compact sheet — leaves most of the page visible above */
	.aiba-root.is-open {
		width: min(340px, calc(100vw - 24px));
		height: min(420px, 52vh);
		max-height: calc(100dvh - 96px);
	}

	.aiba-panel {
		max-height: 100%;
		border-radius: 14px;
	}

	.aiba-header {
		padding: 10px 12px;
	}

	.aiba-header__avatar {
		width: 34px;
		height: 34px;
	}

	.aiba-header__name {
		font-size: 13px;
	}

	.aiba-messages {
		padding: 12px 10px 6px;
		gap: 10px;
	}

	.aiba-msg__bubble {
		font-size: 12.5px;
		padding: 8px 10px;
	}

	.aiba-msg__avatar {
		width: 26px;
		height: 26px;
	}

	.aiba-msg__meta,
	.aiba-msg__time {
		font-size: 10px;
	}

	.aiba-msg__meta,
	.aiba-msg__time {
		padding-left: 34px;
	}

	.aiba-suggestions {
		padding-left: 34px;
	}

	.aiba-suggestion {
		font-size: 12px;
		padding: 7px 12px;
	}

	.aiba-form {
		padding: 8px 10px 10px;
	}

	.aiba-input {
		min-height: 36px;
		font-size: 13px;
	}

	.aiba-send {
		width: 34px;
		height: 34px;
	}

	.aiba-hide-mobile {
		display: none !important;
	}
}

@media (max-width: 380px) {
	.aiba-root.is-open {
		width: calc(100vw - 20px);
		height: min(380px, 48vh);
		max-height: calc(100dvh - 88px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.aiba-msg,
	.aiba-panel,
	.aiba-launcher {
		animation: none !important;
		transition: none !important;
	}
}
