/* GEI Eye Care Assistant — patient chat widget
   Brand: navy #113358 · Display: Fraunces · Body: Hanken Grotesk */

:root {
	--gei-navy: #113358;
	--gei-navy-700: #0c2742;
	--gei-ink: #1b2733;
	--gei-muted: #5b6b7a;
	--gei-line: #e3e8ee;
	--gei-bg: #ffffff;
	--gei-bubble-bot: #f1f5f9;
	--gei-bubble-user: #113358;
	--gei-accent: #c8893f;          /* warm brass — used only on the call action */
	--gei-radius: 16px;
	--gei-shadow: 0 18px 50px rgba(17, 51, 88, 0.22);
	--gei-font-body: "Hanken Grotesk", system-ui, sans-serif;
	--gei-font-display: "Fraunces", Georgia, serif;
}

#gei-assistant-root, #gei-assistant-inline { font-family: var(--gei-font-body); }

/* Launcher --------------------------------------------------------------- */
.gei-launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99998;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	border: none;
	cursor: pointer;
	padding: 13px 19px 13px 15px;
	border-radius: 999px;
	background: var(--gei-launcher-bg, var(--gei-navy));
	color: #fff;
	font-family: var(--gei-font-body);
	font-size: 15px;
	font-weight: 600;
	box-shadow: var(--gei-shadow);
	transition: transform .18s ease, filter .18s ease;
}
.gei-launcher:hover { transform: translateY(-2px); filter: brightness(.9); }
.gei-launcher:focus-visible { outline: 3px solid var(--gei-accent); outline-offset: 2px; }
.gei-launcher svg { width: 22px; height: 22px; }
.gei-launcher.gei-hidden { display: none; }

/* Corner placement for the floating launcher (small button — fine in any corner) */
.gei-launcher.gei-pos-bottom-right { right: 22px; bottom: 22px; top: auto;  left: auto; }
.gei-launcher.gei-pos-bottom-left  { left: 22px;  bottom: 22px; top: auto;  right: auto; }
.gei-launcher.gei-pos-top-right    { right: 22px; top: 22px;    bottom: auto; left: auto; }
.gei-launcher.gei-pos-top-left     { left: 22px;  top: 22px;    bottom: auto; right: auto; }
/* Vertically centred on the left or right edge */
.gei-launcher.gei-pos-middle-left  { left: 22px;  top: 50%; transform: translateY(-50%); right: auto; bottom: auto; }
.gei-launcher.gei-pos-middle-right { right: 22px; top: 50%; transform: translateY(-50%); left: auto;  bottom: auto; }
.gei-launcher.gei-pos-middle-left:hover, .gei-launcher.gei-pos-middle-right:hover { transform: translateY(-50%); }

/* Inline placement via [gei_assistant] shortcode — sits in page content, not fixed */
.gei-launcher.gei-inline { position: static; right: auto; bottom: auto; box-shadow: 0 6px 16px rgba(17,51,88,.18); }

