/* Hostever RAG — Widget styles (redesigned)
   Color variables are injected via inline <style> from widget.js */
.hrs-root {
	--hrs-primary:        #2563eb;
	--hrs-accent:         #1e40af;
	--hrs-bubble-size:    56px;
	--hrs-panel-radius:   16px;
	--hrs-msg-radius:     16px;
	--hrs-msg-radius-user: 6px 16px 16px 16px;
	--hrs-msg-radius-bot: 16px 16px 16px 6px;
	--hrs-avatar-size:    30px;
	--hrs-spacing:        10px;
	--hrs-shadow:         0 4px 24px rgba(0,0,0,.08), 0 24px 64px rgba(0,0,0,.12);

	position: fixed;
	z-index: 999999;
	font-family: var(--hrs-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
	font-size: 14px;
	line-height: 1.5;
	color: #0f172a;
	-webkit-font-smoothing: antialiased;
}

/* Positioning */
.hrs-pos-bottom-right { right: 20px; bottom: 20px; }
.hrs-pos-bottom-left  { left: 20px;  bottom: 20px; }

/* =================================================================== Bubble */
.hrs-bubble {
	position: absolute;
	right: 0;
	bottom: 0;
	width: var(--hrs-bubble-size);
	height: var(--hrs-bubble-size);
	border-radius: 50%;
	background: var(--hrs-primary);
	color: #fff;
	border: 0;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .2s ease, box-shadow .2s ease;
	z-index: 1;
}

.hrs-bubble::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 56px;
	height: 56px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	border: 1.5px solid rgba(0,0,0,.08);
	animation: hrs-ripple 2.5s ease-out infinite;
	pointer-events: none;
    box-sizing: border-box;
}

@keyframes hrs-ripple {
	0%   { width: 56px; height: 56px; opacity: .6; }
	100% { width: 72px; height: 72px; opacity: 0; }
}

.hrs-pos-bottom-left .hrs-bubble {
	left: 0;
	right: auto;
}

.hrs-bubble:hover,
.hrs-bubble:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 4px 16px rgba(0,0,0,.15);
	outline: none;
}

.hrs-bubble:active {
	transform: scale(.95);
}

.hrs-bubble svg {
	width: 24px;
	height: 24px;
}

.hrs-bubble .hrs-bubble-icon-open img,
.hrs-bubble img.hrs-bubble-icon-open {
	width: 28px;
	height: 28px;
	object-fit: contain;
	border-radius: 4px;
}

.hrs-bubble .hrs-bubble-icon-close { display: none; }

.hrs-open .hrs-bubble .hrs-bubble-icon-open  { display: none; }
.hrs-open .hrs-bubble .hrs-bubble-icon-close { display: block; }
.hrs-open .hrs-bubble { transform: none; }
.hrs-open .hrs-bubble::before { animation: none; opacity: 0; }

/* =================================================================== Panel */
.hrs-panel {
	position: absolute;
	right: 0;
	bottom: calc(var(--hrs-bubble-size) + 16px);
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 100px);
	background: #fff;
	border-radius: var(--hrs-panel-radius);
	box-shadow: var(--hrs-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	transform: scale(.92) translateY(12px);
	opacity: 0;
	pointer-events: none;
	transition: transform .25s cubic-bezier(.22,.68,0,1), opacity .2s ease;
}

.hrs-pos-bottom-left .hrs-panel { right: auto; left: 0; transform-origin: bottom left; }

.hrs-open .hrs-panel {
	transform: scale(1) translateY(0);
	opacity: 1;
	pointer-events: auto;
}

.hrs-panel[hidden] { display: none !important; }

/* =================================================================== Header */
.hrs-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 12px 14px 16px;
	background: var(--hrs-primary);
	color: #fff;
	position: relative;
}

.hrs-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.hrs-avatar-header {
	width: var(--hrs-avatar-size);
	height: var(--hrs-avatar-size);
	border-radius: 10px;
	background: rgba(255,255,255,.15);
	color: #fff;
}

.hrs-avatar-msg {
	width: var(--hrs-avatar-size);
	height: var(--hrs-avatar-size);
	border-radius: 10px;
	background: #fff;
	color: var(--hrs-primary);
	border: 1px solid #e2e8f0;
	margin-top: 4px;
}

.hrs-avatar-user {
	background: var(--hrs-primary);
	color: #fff;
	border-color: transparent;
	margin-top: 4px;
}

.hrs-avatar svg { width: 16px; height: 16px; }
.hrs-avatar img,
.hrs-custom-icon { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

/* Bubble notification badge */
.hrs-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(239,68,68,.4);
	pointer-events: none;
	animation: hrs-badge-in .25s cubic-bezier(.34,1.56,.64,1);
}

.hrs-pos-bottom-left .hrs-badge {
	right: auto;
	left: -4px;
}

