/**
 * Hear My Cry Assistant — front-end chat widget.
 * Brand: turquoise #00B4B3, gold #F4C430, charcoal #1C2024, generous white space.
 */

#hmc-root {
	--hmc-accent: #00B4B3;
	--hmc-gold: #F4C430;
	--hmc-ink: #1C2024;
	--hmc-paper: #ffffff;
	--hmc-mist: #F4F7F8;
	--hmc-line: #E4EAEC;
	--hmc-muted: #66727A;
	--hmc-radius: 18px;
	--hmc-shadow: 0 18px 48px rgba(16, 32, 38, .18), 0 2px 6px rgba(16, 32, 38, .06);

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

#hmc-root.hmc-right { right: 24px; }
#hmc-root.hmc-left  { left: 24px; }

#hmc-root *,
.hmc-inline * {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------- Launcher */

.hmc-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 22px 13px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--hmc-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .01em;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(0, 180, 179, .34);
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.hmc-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 34px rgba(0, 180, 179, .42);
}

.hmc-launcher:focus-visible {
	outline: 3px solid var(--hmc-gold);
	outline-offset: 3px;
}

.hmc-launcher svg { width: 22px; height: 22px; flex: 0 0 auto; }

.hmc-launcher .hmc-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--hmc-gold);
	margin-left: 2px;
}

.hmc-nudge {
	position: absolute;
	bottom: 68px;
	max-width: 268px;
	background: #fff;
	border: 1px solid var(--hmc-line);
	border-radius: 16px 16px 16px 4px;
	padding: 14px 16px;
	box-shadow: var(--hmc-shadow);
	font-size: 14px;
	color: var(--hmc-ink);
	animation: hmc-rise .3s ease both;
}

#hmc-root.hmc-right .hmc-nudge { right: 0; }
#hmc-root.hmc-left  .hmc-nudge { left: 0; border-radius: 16px 16px 4px 16px; }

.hmc-nudge button {
	position: absolute;
	top: 6px;
	right: 8px;
	border: 0;
	background: transparent;
	color: var(--hmc-muted);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	padding: 4px;
}

/* ------------------------------------------------------------------- Panel */