/* Panel ------------------------------------------------------------------ */
/* Mobile-first: fills the screen so the header (title + close) is always visible. */
.gei-panel {
	position: fixed;
	inset: 0;
	z-index: 99999;
	width: 100%;
	height: 100vh;
	height: 100dvh; /* avoids overflow under mobile browser toolbars */
	display: flex;
	flex-direction: column;
	background: var(--gei-bg);
	box-shadow: var(--gei-shadow);
	overflow: hidden;
	animation: gei-rise .22s ease;
}
@keyframes gei-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Header */
.gei-header {
	background: var(--gei-navy);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.gei-header h2 {
	font-family: var(--gei-font-display);
	font-weight: 600;
	font-size: 18px;
	line-height: 1.2;
	margin: 0;
	color: #fff;
}
.gei-header p { margin: 2px 0 0; font-size: 12px; opacity: .82; }
.gei-close {
	background: transparent; border: none; color: #fff; cursor: pointer;
	font-size: 22px; line-height: 1; padding: 4px; border-radius: 8px;
}
.gei-close:hover { background: rgba(255,255,255,.12); }
.gei-close:focus-visible { outline: 2px solid var(--gei-accent); outline-offset: 1px; }

/* Disclaimer strip */
.gei-disclaimer {
	background: #fbf7f0;
	color: #7a5a2c;
	font-size: 11.5px;
	line-height: 1.4;
	padding: 8px 18px;
	border-bottom: 1px solid var(--gei-line);
}

/* Messages */
.gei-messages {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}
.gei-msg { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.gei-msg.bot  { align-self: flex-start; background: var(--gei-bubble-bot); color: var(--gei-ink); border-bottom-left-radius: 5px; }
.gei-msg.user { align-self: flex-end;  background: var(--gei-bubble-user); color: #fff; border-bottom-right-radius: 5px; }

/* Bot bubbles that contain a table or a map can use more width. */
.gei-msg.bot.gei-wide { max-width: 96%; white-space: normal; }
.gei-msg strong { font-weight: 600; }
.gei-msg a { color: var(--gei-navy); text-decoration: underline; word-break: break-word; }
.gei-msg.user a { color: #fff; }
.gei-map { margin: 6px 0; }
.gei-map iframe { width: 100%; height: 180px; border: 0; border-radius: 10px; display: block; }
.gei-map-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 13.5px; font-weight: 600; color: var(--gei-navy); text-decoration: none; }
.gei-map-link:hover { text-decoration: underline; }
.gei-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 4px 0; }
.gei-msg table { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; border-radius: 8px; overflow: hidden; }
.gei-msg th, .gei-msg td { border: 1px solid var(--gei-line); padding: 6px 9px; text-align: left; vertical-align: top; white-space: nowrap; }
.gei-msg td:last-child { white-space: normal; }
.gei-msg thead th { background: var(--gei-navy); color: #fff; font-weight: 600; }
.gei-msg tbody tr:nth-child(even) td { background: #f6f9fc; }

/* Call-now action — the one bright moment in the UI */
.gei-callbtn {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 2px;
	text-decoration: none;
	background: var(--gei-accent);
	color: #fff;
	font-weight: 600;
	font-size: 14.5px;
	padding: 11px 18px;
	border-radius: 12px;
	box-shadow: 0 6px 16px rgba(200, 137, 63, .35);
}
.gei-callbtn:hover { filter: brightness(.96); }
.gei-callbtn svg { width: 18px; height: 18px; }

/* Typing indicator */
.gei-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--gei-bubble-bot); border-radius: 14px; }
.gei-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa7b4; animation: gei-blink 1.2s infinite both; }
.gei-typing span:nth-child(2) { animation-delay: .2s; }
.gei-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes gei-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* Quick-start chips */
.gei-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; background: #fafbfc; }
.gei-chip {
	border: 1px solid var(--gei-line); background: #fff; color: var(--gei-navy);
	font-family: var(--gei-font-body); font-size: 13px; cursor: pointer;
	padding: 7px 12px; border-radius: 999px;
}
.gei-chip:hover { border-color: var(--gei-navy); }

/* Composer */
.gei-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--gei-line); background: #fff; }
.gei-input {
	flex: 1; resize: none; border: 1px solid var(--gei-line); border-radius: 12px;
	padding: 11px 13px; font-family: var(--gei-font-body); font-size: 14.5px; line-height: 1.4;
	max-height: 96px; color: var(--gei-ink);
}
.gei-input:focus { outline: none; border-color: var(--gei-navy); }
.gei-send {
	border: none; cursor: pointer; background: var(--gei-navy); color: #fff;
	width: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.gei-send:hover { background: var(--gei-navy-700); }
.gei-send:disabled { opacity: .5; cursor: default; }
.gei-send svg { width: 20px; height: 20px; }

/* Desktop / tablet: shrink to a floating card anchored to the chosen corner. */
@media (min-width: 481px) {
	.gei-panel {
		inset: auto;
		right: 22px;
		bottom: 22px;
		width: 380px;
		max-width: calc(100vw - 32px);
		height: 600px;
		max-height: calc(100vh - 44px);
		border-radius: var(--gei-radius);
	}
	.gei-panel.gei-pos-bottom-right { right: 22px; bottom: 22px; top: auto;  left: auto; }
	.gei-panel.gei-pos-bottom-left  { left: 22px;  bottom: 22px; top: auto;  right: auto; }
	.gei-panel.gei-pos-top-right    { right: 22px; top: 22px;    bottom: auto; left: auto; }
	.gei-panel.gei-pos-top-left     { left: 22px;  top: 22px;    bottom: auto; right: auto; }
}
/* Small screens: respect notch/home-indicator safe areas and keep the launcher tidy. */
@media (max-width: 480px) {
	.gei-header { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
	.gei-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
	.gei-messages { padding: 14px; }
	.gei-msg { max-width: 90%; font-size: 15px; }
	.gei-launcher { max-width: calc(100vw - 44px); font-size: 14px; }
	.gei-launcher span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
	.gei-panel, .gei-launcher { animation: none; transition: none; }
	.gei-typing span { animation: none; }
}