@keyframes hrs-badge-in {
	from { transform: scale(.5); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

.hrs-header-text { flex: 1; min-width: 0; }

.hrs-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -.02em;
	color: #fff;
	line-height: 1.3;
}

.hrs-subtitle {
	margin: 1px 0 0;
	font-size: 12px;
	opacity: .85;
	display: flex;
	align-items: center;
	gap: 6px;
	color: #fff;
	font-weight: 400;
}

.hrs-online-dot {
	width: 7px;
	height: 7px;
	background: #22c55e;
	border-radius: 50%;
	display: inline-block;
	animation: hrs-pulse 2.5s ease-in-out infinite;
}

@keyframes hrs-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50%      { opacity: .6; transform: scale(.85); }
}

.hrs-close {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
	flex-shrink: 0;
}

.hrs-close:hover,
.hrs-close:focus-visible {
	background: rgba(255,255,255,.15);
	outline: none;
}

.hrs-close svg { width: 18px; height: 18px; }

.hrs-minimize {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
	flex-shrink: 0;
}

.hrs-minimize:hover,
.hrs-minimize:focus-visible {
	background: rgba(255,255,255,.15);
	outline: none;
}

.hrs-minimize svg { width: 20px; height: 20px; }

/* =================================================================== Body */
.hrs-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	position: relative;
	background: #f8fafc;
}

.hrs-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.hrs-messages::-webkit-scrollbar { width: 5px; }
.hrs-messages::-webkit-scrollbar-track { background: transparent; }
.hrs-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* =================================================================== Messages */
.hrs-msg {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	animation: hrs-fade-in .2s ease-out;
}

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

.hrs-msg-bot     { align-self: flex-start; max-width: 85%; }
.hrs-msg-user    { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }

.hrs-msg-bubble {
	background: #f8fafc;
	color: #0f172a;
	border: 1px solid #e2e8f0;
	border-radius: var(--hrs-msg-radius-bot);
	padding: 12px 16px;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
	max-width: 100%;
	min-width: 60px;
}

.hrs-msg-user .hrs-msg-bubble {
	background: var(--hrs-primary);
	color: #fff;
	border-color: transparent;
	border-radius: var(--hrs-msg-radius-user);
	box-shadow: 0 1px 3px rgba(0,0,0,.10);
}

.hrs-msg-text {
	font-size: 15px;
	line-height: 1.6;
	word-wrap: break-word;
	white-space: none !important;
}

.hrs-msg-text p { margin: 0 0 6px; }
.hrs-msg-text p:last-child { margin-bottom: 0; }
.hrs-msg-text strong { font-weight: 600; }

.hrs-msg-text code {
	background: #f1f5f9;
	padding: 1px 5px;
	border-radius: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
}

.hrs-msg-user .hrs-msg-text code {
	background: rgba(255,255,255,.15);
	color: #fff;
}

.hrs-msg-text ul {
	margin: 4px 0;
	padding-left: 20px;
}

.hrs-msg-text li { margin: 2px 0; }

.hrs-msg-time {
	display: block;
	margin-top: 4px;
	font-size: 10.5px;
	opacity: .5;
	text-align: right;
	letter-spacing: .02em;
}

.hrs-msg-user .hrs-msg-time { color: rgba(255,255,255,.75); }

/* Error banner */
.hrs-msg-error .hrs-msg-bubble {
	background: #fff7ed !important;
	color: #9a3412 !important;
	border-color: #fed7aa !important;
	box-shadow: none !important;
}

.hrs-msg-error .hrs-msg-text {
	color: #9a3412 !important;
}

/* =================================================================== Typing */
.hrs-typing {
	display: inline-flex;
	gap: 4px;
	padding: 4px 0;
}

.hrs-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #94a3b8;
	animation: hrs-bounce 1.3s infinite ease-in-out;
}

.hrs-typing span:nth-child(2) { animation-delay: .15s; }
.hrs-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes hrs-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .3; }
	30%           { transform: translateY(-5px); opacity: .8; }
}

/* =================================================================== Suggestions */
.hrs-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 14px 14px;
	background: linear-gradient(0deg, #f1f5f9, transparent 80%);
}

.hrs-suggestions[hidden] { display: none; }

.hrs-chip {
	font: inherit;
	font-size: 12px;
	font-weight: 500;
	background: #fff;
	border: 1.5px solid #e2e8f0;
	color: #475569;
	padding: 7px 14px;
	border-radius: 20px;
	cursor: pointer;
	transition: all .2s ease;
	line-height: 1.3;
}

.hrs-chip:hover,
.hrs-chip:focus-visible {
	background: #f1f5f9;
	color: var(--hrs-primary);
	border-color: var(--hrs-primary);
	transform: none;
	box-shadow: none;
	outline: none;
}

