/* GeoPoll AI Chat. Colors follow the GeoPoll palette. */
.gpai-chat {
	--gpai-blue: #4398B6;
	--gpai-dark: #1C414B;
	--gpai-text: #464E4E;
	--gpai-light: #A0D8E5;
	--gpai-orange: #E67134;
	--gpai-gray: #B5BDBD;
	--gpai-bg: #FFFFFF;
	--gpai-soft: rgba(160, 216, 229, 0.16); /* A light tint of #A0D8E5. */
	--gpai-yellow: #FFBA02;
	--gpai-red: #E74C3C;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--gpai-text);
	box-sizing: border-box;
}
.gpai-chat *, .gpai-chat *::before, .gpai-chat *::after { box-sizing: inherit; }

/* Floating widget */
.gpai-chat--widget {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
}
.gpai-launcher {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--gpai-blue);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(28, 65, 75, 0.25);
}
.gpai-launcher:hover { background: var(--gpai-dark); }
.gpai-chat--widget.is-open .gpai-launcher { display: none; }
.gpai-chat--widget .gpai-panel {
	width: min(400px, calc(100vw - 32px));
	height: min(620px, calc(100vh - 40px));
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(28, 65, 75, 0.28);
}

/* Full page (shortcode) */
.gpai-chat--page .gpai-panel {
	width: 100%;
	max-width: 820px;
	height: min(720px, 80vh);
	margin: 0 auto;
	border: 1px solid var(--gpai-light);
	border-radius: 14px;
}

.gpai-panel {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--gpai-bg);
}
.gpai-panel[hidden] { display: none; }

.gpai-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 16px;
	background: var(--gpai-dark);
	color: #fff;
}
.gpai-title { flex: 1; font-weight: 700; font-size: 16px; }
.gpai-reset, .gpai-close {
	border: 0;
	background: transparent;
	color: var(--gpai-light);
	font: inherit;
	cursor: pointer;
	padding: 4px 6px;
}
.gpai-reset { font-size: 13px; }
.gpai-close { font-size: 24px; line-height: 1; }
.gpai-reset:hover, .gpai-close:hover { color: #fff; }

.gpai-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--gpai-soft);
}

.gpai-msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 12px;
	word-wrap: break-word;
}
.gpai-msg p { margin: 0 0 8px; }
.gpai-msg p:last-child { margin-bottom: 0; }
.gpai-msg ul { margin: 4px 0 8px; padding-left: 20px; }
.gpai-msg a { color: var(--gpai-blue); }
.gpai-msg--user {
	align-self: flex-end;
	background: var(--gpai-blue);
	color: #fff;
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}
.gpai-msg--assistant {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--gpai-light);
	border-bottom-left-radius: 4px;
}
.gpai-msg--error {
	align-self: flex-start;
	background: #fff;
	color: var(--gpai-text);
	border: 1px solid var(--gpai-red);
	border-left-width: 4px;
}

.gpai-cite {
	display: inline-block;
	min-width: 18px;
	padding: 0 5px;
	margin: 0 1px;
	border-radius: 9px;
	background: var(--gpai-light);
	color: var(--gpai-dark) !important;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	text-decoration: none;
	vertical-align: 2px;
}

.gpai-sources {
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid var(--gpai-light);
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.gpai-sources-label {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--gpai-gray);
}
.gpai-source {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 8px;
	text-decoration: none;
	color: var(--gpai-dark) !important;
	font-size: 13px;
}
.gpai-source:hover .gpai-source-title { text-decoration: underline; }
.gpai-source-n {
	grid-row: span 2;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--gpai-light);
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}
.gpai-source-title { font-weight: 600; }
.gpai-source-meta { font-size: 12px; color: var(--gpai-orange); }

.gpai-suggestions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.gpai-chip {
	border: 1px solid var(--gpai-blue);
	background: #fff;
	color: var(--gpai-dark);
	border-radius: 16px;
	padding: 6px 12px;
	font: inherit;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
}
.gpai-chip:hover { background: var(--gpai-light); }

/* Clickable answers under a question. */
.gpai-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gpai-choice {
	border: 1px solid var(--gpai-blue);
	background: #fff;
	color: var(--gpai-dark);
	border-radius: 16px;
	padding: 6px 12px;
	font: inherit;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
}
.gpai-choice:hover, .gpai-choice:focus-visible { background: var(--gpai-light); outline: none; }
.gpai-choice--other { border-style: dashed; color: var(--gpai-text); }

