/*
 * Boat Sales Hub — AI search styles.
 *
 * Two components, named BEM-style so each selector says what it styles:
 *
 *   .bsh-search-switch         the Classic / AI Search switch ([rb_search_switch])
 *   .bsh-ai-search             the AI search page (/boat-sales-hub/ai-search/)
 *
 * Fonts come from the theme: everything inherits, and two variables let a
 * site point the components at a different family without touching a rule.
 * Colours are variables too. Override them on the component, e.g.
 *
 *   .bsh-ai-search, .bsh-search-switch { --bsh-ai-ink: #0a2872; }
 *
 * Classes are for styling only. The scripts find elements by their data-
 * attributes (data-bsh-…), so classes can be added to or restyled freely.
 * The full list is in docs/ai-search-styling.md.
 */

.bsh-search-switch,
.bsh-ai-search {
	--bsh-ai-font: inherit;           /* body text, inputs and buttons */
	--bsh-ai-heading-font: inherit;   /* headings */
	--bsh-ai-ink: #232322;            /* text, buttons, the active tab */
	--bsh-ai-on-ink: #ffffff;         /* text on --bsh-ai-ink */
	--bsh-ai-paper: #ffffff;          /* panels, cards, inputs */
	--bsh-ai-background: #f5f5f3;     /* the AI search page behind everything */
	--bsh-ai-border: #c9c9c4;         /* chips, tabs, example buttons */
	--bsh-ai-divider: #dcdcd8;        /* rules and card edges */
	--bsh-ai-muted: #55554f;          /* secondary text */
	--bsh-ai-tint: #eef3f3;           /* the switch while AI Search is chosen */
	--bsh-ai-accent: #2d6a73;         /* focus rings, the sparkle icon */
	--bsh-ai-input-border: #8fa9ad;   /* the AI input boxes */
	--bsh-ai-question: #e2eaeb;       /* the buyer's message bubble */
	--bsh-ai-image-placeholder: #d9dedd;
	--bsh-ai-error: #b32d2e;

	font-family: var(--bsh-ai-font);
}

.bsh-search-switch *,
.bsh-search-switch *::before,
.bsh-search-switch *::after,
.bsh-ai-search *,
.bsh-ai-search *::before,
.bsh-ai-search *::after { box-sizing: border-box; }

/* ═══════════════════════════════════════════════ Classic / AI Search switch */

.bsh-search-switch {
	background: var(--bsh-ai-paper);
	color: var(--bsh-ai-ink);
}
.bsh-search-switch--ai { background: var(--bsh-ai-tint); }

.bsh-search-switch__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 24px;
	padding: 18px 24px;
	border-bottom: 1px solid var(--bsh-ai-divider);
}
.bsh-search-switch__title {
	margin: 0;
	font-family: var(--bsh-ai-heading-font);
	font-size: 1.25rem;
	line-height: 1.2;
	color: inherit;
}

.bsh-search-switch__tabs {
	display: flex;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--bsh-ai-border);
	border-radius: 999px;
	background: var(--bsh-ai-paper);
}
.bsh-search-switch__tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--bsh-ai-ink);
	font: inherit;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}
.bsh-search-switch__tab--active { background: var(--bsh-ai-ink); color: var(--bsh-ai-on-ink); }
.bsh-search-switch__tab:focus-visible { outline: 2px solid var(--bsh-ai-accent); outline-offset: 2px; }

.bsh-search-switch__panel { padding: 20px 24px 24px; }
.bsh-search-switch__panel[hidden] { display: none; }

.bsh-search-switch__form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.bsh-search-switch__label { font-weight: 600; }
.bsh-search-switch__row { display: flex; flex-wrap: wrap; gap: 12px; }
.bsh-search-switch__field {
	flex: 1 1 320px;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 54px;
	padding: 0 16px;
	background: var(--bsh-ai-paper);
	border: 1px solid var(--bsh-ai-input-border);
	color: var(--bsh-ai-accent);
}
.bsh-search-switch__field:focus-within { outline: 2px solid var(--bsh-ai-accent); outline-offset: 1px; }
.bsh-search-switch__input {
	flex: 1;
	min-width: 0;
	padding: 0;
	border: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	color: var(--bsh-ai-ink);
	font: inherit;
	font-size: 1.05rem;
}
.bsh-search-switch__submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 54px;
	padding: 0 32px;
	border: 0;
	background: var(--bsh-ai-ink);
	color: var(--bsh-ai-on-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.bsh-search-switch__submit:hover { filter: brightness(1.15); }
.bsh-search-switch__submit:focus-visible { outline: 2px solid var(--bsh-ai-accent); outline-offset: 2px; }

.bsh-search-switch__examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9rem; }
.bsh-search-switch__examples-label { color: var(--bsh-ai-muted); }
.bsh-search-switch__notice { margin: 0; font-size: 0.8rem; line-height: 1.45; color: var(--bsh-ai-muted); }
.bsh-search-switch__notice a { color: inherit; }