.hrs-chip:active {
	transform: translateY(0);
}

/* =================================================================== Unread pill */
.hrs-unread {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: var(--hrs-primary);
	color: #fff;
	border: 0;
	border-radius: 20px;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,0,0,.12);
	animation: hrs-slide-up .25s ease-out;
	z-index: 2;
}

.hrs-unread[hidden] { display: none; }

.hrs-unread svg { width: 14px; height: 14px; }

@keyframes hrs-slide-up {
	from { transform: translateX(-50%) translateY(8px); opacity: 0; }
	to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

/* =================================================================== Input form */
.hrs-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 14px 12px;
	background: #fff;
	border-top: 1px solid #e2e8f0;
}

.hrs-input {
	flex: 1;
	resize: none;
	min-height: 40px;
	max-height: 120px;
	padding: 10px 14px;
	border: 1.5px solid #e2e8f0;
	border-radius: 12px;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	outline: none;
	transition: border-color .2s, box-shadow .2s, background .2s;
	background: #f8fafc;
	color: #0f172a;
}

.hrs-input::placeholder { color: #94a3b8; }

.hrs-input:focus {
	border-color: var(--hrs-primary);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* Send button */
.hrs-send {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: var(--hrs-primary);
	color: #fff;
	border: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
	box-shadow: 0 1px 4px rgba(0,0,0,.10);
	flex-shrink: 0;
}

.hrs-send:hover:not(:disabled) {
	transform: translateY(-1px) scale(1.04);
	box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.hrs-send:active:not(:disabled) {
	transform: translateY(0) scale(.96);
}

.hrs-send svg { width: 18px; height: 18px; }

.hrs-send:disabled {
	opacity: .4;
	cursor: not-allowed;
	box-shadow: none;
	transform: none;
}

/* =================================================================== Footer */
.hrs-footer {
	padding: 6px 14px 8px;
	text-align: center;
	font-size: 10.5px;
	color: #94a3b8;
	background: #fff;
	letter-spacing: .02em;
	border-top: 1px solid #f1f5f9;
}

.hrs-footer strong {
	color: #64748b;
	font-weight: 600;
}

/* =================================================================== Close dialog */
.hrs-close-dialog {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,.95);
	z-index: 10;
	padding: 24px;
	text-align: center;
	animation: hrs-fade-in .15s ease-out;
}

.hrs-close-dialog[hidden] { display: none !important; }

.hrs-close-title {
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 600;
	color: #1e293b;
}

.hrs-close-desc {
	margin: 0 0 20px;
	font-size: 13px;
	color: #64748b;
	line-height: 1.4;
}

.hrs-close-actions {
	display: flex;
	gap: 10px;
}

.hrs-close-actions button {
	padding: 9px 20px;
	border-radius: 10px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all .15s ease;
	border: 0;
}

.hrs-close-cancel {
	background: #f1f5f9;
	color: #475569;
}

.hrs-close-cancel:hover {
	background: #e2e8f0;
}

.hrs-close-confirm {
	background: #ef4444;
	color: #fff;
}

.hrs-close-confirm:hover {
	background: #dc2626;
}

/* =================================================================== Mobile */
@media (max-width: 480px) {
	.hrs-pos-bottom-right,
	.hrs-pos-bottom-left {
		right: 0;
		left: 0;
		bottom: 0;
	}

	.hrs-bubble {
		bottom: 16px;
		width: 52px;
		height: 52px;
	}

	.hrs-pos-bottom-right .hrs-bubble {
		right: 16px;
		left: auto;
	}

	.hrs-pos-bottom-left .hrs-bubble {
		left: 16px;
		right: auto;
	}

	.hrs-panel {
		position: fixed;
		right: 0 !important;
		left: 0 !important;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 92vh;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
		transform-origin: bottom center;
	}

	/* Hide the floating bubble when the panel is open — the header
	   already has minimize + close buttons. */
	.hrs-open .hrs-bubble {
		display: none;
	}

	.hrs-msg { max-width: 92%; }
	.hrs-suggestions { padding-left: 12px; padding-right: 12px; }
}

/* =================================================================== Accessibility */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* =================================================================== Reduced motion */
.hrs-reduced-motion .hrs-bubble,
.hrs-reduced-motion .hrs-panel,
.hrs-reduced-motion .hrs-send,
.hrs-reduced-motion .hrs-chip,
.hrs-reduced-motion .hrs-online-dot,
.hrs-reduced-motion .hrs-typing span,
.hrs-reduced-motion .hrs-unread,
.hrs-reduced-motion .hrs-badge,
.hrs-reduced-motion .hrs-close-dialog {
	transition: none !important;
	animation: none !important;
}

.hrs-reduced-motion .hrs-msg { animation: none !important; }