/**
 * GAPL Intake Bot — front-end styles.
 *
 * Everything is namespaced with .gapl- and most properties are !important-free
 * but highly specific, so an opinionated theme is unlikely to bleed in.
 * Design tokens come from the original widget: deep forest green, warm
 * off-white, Georgia serif for the bot's own voice.
 */

#gapl-bot-root {
	--gapl-green: #2c4a3e;
	--gapl-green-dark: #1e3329;
	--gapl-green-mid: #4a7c6a;
	--gapl-green-soft: #8fbfaa;
	--gapl-dot: #5cd18a;
	--gapl-cream: #f0ede6;
	--gapl-chat-bg: #f7f5f0;
	--gapl-border: #e0ddd6;
	--gapl-border-strong: #b0c8be;
	--gapl-text: #2a2a2a;
	--gapl-muted: #8a8a8a;
	--gapl-radius: 16px;
}

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

.gapl-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99998;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px 12px 14px;
	border: none;
	border-radius: 999px;
	background: var(--gapl-green);
	color: var(--gapl-cream);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
	transition: background 0.15s ease, transform 0.15s ease;
}

.gapl-launcher:hover {
	background: var(--gapl-green-dark);
	transform: translateY(-1px);
}

.gapl-launcher:focus-visible {
	outline: 3px solid var(--gapl-green-soft);
	outline-offset: 2px;
}

.gapl-launcher[hidden] {
	display: none;
}

.gapl-launcher-icon {
	font-size: 17px;
	line-height: 1;
}

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

.gapl-panel {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--gapl-border);
	border-radius: var(--gapl-radius);
	background: #fff;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.26);
	font-family: Arial, Helvetica, sans-serif;
}

.gapl-panel[hidden] {
	display: none;
}

.gapl-header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	padding: 14px 16px;
	background: var(--gapl-green);
}

.gapl-avatar {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--gapl-green-mid);
	font-size: 18px;
	color: var(--gapl-cream);
}

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

.gapl-name {
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 14px;
	font-weight: 500;
	color: var(--gapl-cream);
}

.gapl-status {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	color: var(--gapl-green-soft);
}

.gapl-status-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--gapl-dot);
}

.gapl-close {
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--gapl-cream);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.gapl-close:hover {
	background: rgba(255, 255, 255, 0.14);
}

/* ---------- Email gate ---------- */

.gapl-gate {
	flex: 1;
	overflow-y: auto;
	padding: 24px 20px;
	background: var(--gapl-chat-bg);
}

.gapl-gate h3 {
	margin: 0 0 8px;
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 18px;
	color: var(--gapl-green);
}

.gapl-gate p {
	margin: 0 0 16px;
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--gapl-text);
}

.gapl-field {
	margin-bottom: 12px;
}

.gapl-field label {
	display: block;
	margin-bottom: 4px;
	font-size: 12px;
	color: var(--gapl-green);
}

.gapl-field input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--gapl-border-strong);
	border-radius: 8px;
	background: #fff;
	color: var(--gapl-text);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
}

.gapl-field input:focus {
	outline: none;
	border-color: var(--gapl-green);
	box-shadow: 0 0 0 2px rgba(44, 74, 62, 0.15);
}

/* Honeypot — kept out of sight and out of the tab order. */
.gapl-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.gapl-submit {
	width: 100%;
	padding: 11px 16px;
	border: none;
	border-radius: 999px;
	background: var(--gapl-green);
	color: var(--gapl-cream);
	font-size: 14px;
	cursor: pointer;
}

.gapl-submit:hover {
	background: var(--gapl-green-dark);
}

.gapl-submit:disabled {
	background: #aaa;
	cursor: default;
}

.gapl-gate-note {
	margin-top: 14px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	line-height: 1.5;
	color: var(--gapl-muted);
}

.gapl-gate-note a {
	color: var(--gapl-green);
}