.gpai-typing { display: flex; gap: 4px; padding: 14px; }
.gpai-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--gpai-blue);
	animation: gpai-dot 1.2s infinite ease-in-out;
}
.gpai-typing span:nth-child(2) { animation-delay: 0.15s; }
.gpai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gpai-dot {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

.gpai-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--gpai-light);
	background: #fff;
}
.gpai-input {
	flex: 1;
	resize: none;
	min-height: 42px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--gpai-gray);
	border-radius: 10px;
	font: inherit;
	color: var(--gpai-text);
}
.gpai-input:focus { outline: 2px solid var(--gpai-light); border-color: var(--gpai-blue); }
.gpai-send {
	border: 0;
	border-radius: 10px;
	padding: 0 18px;
	background: var(--gpai-orange);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.gpai-send:disabled { opacity: 0.6; cursor: default; }
.gpai-note {
	padding: 0 12px 10px;
	background: #fff;
	font-size: 11px;
	color: var(--gpai-text);
}

@media (max-width: 480px) {
	.gpai-chat--widget { right: 12px; bottom: 12px; }
	.gpai-chat--widget.is-open { right: 0; bottom: 0; left: 0; top: 0; }
	.gpai-chat--widget .gpai-panel { width: 100vw; height: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.gpai-typing span { animation: none; }
}

/* Lead cards: newsletter prompt and project enquiry */
.gpai-card {
	position: relative;
	margin-top: 12px;
	padding: 12px;
	border-radius: 10px;
	background: var(--gpai-soft);
	border: 1px solid var(--gpai-light);
	font-size: 14px;
}
.gpai-card--project { border-left: 3px solid var(--gpai-orange); }
.gpai-card--newsletter { padding-right: 32px; }
.gpai-card--done { color: var(--gpai-dark); }
.gpai-card-title { font-weight: 600; color: var(--gpai-dark); margin-bottom: 4px; }
.gpai-card-text { margin: 0 0 8px; }
.gpai-card-fine { margin: 6px 0 0; font-size: 12px; color: var(--gpai-text); }
.gpai-card-fine a, .gpai-card-link { color: var(--gpai-blue); }
.gpai-card-error { margin: 6px 0 0; padding-left: 8px; font-size: 13px; color: var(--gpai-text); border-left: 3px solid var(--gpai-red); }
.gpai-card-form { display: flex; flex-direction: column; gap: 6px; }
.gpai-card-form--inline { flex-direction: row; flex-wrap: wrap; }
.gpai-card-form--inline .gpai-field { flex: 1 1 120px; min-width: 0; }
.gpai-field {
	width: 100%;
	padding: 7px 10px;
	border: 1px solid var(--gpai-gray);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	font-size: 14px;
	color: var(--gpai-text);
}
.gpai-field:focus { outline: 2px solid var(--gpai-light); border-color: var(--gpai-blue); }
textarea.gpai-field { resize: vertical; }
.gpai-card-button {
	display: inline-block;
	align-self: flex-start;
	border: 0;
	border-radius: 8px;
	padding: 7px 14px;
	background: var(--gpai-orange);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}
.gpai-card-button:disabled { opacity: 0.6; cursor: default; }
.gpai-card-links { margin-top: 8px; font-size: 13px; }
.gpai-card-dismiss {
	position: absolute;
	top: 4px;
	right: 6px;
	border: 0;
	background: none;
	color: var(--gpai-text);
	font-size: 18px;
	line-height: 1;
	padding: 4px;
	cursor: pointer;
}
.gpai-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.gpai-card-extras { display: flex; flex-direction: column; gap: 6px; }
.gpai-card-extras:empty { display: none; }
.gpai-card-brief summary { cursor: pointer; font-size: 13px; color: var(--gpai-blue); padding: 2px 0; }
.gpai-card-brief[open] summary { margin-bottom: 6px; }

/* Sample size table. */
.gpai-sample-table { width: 100%; border-collapse: collapse; margin: 6px 0 8px; font-size: 13px; }
.gpai-sample-table th, .gpai-sample-table td { padding: 5px 4px; text-align: center; border-bottom: 1px solid var(--gpai-light); }
.gpai-sample-table th { font-weight: 600; color: var(--gpai-dark); }
.gpai-sample-table tr th:first-child { text-align: left; font-weight: 600; }
.gpai-sample-table tr:first-child th:first-child { font-weight: 400; color: var(--gpai-text); }
.gpai-sample-pick {
	min-width: 56px;
	border: 1px solid var(--gpai-blue);
	background: #fff;
	color: var(--gpai-dark);
	border-radius: 14px;
	padding: 4px 8px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.gpai-sample-pick:hover, .gpai-sample-pick:focus-visible { background: var(--gpai-light); outline: none; }
.gpai-sample-note { font-size: 12px; color: var(--gpai-text); opacity: 0.85; }

/* Admin debug panel. */
.gpai-debug { margin-top: 10px; font-size: 12px; color: var(--gpai-text); border-top: 1px dashed var(--gpai-gray); padding-top: 6px; }
.gpai-debug summary { cursor: pointer; color: var(--gpai-dark); }
.gpai-debug ol { margin: 6px 0; padding-left: 18px; }
.gpai-debug-passages li { margin-bottom: 4px; }
.gpai-debug-score { display: inline-block; min-width: 42px; font-weight: 600; color: var(--gpai-blue); }
.gpai-debug-snippet { display: block; opacity: 0.8; }
.gpai-debug-tool { white-space: pre-wrap; background: #fff; border: 1px solid var(--gpai-light); border-radius: 6px; padding: 6px; margin: 4px 0; font-size: 11px; }
