/* =========================================================================
   FORE+AFT Help Bot widget
   Self-contained styles (does not rely on Tailwind) so the widget renders
   consistently on every page. Brand: fore #D98B56 on charcoal #050505.
   ========================================================================= */

.fa-bot {
	--fore: #d98b56;
	--fore-dark: #c77b49;
	--charcoal: #050505;
	--panel-bg: #ffffff;
	--ink: #1a1a1a;
	--muted: #5b5b5b;
	--line: rgba(5, 5, 5, 0.12);
	--bot-bubble: #f4f1ee;
	--user-bubble: #d98b56;
	font-family: "Raleway", system-ui, -apple-system, "Segoe UI", sans-serif;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9998;
}

.fa-bot *,
.fa-bot *::before,
.fa-bot *::after {
	box-sizing: border-box;
}

/* ---- Launcher --------------------------------------------------------- */
.fa-bot__launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--fore);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 14px 20px 14px 16px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(5, 5, 5, 0.35);
	transition: transform 0.18s ease, background 0.2s ease;
}
.fa-bot__launcher:hover {
	background: var(--fore-dark);
	transform: translateY(-2px);
}
.fa-bot__launcher:focus-visible {
	outline: 3px solid rgba(217, 139, 86, 0.5);
	outline-offset: 2px;
}
.fa-bot__launcher svg {
	width: 22px;
	height: 22px;
	flex: none;
}
.fa-bot.is-open .fa-bot__launcher {
	display: none;
}

/* ---- Panel ------------------------------------------------------------ */
.fa-bot__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 600px;
	max-height: calc(100vh - 40px);
	background: var(--panel-bg);
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(5, 5, 5, 0.45);
	display: none;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.fa-bot.is-open .fa-bot__panel {
	display: flex;
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ---- Header ----------------------------------------------------------- */
.fa-bot__header {
	background: var(--charcoal);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}
.fa-bot__avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--fore);
	display: grid;
	place-items: center;
	flex: none;
	font-weight: 800;
	color: #fff;
	font-size: 15px;
}
.fa-bot__title {
	line-height: 1.2;
	flex: 1;
	min-width: 0;
}
.fa-bot__title strong {
	display: block;
	font-size: 15px;
	font-weight: 700;
}
.fa-bot__title span {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.fa-bot__title span::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
}
.fa-bot__close,
.fa-bot__clear {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	padding: 4px;
	border-radius: 8px;
	line-height: 0;
}
.fa-bot__close:hover,
.fa-bot__clear:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}
.fa-bot__close svg {
	width: 20px;
	height: 20px;
}
.fa-bot__clear svg {
	width: 18px;
	height: 18px;
}

/* ---- Message log ------------------------------------------------------ */
.fa-bot__log {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	background: #fbfaf9;
	scroll-behavior: smooth;
}
.fa-bot__row {
	display: flex;
	margin-bottom: 12px;
}
.fa-bot__row.is-user {
	justify-content: flex-end;
}
.fa-bot__bubble {
	max-width: 85%;
	padding: 11px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ink);
	background: var(--bot-bubble);
	border-bottom-left-radius: 4px;
	overflow-wrap: anywhere;
}
/* Rich components (tables / cards) need the full panel width to stay readable. */
.fa-bot__bubble:has(table),
.fa-bot__bubble:has(.bot-card) {
	max-width: 100%;
	width: 100%;
}
.fa-bot__row.is-user .fa-bot__bubble {
	background: var(--user-bubble);
	color: #fff;
	border-bottom-left-radius: 14px;
	border-bottom-right-radius: 4px;
}
.fa-bot__bubble p {
	margin: 0 0 8px;
}
.fa-bot__bubble p:last-child {
	margin-bottom: 0;
}
/* Restore list markers: the site's CSS framework (Preflight) strips list-style
   on ul/ol globally, which left these lists with blank left padding and no
   bullets/numbers. Re-assert them at class specificity so markers show. */
.fa-bot__bubble ul,
.fa-bot__bubble ol {
	margin: 4px 0 8px;
	padding-left: 22px;
	list-style-position: outside;
}
.fa-bot__bubble ul {
	list-style-type: disc;
}
.fa-bot__bubble ol {
	list-style-type: decimal;
}
.fa-bot__bubble li {
	display: list-item;
	list-style: inherit;
	margin-bottom: 4px;
}
.fa-bot__bubble a {
	color: var(--fore-dark);
	font-weight: 600;
}
.fa-bot__row.is-user .fa-bot__bubble a {
	color: #fff;
	text-decoration: underline;
}

/* ---- Approved HTML components ---------------------------------------- */
.fa-bot__bubble table {
	width: 100%;
	border-collapse: collapse;
	margin: 6px 0;
	font-size: 13px;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
}
.fa-bot__bubble th {
	background: var(--charcoal);
	color: #fff;
	text-align: left;
	padding: 8px 10px;
	font-weight: 700;
}
.fa-bot__bubble td {
	padding: 8px 10px;
	border-top: 1px solid var(--line);
	vertical-align: top;
	overflow-wrap: anywhere;
	word-break: break-word;
}
.fa-bot__bubble td:first-child {
	color: var(--muted);
	font-weight: 600;
	width: 42%;
}

/* Multi-column line-items grid: horizontal scroll + normal first column
   (overrides the 2-column field/value table styling above). */
