/* Fly Bot Assistant — widget styles. Brand colour: Settings → Primary colour (default #2f6b3a). */
.flybot {
	--flybot-primary: #2f6b3a;
	--flybot-primary-2: #3d8a4a;
	--flybot-on-primary: #ffffff;
	--flybot-bot-bg: #f1f4f1;
	--flybot-text: #222222;
	--flybot-muted: #5c635e;
	--flybot-border: #e6e9e6;
	--flybot-height: 600px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--flybot-text);
	box-sizing: border-box;
}
.flybot *, .flybot *::before, .flybot *::after { box-sizing: border-box; }
.flybot button { font: inherit; cursor: pointer; }

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

/* ---------- floating position + launcher ---------- */
.flybot--floating { position: fixed; bottom: 20px; z-index: 999999; }
.flybot--floating.flybot--right { right: 20px; }
.flybot--floating.flybot--left { left: 20px; }

.flybot-launcher {
	width: 60px; height: 60px; border-radius: 50%; border: none;
	background: var(--flybot-primary); color: var(--flybot-on-primary);
	font-size: 28px; line-height: 1; display: flex; align-items: center; justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
	animation: flybot-launcher-in 0.5s ease-out;
}
.flybot-launcher:hover { transform: scale(1.06); }
@keyframes flybot-launcher-in {
	0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
	70%  { transform: scale(1.12) rotate(6deg); opacity: 1; }
	100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ---------- panel ---------- */
.flybot-panel {
	background: #fff; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden;
}
.flybot-panel[hidden] { display: none; }
.flybot--floating .flybot-panel {
	position: absolute; bottom: 74px; width: 370px; max-width: calc(100vw - 40px);
	height: 560px; max-height: calc(100vh - 110px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
	animation: flybot-panel-in 0.2s ease-out;
}
.flybot--floating.flybot--right .flybot-panel { right: 0; }
.flybot--floating.flybot--left .flybot-panel { left: 0; }
.flybot--inline .flybot-panel { height: var(--flybot-height); max-height: 85vh; width: 100%; border: 1px solid var(--flybot-border); }
@keyframes flybot-panel-in {
	0%   { transform: translateY(12px) scale(0.98); opacity: 0; }
	100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- header ---------- */
.flybot-header {
	background: linear-gradient(135deg, var(--flybot-primary), var(--flybot-primary-2));
	color: var(--flybot-on-primary); padding: 12px 14px;
	display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0;
}
.flybot-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.flybot-avatar {
	width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.18);
	display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.flybot-header-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.flybot .flybot-title { margin: 0; font-size: 14px; font-weight: 600; color: inherit; line-height: 1.25; letter-spacing: normal; text-transform: none; }
.flybot-testmode { opacity: 0.8; font-weight: 400; font-size: 11px; }
.flybot-statusline { font-size: 11px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
.flybot-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #7cfc9e; display: inline-block; }
.flybot-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.flybot-hbtn {
	background: none; border: none; color: var(--flybot-on-primary); font-size: 18px; line-height: 1;
	min-width: 30px; min-height: 30px; border-radius: 6px; opacity: 0.9; padding: 0 4px;
}
.flybot-hbtn:hover { opacity: 1; background: rgba(255, 255, 255, 0.14); }
.flybot-new { font-size: 17px; }

/* ---------- messages ---------- */
.flybot-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.flybot-log { flex: 1; overflow-y: auto; padding: 14px; scroll-behavior: smooth; }
.flybot-msg {
	margin-bottom: 12px; padding: 10px 13px; border-radius: 16px; max-width: 88%;
	overflow-wrap: anywhere; word-break: normal;
}
.flybot-msg--bot { background: var(--flybot-bot-bg); color: var(--flybot-text); border-bottom-left-radius: 4px; }
.flybot-msg--user {
	background: var(--flybot-primary); color: var(--flybot-on-primary); margin-left: auto;
	border-bottom-right-radius: 4px; white-space: pre-wrap; width: fit-content;
}
.flybot-msg--error { background: #fcf0f1; color: #8a2424; border: 1px solid #f0b8bd; }
.flybot-answer p { margin: 0 0 8px; }
.flybot-answer p:last-child, .flybot-answer ul:last-child, .flybot-answer ol:last-child { margin-bottom: 0; }
.flybot-answer ul, .flybot-answer ol { margin: 0 0 8px 18px; padding: 0; }
.flybot-answer li { margin: 2px 0; }
.flybot-cite { font-size: 0.72em; margin-left: 1px; }
.flybot-cite a { color: var(--flybot-primary); text-decoration: none; font-weight: 700; padding: 0 1px; }
.flybot-cite a:hover, .flybot-cite a:focus { text-decoration: underline; }

/* typing indicator — three bouncing dots */
.flybot-typing { display: flex; align-items: center; gap: 4px; padding: 13px 15px; width: fit-content; }
.flybot-typing span {
	width: 6px; height: 6px; border-radius: 50%; background: #9aa39c; display: inline-block;
	animation: flybot-bounce 1.2s infinite ease-in-out both;
}
.flybot-typing span:nth-child(2) { animation-delay: 0.15s; }
.flybot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes flybot-bounce { 0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* suggested questions */
.flybot-suggestions { display: flex; flex-direction: column; gap: 6px; margin: -4px 0 12px; }
.flybot-suggestion {
	text-align: left; background: #fff; border: 1px solid var(--flybot-primary); color: var(--flybot-primary);
	border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.flybot-suggestion:hover { background: #eaf2ea; }

/* notices, badges, sources */
.flybot-notice { padding: 7px 9px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.flybot-notice--emergency { background: #fcf0f1; border: 1px solid #d63638; color: #6b1517; font-weight: 600; }
.flybot-notice--medical { background: #fcf9e8; border: 1px solid #dba617; color: #4d3b00; }
.flybot-badge { display: inline-block; margin: 8px 0 0; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: #e4e7e4; color: var(--flybot-muted); }
.flybot-sources { margin-top: 8px; border-top: 1px solid #dde3dd; padding-top: 6px; font-size: 12px; }
.flybot-sources summary { cursor: pointer; font-weight: 600; color: var(--flybot-muted); }
.flybot-sources-list { margin: 4px 0 0 18px; padding: 0; }
.flybot-sources-list li { margin: 4px 0; }
.flybot-sources-list li:target { background: #fff8c5; border-radius: 4px; }
.flybot-sources-list a { color: var(--flybot-primary); }
.flybot-sources-list cite { font-style: italic; }
.flybot-src-meta { color: var(--flybot-muted); }
.flybot-src-loc { display: block; color: var(--flybot-muted); }
.flybot-coll { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; padding: 0 5px; border-radius: 4px; vertical-align: 1px; }
.flybot-coll--ref { background: #e5ecf6; color: #23406b; }
.flybot-coll--site { background: #dff3ea; color: #145c43; }

/* ---------- disclaimer + input ---------- */
.flybot-disclaimer {
	font-size: 11px; color: #666; padding: 8px 14px; border-top: 1px solid #eee; background: #fafafa; flex-shrink: 0;
}
.flybot-form { display: flex; flex-wrap: wrap; align-items: flex-end; border-top: 1px solid #eee; padding: 8px; gap: 6px; flex-shrink: 0; }
.flybot-input {
	flex: 1; min-width: 0; border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px;
	font: inherit; font-size: 14px; line-height: 1.35; color: var(--flybot-text); background: #fff;
	resize: none; min-height: 38px; max-height: 120px; overflow-y: auto;
}
.flybot-send {
	background: var(--flybot-primary); color: var(--flybot-on-primary); border: none; border-radius: 8px;
	width: 38px; height: 38px; font-size: 16px; flex-shrink: 0;
}
.flybot-send:disabled { opacity: 0.55; cursor: progress; }
.flybot-count { flex-basis: 100%; font-size: 11px; color: var(--flybot-muted); text-align: right; }
.flybot-count:empty { display: none; }
.flybot-count--low { color: #b32d2e; }

.flybot :focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
.flybot-header :focus-visible, .flybot-launcher:focus-visible { outline-color: #ffffff; box-shadow: 0 0 0 5px #2271b1; }

/* ---------- mobile: full screen when open ---------- */
@media (max-width: 480px) {
	.flybot--floating.flybot--open { inset: 0; }
	.flybot--floating.flybot--open .flybot-launcher { display: none; }
	.flybot--floating .flybot-panel { position: fixed; inset: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
	.flybot-msg { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
	.flybot-launcher, .flybot-panel { animation: none !important; }
	.flybot-typing span { animation: none; opacity: 0.7; }
	.flybot-log { scroll-behavior: auto; }
}
@media (forced-colors: active) {
	.flybot-msg, .flybot-launcher, .flybot-send, .flybot-suggestion { border: 1px solid CanvasText; }
}
@media print { .flybot--floating { display: none; } }

/* ---------- feedback (1.1) ---------- */
.flybot-fb { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--flybot-border); }
.flybot-fb-label { font-size: 12px; color: var(--flybot-muted); margin-right: 4px; }
.flybot-fb-btn { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; font-size: 15px; line-height: 1.2; opacity: .75; }
.flybot-fb-btn:hover { opacity: 1; background: #ffffff; border-color: var(--flybot-border); }
.flybot-fb-btn--on { opacity: 1; background: #ffffff; border-color: var(--flybot-primary); }
.flybot-fb-extra:empty { display: none; }
.flybot-fb-extra { margin-top: 6px; }
.flybot-fb-text { width: 100%; resize: vertical; min-height: 44px; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--flybot-border); border-radius: 8px; background: #ffffff; color: var(--flybot-text); }
.flybot-fb-actions { display: flex; gap: 8px; margin-top: 6px; }
.flybot-fb-send { background: var(--flybot-primary); color: var(--flybot-on-primary); border: 0; border-radius: 8px; padding: 4px 12px; font-size: 13px; }
.flybot-fb-send:disabled { opacity: .6; }
.flybot-fb-skip { background: transparent; border: 0; color: var(--flybot-muted); font-size: 13px; text-decoration: underline; padding: 4px 2px; }
.flybot-fb-thanks { margin: 0; font-size: 12px; color: var(--flybot-muted); }
.flybot-privacy { color: var(--flybot-muted); }