/* Example buttons look the same in both components. */
.bsh-search-switch__example,
.bsh-ai-search__example,
.bsh-ai-search__quick-reply {
	min-height: 36px;
	padding: 0 16px;
	border: 1px solid var(--bsh-ai-border);
	border-radius: 999px;
	background: var(--bsh-ai-paper);
	color: var(--bsh-ai-ink);
	font: inherit;
	font-size: 0.9rem;
	text-align: left;
	cursor: pointer;
}
.bsh-search-switch__example:hover,
.bsh-ai-search__example:hover,
.bsh-ai-search__quick-reply:hover { border-color: var(--bsh-ai-ink); }

@media (max-width: 600px) {
	.bsh-search-switch__header,
	.bsh-search-switch__panel { padding-left: 16px; padding-right: 16px; }
	.bsh-search-switch__tabs { width: 100%; }
	.bsh-search-switch__tab { flex: 1; justify-content: center; padding: 0 10px; }
	.bsh-search-switch__submit { width: 100%; }
}

/* ═════════════════════════════════════════════════════════ AI search page */

body.bsh-ai-search-page { margin: 0; background: #f5f5f3; }

.bsh-ai-search {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bsh-ai-background);
	color: var(--bsh-ai-ink);
}
.bsh-ai-search a { color: var(--bsh-ai-ink); }

/* ── header ── */
.bsh-ai-search__header { background: var(--bsh-ai-paper); border-bottom: 1px solid var(--bsh-ai-divider); }
.bsh-ai-search__header-inner {
	max-width: 1120px;
	margin: 0 auto;
	padding: 12px 20px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.bsh-ai-search__back-link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	font-weight: 600;
	text-decoration: none;
}
.bsh-ai-search__brand { display: flex; align-items: center; gap: 14px; }
.bsh-ai-search__brand img { display: block; max-height: 40px; width: auto; }
.bsh-ai-search__beta-badge {
	padding: 4px 12px;
	border-radius: 999px;
	background: #dfe9ea;
	color: #1f4d54;
	font-size: 0.8rem;
	font-weight: 600;
}

/* ── main column ── */
.bsh-ai-search__main {
	flex: 1;
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	padding: 36px 20px 24px;
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.bsh-ai-search__intro[hidden] { display: none; }
.bsh-ai-search__intro-title,
.bsh-ai-search__policy h1 {
	margin: 0 0 10px;
	font-family: var(--bsh-ai-heading-font);
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	line-height: 1.15;
	color: inherit;
}
.bsh-ai-search__intro-text { margin: 0 0 18px; font-size: 1.05rem; line-height: 1.55; color: var(--bsh-ai-muted); }
.bsh-ai-search__examples,
.bsh-ai-search__quick-replies { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── the conversation ── */
.bsh-ai-search__conversation { display: flex; flex-direction: column; gap: 28px; }

.bsh-ai-search__question {
	align-self: flex-end;
	max-width: 80%;
	margin: 0;
	padding: 14px 20px;
	background: var(--bsh-ai-question);
	border-radius: 18px 18px 4px 18px;
	font-size: 1.05rem;
	line-height: 1.4;
	scroll-margin-top: 20px;
}

.bsh-ai-search__answer { display: flex; flex-direction: column; gap: 16px; }
.bsh-ai-search__loading { margin: 0; color: var(--bsh-ai-muted); }
.bsh-ai-search__reply { margin: 0; font-size: 1.05rem; line-height: 1.55; }
.bsh-ai-search__error { color: var(--bsh-ai-error); }

/* what the search understood */
.bsh-ai-search__understood { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--bsh-ai-muted); }
.bsh-ai-search__filter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border: 1px solid var(--bsh-ai-border);
	border-radius: 999px;
	background: var(--bsh-ai-paper);
	color: var(--bsh-ai-ink);
}
.bsh-ai-search__filter-remove {
	padding: 0 2px;
	border: 0;
	background: transparent;
	color: var(--bsh-ai-muted);
	font-size: 1.05rem;
	line-height: 1;
	cursor: pointer;
}
.bsh-ai-search__filter-remove:hover { color: var(--bsh-ai-error); }
.bsh-ai-search__classic-link { font-weight: 600; }