.hmc-panel {
	width: 396px;
	max-width: calc(100vw - 32px);
	height: 620px;
	max-height: calc(100vh - 96px);
	background: var(--hmc-paper);
	border-radius: var(--hmc-radius);
	box-shadow: var(--hmc-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: hmc-rise .26s cubic-bezier(.22, 1, .36, 1) both;
	border: 1px solid var(--hmc-line);
}

@keyframes hmc-rise {
	from { opacity: 0; transform: translateY(14px) scale(.985); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hmc-head {
	background: linear-gradient(135deg, var(--hmc-accent) 0%, #009A99 100%);
	color: #fff;
	padding: 18px 20px;
	display: flex;
	align-items: center;
	gap: 13px;
	position: relative;
}

.hmc-head::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 3px;
	background: var(--hmc-gold);
	opacity: .9;
}

.hmc-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 16px;
	letter-spacing: .02em;
	flex: 0 0 auto;
	border: 1.5px solid rgba(255, 255, 255, .32);
}

.hmc-head-text { flex: 1 1 auto; min-width: 0; }
.hmc-head-name { font-weight: 650; font-size: 15.5px; letter-spacing: .01em; }
.hmc-head-sub  { font-size: 12.5px; opacity: .86; display: flex; align-items: center; gap: 6px; }
.hmc-head-sub i {
	width: 7px; height: 7px; border-radius: 50%;
	background: #7CE0AE; display: inline-block; font-style: normal;
}

.hmc-head-actions { display: flex; gap: 2px; }

.hmc-icon-btn {
	border: 0;
	background: transparent;
	color: rgba(255, 255, 255, .88);
	cursor: pointer;
	padding: 7px;
	border-radius: 9px;
	line-height: 0;
	transition: background .15s ease;
}
.hmc-icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.hmc-icon-btn:focus-visible { outline: 2px solid var(--hmc-gold); outline-offset: 1px; }
.hmc-icon-btn svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------------ Stream */

.hmc-stream {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 20px;
	background: var(--hmc-mist);
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}

.hmc-stream::-webkit-scrollbar { width: 8px; }
.hmc-stream::-webkit-scrollbar-thumb { background: #D3DDE1; border-radius: 8px; }

.hmc-msg {
	display: flex;
	margin-bottom: 14px;
	animation: hmc-fade .22s ease both;
}

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

.hmc-msg-bubble {
	max-width: 84%;
	padding: 12px 15px;
	border-radius: 16px;
	font-size: 14.7px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.hmc-msg.assistant .hmc-msg-bubble {
	background: #fff;
	border: 1px solid var(--hmc-line);
	border-bottom-left-radius: 5px;
	box-shadow: 0 1px 2px rgba(16, 32, 38, .04);
}

.hmc-msg.user { justify-content: flex-end; }

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

.hmc-msg-bubble a { color: var(--hmc-accent); font-weight: 600; }
.hmc-msg.user .hmc-msg-bubble a { color: var(--hmc-gold); }

.hmc-crisis .hmc-msg-bubble {
	background: #FFF6E8;
	border: 1px solid #F0D089;
	border-left: 4px solid var(--hmc-gold);
}

.hmc-typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid var(--hmc-line);
	border-radius: 16px 16px 16px 5px;
}

.hmc-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #B6C4CA;
	animation: hmc-bounce 1.3s infinite ease-in-out;
}
.hmc-typing span:nth-child(2) { animation-delay: .16s; }
.hmc-typing span:nth-child(3) { animation-delay: .32s; }

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

/* ------------------------------------------------------------- Suggestions */

.hmc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 0 20px 14px;
	background: var(--hmc-mist);
}

.hmc-chip {
	border: 1px solid var(--hmc-line);
	background: #fff;
	color: var(--hmc-ink);
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 13.2px;
	cursor: pointer;
	transition: all .15s ease;
	font-family: inherit;
}

.hmc-chip:hover {
	border-color: var(--hmc-accent);
	color: var(--hmc-accent);
	transform: translateY(-1px);
}

.hmc-slot-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.hmc-slot {
	border: 1.5px solid var(--hmc-accent);
	background: rgba(0, 180, 179, .07);
	color: #04807F;
	border-radius: 10px;
	padding: 8px 13px;
	font-size: 13.4px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
}
.hmc-slot:hover { background: var(--hmc-accent); color: #fff; }

/* ----------------------------------------------------------------- Composer */

.hmc-composer {
	border-top: 1px solid var(--hmc-line);
	background: #fff;
	padding: 12px 14px 10px;
}

.hmc-input-row {
	display: flex;
	align-items: flex-end;
	gap: 9px;
	background: var(--hmc-mist);
	border: 1px solid var(--hmc-line);
	border-radius: 14px;
	padding: 7px 7px 7px 14px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.hmc-input-row:focus-within {
	border-color: var(--hmc-accent);
	box-shadow: 0 0 0 3px rgba(0, 180, 179, .13);
}

.hmc-input {
	flex: 1 1 auto;
	border: 0;
	background: transparent;
	resize: none;
	max-height: 120px;
	font-family: inherit;
	font-size: 14.7px;
	line-height: 1.5;
	color: var(--hmc-ink);
	padding: 6px 0;
}
.hmc-input:focus { outline: none; }
.hmc-input::placeholder { color: #94A3AA; }

.hmc-send {
	flex: 0 0 auto;
	width: 38px; height: 38px;
	border: 0;
	border-radius: 11px;
	background: var(--hmc-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background .15s ease, transform .15s ease;
}
.hmc-send:hover:not(:disabled) { transform: translateY(-1px); }
.hmc-send:disabled { background: #C3D0D5; cursor: default; }
.hmc-send svg { width: 17px; height: 17px; }

.hmc-legal {
	margin: 9px 2px 0;
	font-size: 11.4px;
	line-height: 1.45;
	color: var(--hmc-muted);
	text-align: center;
}

.hmc-legal a { color: var(--hmc-muted); text-decoration: underline; }

/* ------------------------------------------------------------------ Inline */

.hmc-inline {
	border: 1px solid #E4EAEC;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgba(16, 32, 38, .07);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hmc-inline .hmc-panel {
	width: 100%;
	max-width: 100%;
	height: 100%;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	animation: none;
}

/* --------------------------------------------------------------------- CTA */

.hmc-cta {
	display: inline-block;
	border: 0;
	border-radius: 999px;
	padding: 14px 30px;
	font-size: 15px;
	font-weight: 650;
	letter-spacing: .01em;
	cursor: pointer;
	font-family: inherit;
	background: #00B4B3;
	color: #fff;
	transition: transform .16s ease, box-shadow .16s ease;
}
.hmc-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 180, 179, .32); }

.hmc-cta-outline {
	background: transparent;
	color: #00B4B3;
	box-shadow: inset 0 0 0 2px #00B4B3;
}
.hmc-cta-outline:hover { background: #00B4B3; color: #fff; }

.hmc-cta-gold { background: #F4C430; color: #1C2024; }
.hmc-cta-gold:hover { box-shadow: 0 10px 26px rgba(244, 196, 48, .38); }

/* ------------------------------------------------------------------ Mobile */

@media (max-width: 520px) {
	#hmc-root { bottom: 16px; }
	#hmc-root.hmc-right { right: 16px; left: 16px; }
	#hmc-root.hmc-left  { left: 16px; right: 16px; }

	.hmc-panel {
		width: 100%;
		height: calc(100vh - 32px);
		max-height: calc(100dvh - 32px);
	}

	.hmc-launcher { padding: 12px 18px 12px 14px; font-size: 14.5px; }
	.hmc-nudge { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
	.hmc-panel, .hmc-msg, .hmc-nudge { animation: none; }
	.hmc-launcher, .hmc-send, .hmc-cta { transition: none; }
	.hmc-typing span { animation: none; }
}