.fa-bot__scroll {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.fa-bot__bubble table.bot-grid {
	min-width: 100%;
	white-space: nowrap;
}
.fa-bot__bubble table.bot-grid td {
	white-space: normal;
}
.fa-bot__bubble table.bot-grid td:first-child {
	color: var(--ink);
	font-weight: 400;
	width: auto;
}

.status-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	background: #6b7280;
	white-space: nowrap;
}
.status-badge.in-transit {
	background: #2563eb;
}
.status-badge.customs {
	background: #d97706;
}
.status-badge.delivered {
	background: #16a34a;
}
.status-badge.delayed {
	background: #dc2626;
}
.status-badge.open {
	background: #0891b2;
}
.status-badge.canceled {
	background: #6b7280;
}

.bot-card {
	background: #fff;
	border: 1px solid var(--line);
	border-left: 3px solid var(--fore);
	border-radius: 8px;
	padding: 10px 12px;
	margin: 8px 0 2px;
}
.bot-card strong {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
}
.bot-card p {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
}

a.bot-pill {
	display: inline-block;
	background: var(--fore);
	color: #fff !important;
	text-decoration: none !important;
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	margin: 3px 4px 3px 0;
}
a.bot-pill:hover {
	background: var(--fore-dark);
}

/* ---- Guided option chips --------------------------------------------- */
.fa-bot__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 4px 14px;
}
.fa-bot__chip {
	background: #fff;
	border: 1px solid var(--fore);
	color: var(--fore-dark);
	border-radius: 999px;
	padding: 8px 14px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.fa-bot__chip:hover {
	background: var(--fore);
	color: #fff;
}

/* ---- Inline guided forms --------------------------------------------- */
.fa-bot__form {
	padding: 2px 4px 14px;
}
.fa-bot__form-grid {
	display: grid;
	gap: 10px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 14px;
}
.fa-bot__field label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: var(--ink);
	margin-bottom: 4px;
}
.fa-bot__field label .req {
	color: var(--fore-dark);
}
.fa-bot__field input,
.fa-bot__field textarea {
	width: 100%;
	font-family: inherit;
	font-size: 14px;
	padding: 9px 10px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #fff;
	color: var(--ink);
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fa-bot__field textarea {
	min-height: 74px;
	resize: vertical;
}
.fa-bot__field input:focus,
.fa-bot__field textarea:focus {
	border-color: var(--fore);
	box-shadow: 0 0 0 2px rgba(217, 139, 86, 0.16);
}
.fa-bot__field.has-error input,
.fa-bot__field.has-error textarea {
	border-color: #dc2626;
}
.fa-bot__field-error {
	color: #dc2626;
	font-size: 11px;
	margin-top: 3px;
}
.fa-bot__form-actions {
	display: flex;
	gap: 8px;
	margin-top: 2px;
}
.fa-bot__submit {
	flex: 1;
	background: var(--fore);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 11px 14px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}
.fa-bot__submit:hover {
	background: var(--fore-dark);
}
.fa-bot__submit:disabled {
	opacity: 0.6;
	cursor: default;
}
.fa-bot__cancel {
	background: transparent;
	border: 1px solid var(--line);
	color: var(--muted);
	border-radius: 8px;
	padding: 11px 14px;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
}
/* Single-line reference entry uses the composer look */
.fa-bot__ref {
	display: flex;
	gap: 8px;
	padding: 2px 4px 14px;
}
.fa-bot__ref input {
	flex: 1;
	font-family: inherit;
	font-size: 14px;
	padding: 10px 12px;
	border: 1px solid var(--fore);
	border-radius: 999px;
	outline: none;
	color: var(--ink);
	background: #fff;
}
.fa-bot__ref input::placeholder {
	color: var(--muted);
}

/* ---- Typing indicator ------------------------------------------------- */
.fa-bot__typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
}
.fa-bot__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b7b0a8;
	animation: fa-bot-blink 1.2s infinite ease-in-out both;
}
.fa-bot__typing span:nth-child(2) {
	animation-delay: 0.2s;
}
.fa-bot__typing span:nth-child(3) {
	animation-delay: 0.4s;
}
@keyframes fa-bot-blink {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.4;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

/* ---- Composer --------------------------------------------------------- */
.fa-bot__composer {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--line);
	background: #fff;
}
.fa-bot__composer input {
	flex: 1;
	font-family: inherit;
	font-size: 14px;
	padding: 11px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	outline: none;
	color: var(--ink);
	background: #fff;
	transition: border-color 0.15s ease;
}
.fa-bot__composer input::placeholder {
	color: var(--muted);
}
.fa-bot__composer input:focus {
	border-color: var(--fore);
}
.fa-bot__send {
	flex: none;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: var(--fore);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.fa-bot__send:hover {
	background: var(--fore-dark);
}
.fa-bot__send svg {
	width: 20px;
	height: 20px;
}
.fa-bot__disclaimer {
	font-size: 10px;
	color: #9a948c;
	text-align: center;
	padding: 0 12px 8px;
	background: #fff;
}

/* ---- Mobile: near full-width panel ----------------------------------- */
@media (max-width: 480px) {
	.fa-bot {
		right: 12px;
		bottom: 12px;
	}
	.fa-bot__panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.fa-bot__launcher,
	.fa-bot__panel,
	.fa-bot__typing span {
		transition: none;
		animation: none;
	}
}