/* boat cards */
.bsh-ai-search__boats {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	padding: 2px 2px 10px;
	scroll-snap-type: x mandatory;
}
.bsh-ai-search__boat {
	flex: 0 0 264px;
	display: flex;
	flex-direction: column;
	background: var(--bsh-ai-paper);
	border: 1px solid var(--bsh-ai-divider);
	scroll-snap-align: start;
}
.bsh-ai-search__boat-image-link { display: block; aspect-ratio: 3 / 2; background: var(--bsh-ai-image-placeholder); overflow: hidden; }
.bsh-ai-search__boat-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.bsh-ai-search__boat-details { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 14px 16px 16px; }
.bsh-ai-search__boat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bsh-ai-search__boat-price { font-size: 1.4rem; font-weight: 700; }
.bsh-ai-search__boat-make { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bsh-ai-muted); }
.bsh-ai-search__boat-specs { margin: 0; font-size: 0.875rem; color: #3d3d39; white-space: pre-wrap; }
.bsh-ai-search__boat-title { font-weight: 600; text-decoration: none; }
.bsh-ai-search__boat-title:hover { text-decoration: underline; }
.bsh-ai-search__boat-location { margin: 0; font-size: 0.875rem; color: var(--bsh-ai-muted); }

.bsh-ai-search__view-all { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.bsh-ai-search__view-all::after { content: "›"; margin-left: 6px; font-size: 1.2em; }

.bsh-ai-search__suggestions { margin: -8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 1.05rem; line-height: 1.5; }

/* "ask us to find one" */
.bsh-ai-search__wanted-button {
	align-self: flex-start;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid var(--bsh-ai-ink);
	background: var(--bsh-ai-paper);
	color: var(--bsh-ai-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.bsh-ai-search__wanted { scroll-margin-top: 20px; }
.bsh-ai-search__wanted[hidden] { display: none; }

/* ── the reply box, fixed to the bottom ── */
.bsh-ai-search__composer {
	position: sticky;
	bottom: 0;
	background: var(--bsh-ai-background);
	border-top: 1px solid #e4e4e0;
}
.bsh-ai-search__composer-form { max-width: 880px; margin: 0 auto; padding: 14px 20px 10px; display: flex; flex-direction: column; gap: 8px; }
.bsh-ai-search__composer-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 6px 6px 20px;
	background: var(--bsh-ai-paper);
	border: 1px solid var(--bsh-ai-input-border);
	border-radius: 999px;
}
.bsh-ai-search__composer-row:focus-within { outline: 2px solid var(--bsh-ai-accent); outline-offset: 1px; }
.bsh-ai-search__composer-input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0;
	border: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	color: var(--bsh-ai-ink);
	font: inherit;
	font-size: 1.05rem;
}
.bsh-ai-search__composer-send {
	flex: none;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: var(--bsh-ai-ink);
	color: var(--bsh-ai-on-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.bsh-ai-search__notice { margin: 0; text-align: center; font-size: 0.75rem; line-height: 1.45; color: var(--bsh-ai-muted); }
.bsh-ai-search__notice a { color: inherit; }

/* ── the AI search data page ── */
.bsh-ai-search__policy { max-width: 70ch; font-size: 1.05rem; line-height: 1.6; }
.bsh-ai-search__policy h2 { margin: 28px 0 8px; font-family: var(--bsh-ai-heading-font); font-size: 1.2rem; color: inherit; }
.bsh-ai-search__policy p,
.bsh-ai-search__policy ul { margin: 0 0 12px; }

/* Visually hidden, still read aloud. */
.bsh-ai-search__visually-hidden,
.bsh-search-switch__visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