.gapl-error {
	margin: 0 0 12px;
	padding: 9px 12px;
	border-radius: 8px;
	background: #fdeaea;
	color: #8a1f1f;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12.5px;
}

.gapl-error[hidden] {
	display: none;
}

/* ---------- Chat ---------- */

.gapl-chat {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.gapl-chat[hidden] {
	display: none;
}

.gapl-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
	padding: 16px;
	background: var(--gapl-chat-bg);
}

.gapl-msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}

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

.gapl-msg.is-user {
	align-self: flex-end;
}

.gapl-bubble {
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.gapl-msg.is-bot .gapl-bubble {
	border: 1px solid var(--gapl-border);
	border-bottom-left-radius: 4px;
	background: #fff;
	color: var(--gapl-text);
	font-family: Georgia, 'Times New Roman', serif;
}

.gapl-msg.is-user .gapl-bubble {
	border-bottom-right-radius: 4px;
	background: var(--gapl-green);
	color: var(--gapl-cream);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
}

.gapl-time {
	margin-top: 3px;
	font-size: 10px;
	color: #aaa;
}

.gapl-msg.is-user .gapl-time {
	text-align: right;
}

.gapl-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	width: -moz-fit-content;
	width: fit-content;
	padding: 12px 14px;
	border: 1px solid var(--gapl-border);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	background: #fff;
}

.gapl-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--gapl-green-soft);
	animation: gapl-bounce 1.2s infinite;
}

.gapl-typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.gapl-typing span:nth-child(3) {
	animation-delay: 0.4s;
}

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

@media (prefers-reduced-motion: reduce) {
	.gapl-typing span { animation: none; }
	.gapl-launcher { transition: none; }
}

.gapl-cta-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.gapl-cta {
	display: inline-block;
	padding: 7px 12px;
	border: 1.5px solid var(--gapl-green);
	border-radius: 999px;
	background: transparent;
	color: var(--gapl-green);
	font-size: 12px;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.gapl-cta:hover {
	background: var(--gapl-green);
	color: var(--gapl-cream);
}

.gapl-cta.is-primary {
	background: var(--gapl-green);
	color: var(--gapl-cream);
}

.gapl-cta.is-primary:hover {
	background: var(--gapl-green-dark);
}

.gapl-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex-shrink: 0;
	padding: 10px 16px 0;
	border-top: 1px solid var(--gapl-border);
	background: var(--gapl-chat-bg);
}

.gapl-quick[hidden] {
	display: none;
}

.gapl-quick button {
	padding: 6px 11px;
	border: 1px solid var(--gapl-border-strong);
	border-radius: 999px;
	background: #fff;
	color: var(--gapl-green);
	font-size: 12px;
	white-space: nowrap;
	cursor: pointer;
}

.gapl-quick button:hover {
	background: #e8f0ec;
}

.gapl-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	flex-shrink: 0;
	padding: 10px 12px 12px;
	border-top: 1px solid var(--gapl-border);
	background: #fff;
}

.gapl-input {
	flex: 1;
	max-height: 80px;
	padding: 9px 14px;
	border: 1px solid var(--gapl-border-strong);
	border-radius: 20px;
	background: #fff;
	color: var(--gapl-text);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	outline: none;
}

.gapl-input:focus {
	border-color: var(--gapl-green);
}

.gapl-send {
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: var(--gapl-green);
	color: #fff;
	font-size: 15px;
	cursor: pointer;
}

.gapl-send:hover {
	background: var(--gapl-green-dark);
}

.gapl-send:disabled {
	background: #aaa;
	cursor: default;
}

.gapl-disclaimer {
	flex-shrink: 0;
	padding: 5px 12px 8px;
	background: #fff;
	color: var(--gapl-muted);
	font-size: 10px;
	text-align: center;
}

.gapl-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
	.gapl-panel {
		right: 0;
		bottom: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border: none;
		border-radius: 0;
	}

	.gapl-launcher {
		right: 14px;
		bottom: 14px;
	}
}
