/* Sherpa AI Chat Widget */

.htte-chat {
	position: fixed;
	bottom: 28px;
	right: 24px;
	z-index: 99999;
	font-family: 'Roboto', sans-serif;
}

/* ── Toggle button ───────────────────────────────────── */
.htte-chat__toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, #FF7F50 0%, #e6623b 100%);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 20px rgba(255, 127, 80, 0.45), 0 2px 8px rgba(0,0,0,0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	position: relative;
}

.htte-chat__toggle:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(255, 127, 80, 0.55), 0 2px 10px rgba(0,0,0,0.18);
}

.htte-chat__toggle:active { transform: scale(0.96); }

.htte-chat__toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s, transform 0.2s;
}

/* Higher specificity so [hidden] attr correctly hides the icon spans even though display:flex is set above */
.htte-chat .htte-chat__toggle-icon[hidden] { display: none; }
.htte-chat .htte-chat__badge[hidden]       { display: none; }

.htte-chat__badge {
	position: absolute;
	top: 0;
	right: 0;
	width: 18px;
	height: 18px;
	background: #ef4444;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	animation: htte-pulse 2s infinite;
}

@keyframes htte-pulse {
	0%, 100% { transform: scale(1); }
	50%       { transform: scale(1.2); }
}

/* ── Chat panel ──────────────────────────────────────── */
.htte-chat__panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 380px;
	max-height: 560px;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 24px 64px rgba(15, 118, 110, 0.18), 0 4px 16px rgba(0,0,0,0.10);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	animation: htte-slide-up 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes htte-slide-up {
	from { opacity: 0; transform: translateY(20px) scale(0.92); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.htte-chat__panel[hidden] { display: none; }

/* ── Header ──────────────────────────────────────────── */
.htte-chat__header {
	background: linear-gradient(135deg, #0F766E 0%, #0d6660 100%);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.htte-chat__avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255,255,255,0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	border: 2px solid rgba(255,255,255,0.3);
}

.htte-chat__header-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.htte-chat__header-info strong {
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
}

.htte-chat__status {
	color: rgba(255,255,255,0.8);
	font-size: 12px;
	display: flex;
	align-items: center;
	gap: 5px;
}

.htte-chat__dot {
	width: 7px;
	height: 7px;
	background: #4ade80;
	border-radius: 50%;
	animation: htte-blink 2s infinite;
}

@keyframes htte-blink {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.4; }
}

.htte-chat__header-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.htte-chat__call-btn,
.htte-chat__minimize {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255,255,255,0.15);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	transition: background 0.15s;
}

.htte-chat__call-btn:hover,
.htte-chat__minimize:hover {
	background: rgba(255,255,255,0.28);
	color: #fff;
}

/* ── Messages ────────────────────────────────────────── */
.htte-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scroll-behavior: smooth;
}

.htte-chat__messages::-webkit-scrollbar { width: 4px; }
.htte-chat__messages::-webkit-scrollbar-track { background: transparent; }
.htte-chat__messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Message bubbles */
.htte-msg {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	max-width: 92%;
	animation: htte-fade-in 0.2s ease both;
}

@keyframes htte-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.htte-msg--user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.htte-msg--bot {
	align-self: flex-start;
}

.htte-msg__bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.55;
	max-width: 100%;
	word-break: break-word;
}

.htte-msg--bot .htte-msg__bubble {
	background: #f1f5f9;
	color: #1e293b;
	border-bottom-left-radius: 4px;
}

.htte-msg--user .htte-msg__bubble {
	background: #0F766E;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.htte-msg__bubble ul,
.htte-msg__bubble ol {
	margin: 6px 0 0 0;
	padding-left: 18px;
}

.htte-msg__bubble li { margin-bottom: 3px; }

.htte-msg__bubble strong { font-weight: 700; }

/* Feedback row */
.htte-msg__feedback {
	display: flex;
	gap: 6px;
	margin-top: 6px;
}

.htte-msg__thumb {
	background: none;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	cursor: pointer;
	padding: 2px 7px;
	font-size: 13px;
	color: #64748b;
	transition: all 0.15s;
}

.htte-msg__thumb:hover { background: #f1f5f9; border-color: #94a3b8; }
.htte-msg__thumb.active { background: #0F766E; color: #fff; border-color: #0F766E; }

/* ── Typing indicator ────────────────────────────────── */
.htte-chat__typing {
	padding: 0 16px 10px;
	display: flex;
	gap: 5px;
	align-items: center;
	flex-shrink: 0;
}

.htte-chat__typing[hidden] { display: none; }

.htte-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #94a3b8;
	animation: htte-bounce 1.2s infinite;
}

.htte-chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.htte-chat__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes htte-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30%            { transform: translateY(-6px); }
}

/* ── Quick reply chips ───────────────────────────────── */
.htte-chat__quick-replies {
	padding: 0 12px 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex-shrink: 0;
}

.htte-chat__chip {
	background: #f0fdfa;
	border: 1px solid #99f6e4;
	color: #0F766E;
	font-size: 12px;
	font-weight: 500;
	padding: 5px 11px;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.15s;
	white-space: nowrap;
	font-family: inherit;
}

.htte-chat__chip:hover {
	background: #0F766E;
	border-color: #0F766E;
	color: #fff;
}

/* ── Input form ──────────────────────────────────────── */
.htte-chat__form {
	border-top: 1px solid #f1f5f9;
	padding: 10px 12px 8px;
	flex-shrink: 0;
}

.htte-chat__input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.htte-chat__input {
	flex: 1;
	border: 1.5px solid #e2e8f0;
	border-radius: 12px;
	padding: 10px 13px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	outline: none;
	background: #fafafa;
	color: #1e293b;
	transition: border-color 0.15s;
	max-height: 100px;
	line-height: 1.4;
}

.htte-chat__input:focus { border-color: #0F766E; background: #fff; }
.htte-chat__input::placeholder { color: #94a3b8; }

.htte-chat__send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #FF7F50;
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s, transform 0.15s;
}

.htte-chat__send:not([disabled]):hover { background: #e6623b; transform: scale(1.05); }
.htte-chat__send[disabled] { background: #cbd5e1; cursor: not-allowed; }

.htte-chat__powered-by {
	font-size: 10px;
	color: #94a3b8;
	text-align: center;
	margin: 6px 0 0;
	letter-spacing: 0.01em;
}

/* ── Screen reader only ─────────────────────────────── */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px,1px,1px,1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 480px) {
	.htte-chat {
		bottom: 16px;
		right: 16px;
	}

	.htte-chat__panel {
		position: fixed;
		bottom: 0;
		right: 0;
		width: 100vw;
		max-height: 90vh;
		border-radius: 20px 20px 0 0;
	}
}
