/* ============================================================================
 * Booking Gap — the Booking Architect
 *
 * A focused tool, not a marketing page: conversation left, live record right.
 * Brand Standards v3.0 — cream paper, ink, one red accent. Navy appears nowhere.
 *
 * The site nav is position:fixed at 83px with z-index 100, so this whole app
 * offsets beneath it. Two competing sticky bars is exactly the kind of seam
 * that makes a tool feel unfinished.
 * ========================================================================= */

:root {
	--bga-nav-h: 84px;
	--bga-rail: 400px;
	--bga-line: rgba(14, 14, 16, 0.09);
	--bga-line-strong: rgba(14, 14, 16, 0.16);
	--bga-ink-soft: rgba(14, 14, 16, 0.58);
	--bga-ink-faint: rgba(14, 14, 16, 0.4);
	--bga-lift: 0 1px 2px rgba(14, 14, 16, 0.04), 0 8px 24px -12px rgba(14, 14, 16, 0.14);
}

.hhs-bga {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--bga-rail);
	/* Fixed shell height, not min-height. With min-height the taller column
	 * (usually the record, once it fills up) stretches the grid row past the
	 * viewport, the transcript never scrolls internally, and auto-scroll has
	 * nowhere to go — the newest message ends up hidden under the composer. */
	height: calc(100vh - var(--bga-nav-h));
	overflow: hidden;
	margin-top: var(--bga-nav-h);
	background: var(--hhs-paper-1);
	color: var(--hhs-black);
	font-family: var(--hhs-font-sans);
	position: relative;
}

/* ── Conversation column ─────────────────────────────────────────────────── */

.hhs-bga__chat {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;   /* lets the transcript shrink so IT scrolls, not the page */
	height: 100%;
	border-right: 1px solid var(--bga-line);
	background:
		radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0) 60%),
		var(--hhs-paper-1);
}

.hhs-bga__bar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.35rem clamp(1.25rem, 3vw, 2.75rem) 1.1rem;
	border-bottom: 1px solid var(--bga-line);
}

.hhs-bga__eyebrow {
	font-family: var(--hhs-font-mono);
	font-size: 0.63rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hhs-red);
	margin: 0 0 0.3rem;
}

.hhs-bga__title {
	font-family: var(--hhs-font-serif);
	font-size: clamp(1.35rem, 2vw, 1.75rem);
	line-height: 1.1;
	margin: 0;
	letter-spacing: -0.01em;
}

.hhs-bga__restart {
	flex: 0 0 auto;
	font-family: var(--hhs-font-mono);
	font-size: 0.63rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--bga-ink-faint);
	background: transparent;
	border: 0;
	border-bottom: 1px solid transparent;
	padding: 0.2rem 0;
	cursor: pointer;
	transition: color 160ms ease, border-color 160ms ease;
}

.hhs-bga__restart:hover { color: var(--hhs-black); border-bottom-color: var(--hhs-red); }

/* 1.19.0: the bar carries two quiet actions (back to the site, start over). */
.hhs-bga__bar-tools { display: flex; align-items: baseline; gap: 1.1rem; flex: 0 0 auto; }
.hhs-bga__bar-tools .hhs-bga__restart { text-decoration: none; }

.hhs-bga__transcript {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 3vw, 2.75rem) 1rem;
	display: flex;
	flex-direction: column;
	/* Messages stack up from the composer the way every messaging app works.
	 * Top-anchored content left a dead half-screen on the opening view. */
	justify-content: flex-end;
	gap: 1.5rem;
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	.hhs-bga__transcript { scroll-behavior: auto; }
}

.hhs-bga__msg { max-width: 40rem; width: 100%; }
.hhs-bga__msg--operator { align-self: flex-end; max-width: 34rem; }

.hhs-bga__who {
	font-family: var(--hhs-font-mono);
	font-size: 0.6rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--bga-ink-faint);
	margin: 0 0 0.4rem;
}

.hhs-bga__msg--operator .hhs-bga__who { text-align: right; }

.hhs-bga__bubble {
	line-height: 1.62;
	font-size: 1rem;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.hhs-bga__msg--agent .hhs-bga__bubble {
	background: #FFFDF9;
	border: 1px solid var(--bga-line);
	border-radius: 4px;
	padding: 1.05rem 1.25rem;
	box-shadow: var(--bga-lift);
}

.hhs-bga__msg--operator .hhs-bga__bubble {
	background: var(--hhs-black);
	color: var(--hhs-paper-0);
	border-radius: 4px;
	padding: 0.9rem 1.15rem;
	font-size: 0.97rem;
}

.hhs-bga__caret {
	display: inline-block;
	width: 2px;
	height: 1.05em;
	background: var(--hhs-red);
	vertical-align: text-bottom;
	animation: hhs-bga-blink 1.05s steps(2) infinite;
}

@keyframes hhs-bga-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.hhs-bga__caret { animation: none; }
}

.hhs-bga__status {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	font-family: var(--hhs-font-mono);
	font-size: 0.66rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--bga-ink-soft);
}

.hhs-bga__status::before {
	content: '';
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--hhs-red);
	animation: hhs-bga-pulse 1.3s ease-in-out infinite;
}

@keyframes hhs-bga-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
	.hhs-bga__status::before { animation: none; opacity: 1; }
}

/* ── Composer ────────────────────────────────────────────────────────────── */

.hhs-bga__composer {
	flex: 0 0 auto;
	border-top: 1px solid var(--bga-line);
	background: linear-gradient(to bottom, rgba(245, 242, 235, 0.92), var(--hhs-paper-1) 40%);
	backdrop-filter: blur(8px);
	padding: 1rem clamp(1.25rem, 3vw, 2.75rem) 1.35rem;
}

.hhs-bga__field {
	display: flex;
	align-items: flex-end;
	gap: 0.6rem;
	border: 1px solid var(--bga-line-strong);
	border-radius: 6px;
	background: #fff;
	padding: 0.7rem 0.75rem 0.7rem 1rem;
	transition: border-color 160ms ease, box-shadow 160ms ease;
	max-width: 46rem;
}

.hhs-bga__field:focus-within {
	border-color: rgba(14, 14, 16, 0.4);
	box-shadow: 0 0 0 3px rgba(255, 72, 74, 0.12);
}

.hhs-bga__input {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	resize: none;
	font: inherit;
	font-size: 1rem;
	line-height: 1.55;
	background: transparent;
	max-height: 9rem;
	min-height: 1.6rem;
	color: var(--hhs-black);
}

.hhs-bga__input::placeholder { color: var(--bga-ink-faint); }

.hhs-bga__mic,
.hhs-bga__send {
	flex: 0 0 auto;
	width: 2.35rem;
	height: 2.35rem;
	border-radius: 50%;
	border: 1px solid var(--bga-line-strong);
	background: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	font-size: 0.9rem;
	line-height: 1;
	transition: background 160ms ease, border-color 160ms ease, transform 120ms ease, opacity 160ms ease;
}

.hhs-bga__mic:hover { border-color: var(--hhs-black); }
.hhs-bga__mic.is-live { background: var(--hhs-red); border-color: var(--hhs-red); color: #fff; }

.hhs-bga__send {
	background: var(--hhs-black);
	border-color: var(--hhs-black);
	color: var(--hhs-paper-0);
	font-size: 1rem;
}

.hhs-bga__send:hover:not(:disabled) { background: var(--hhs-red); border-color: var(--hhs-red); transform: translateY(-1px); }
.hhs-bga__send:disabled { opacity: 0.3; cursor: not-allowed; }

.hhs-bga__meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin: 0.7rem 0 0;
	max-width: 46rem;
	font-family: var(--hhs-font-mono);
	font-size: 0.62rem;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--bga-ink-faint);
}

.hhs-bga__meta a { color: var(--bga-ink-faint); text-decoration: none; border-bottom: 1px solid transparent; }
.hhs-bga__meta a:hover { color: var(--hhs-black); border-bottom-color: var(--hhs-red); }

/* ── The record (right rail) ─────────────────────────────────────────────── */

.hhs-bga__panel {
	background: var(--hhs-paper-2);
	padding: 1.6rem clamp(1.1rem, 1.6vw, 1.6rem) 3rem;
	overflow-y: auto;
	height: 100%;
	min-height: 0;
	border-left: 1px solid var(--bga-line);
}

.hhs-bga__panel-h {
	font-family: var(--hhs-font-serif);
	font-size: 1.32rem;
	margin: 0 0 0.3rem;
	letter-spacing: -0.01em;
}

.hhs-bga__panel-sub {
	font-size: 0.82rem;
	line-height: 1.55;
	color: var(--bga-ink-soft);
	margin: 0 0 1.5rem;
}

.hhs-bga__group {
	background: #FFFDF9;
	border: 1px solid var(--bga-line);
	border-radius: 4px;
	padding: 0.9rem 1rem 0.7rem;
	margin-bottom: 0.85rem;
}

.hhs-bga__group-h {
	font-family: var(--hhs-font-mono);
	font-size: 0.6rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hhs-dusk-2);
	margin: 0 0 0.7rem;
}

.hhs-bga__row {
	display: grid;
	grid-template-columns: 1fr 5.25rem;
	align-items: center;
	gap: 0.6rem;
	padding: 0.3rem 0;
	border-bottom: 1px solid rgba(14, 14, 16, 0.055);
}

.hhs-bga__row:last-child { border-bottom: 0; }

.hhs-bga__row label {
	font-size: 0.82rem;
	color: rgba(14, 14, 16, 0.72);
	line-height: 1.35;
}

.hhs-bga__row input {
	font-family: var(--hhs-font-mono);
	font-size: 0.85rem;
	text-align: right;
	padding: 0.35rem 0.45rem;
	border: 1px solid transparent;
	border-bottom-color: var(--bga-line);
	border-radius: 2px;
	background: transparent;
	width: 100%;
	min-width: 0;
	color: var(--hhs-black);
	transition: background 140ms ease, border-color 140ms ease;
}

.hhs-bga__row input:hover { background: rgba(14, 14, 16, 0.03); }

.hhs-bga__row input:focus {
	outline: none;
	background: #fff;
	border-color: var(--hhs-red);
}

.hhs-bga__row input:placeholder-shown,
.hhs-bga__row input[value=""] { color: var(--bga-ink-faint); }

.hhs-bga__empty {
	font-size: 0.85rem;
	line-height: 1.65;
	color: var(--bga-ink-soft);
	border: 1px dashed var(--bga-line-strong);
	border-radius: 4px;
	padding: 1rem;
	background: rgba(255, 255, 255, 0.4);
}

.hhs-bga__meter {
	margin-top: 1.5rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--bga-line-strong);
}

.hhs-bga__meter-label {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-family: var(--hhs-font-mono);
	font-size: 0.62rem;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--bga-ink-soft);
}

.hhs-bga__meter-bar {
	height: 3px;
	background: rgba(14, 14, 16, 0.1);
	margin-top: 0.6rem;
	border-radius: 99px;
	overflow: hidden;
}

.hhs-bga__meter-fill {
	height: 100%;
	background: var(--hhs-red);
	border-radius: 99px;
	transition: width 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
	.hhs-bga__meter-fill { transition: none; }
}

/* ── Approval card ───────────────────────────────────────────────────────── */

.hhs-bga__approve {
	border: 1px solid var(--hhs-black);
	background: #FFFDF9;
	border-radius: 4px;
	padding: 1.35rem 1.45rem 1.25rem;
	max-width: 40rem;
	box-shadow: var(--bga-lift);
}

.hhs-bga__approve-h {
	font-family: var(--hhs-font-mono);
	font-size: 0.6rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hhs-red);
	margin: 0 0 0.55rem;
}

.hhs-bga__approve-title {
	font-family: var(--hhs-font-serif);
	font-size: 1.28rem;
	line-height: 1.2;
	margin: 0 0 1rem;
}

.hhs-bga__approve-line {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(14, 14, 16, 0.08);
	font-size: 0.92rem;
	font-variant-numeric: tabular-nums;
}

.hhs-bga__approve-line span { color: var(--bga-ink-soft); }
.hhs-bga__approve-line strong { font-weight: 600; }

.hhs-bga__approve-note {
	font-size: 0.83rem;
	color: var(--bga-ink-soft);
	line-height: 1.55;
	margin: 1rem 0 1.15rem;
}

/* ── Buttons, modal, states ──────────────────────────────────────────────── */

.hhs-bga__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.hhs-bga__btn {
	font-family: var(--hhs-font-mono);
	font-size: 0.66rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	padding: 0.8rem 1.4rem;
	border-radius: 3px;
	border: 1px solid var(--hhs-black);
	background: var(--hhs-black);
	color: var(--hhs-paper-0);
	cursor: pointer;
	transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.hhs-bga__btn:hover:not(:disabled) { transform: translateY(-1px); }
.hhs-bga__btn--ghost { background: transparent; color: var(--hhs-black); border-color: var(--bga-line-strong); }
.hhs-bga__btn--ghost:hover:not(:disabled) { border-color: var(--hhs-black); }
.hhs-bga__btn--go { background: var(--hhs-red); border-color: var(--hhs-red); }
.hhs-bga__btn--go:hover:not(:disabled) { background: var(--hhs-red-deep); border-color: var(--hhs-red-deep); }
.hhs-bga__btn:disabled { opacity: 0.5; cursor: not-allowed; }

.hhs-bga__scrim {
	position: fixed;
	inset: 0;
	background: rgba(14, 14, 16, 0.58);
	backdrop-filter: blur(3px);
	display: grid;
	place-items: center;
	padding: 1.5rem;
	z-index: 200;
}

.hhs-bga__modal {
	background: var(--hhs-paper-0);
	border-radius: 5px;
	padding: 1.9rem;
	width: min(30rem, 100%);
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 24px 60px -20px rgba(14, 14, 16, 0.5);
}

.hhs-bga__modal h3 {
	font-family: var(--hhs-font-serif);
	font-size: 1.4rem;
	margin: 0 0 0.35rem;
}

.hhs-bga__modal-sub { font-size: 0.87rem; color: var(--bga-ink-soft); margin: 0; line-height: 1.55; }

.hhs-bga__secure {
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
	background: var(--hhs-paper-2);
	border-radius: 3px;
	padding: 0.8rem 0.9rem;
	font-size: 0.81rem;
	line-height: 1.55;
	margin: 1.1rem 0 1.3rem;
	color: rgba(14, 14, 16, 0.75);
}

.hhs-bga__modal label {
	display: block;
	font-family: var(--hhs-font-mono);
	font-size: 0.6rem;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--bga-ink-soft);
	margin-bottom: 0.35rem;
}

.hhs-bga__modal input {
	width: 100%;
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--bga-line-strong);
	border-radius: 3px;
	font: inherit;
	margin-bottom: 1.05rem;
	background: #fff;
	transition: border-color 140ms ease, box-shadow 140ms ease;
}

.hhs-bga__modal input:focus {
	outline: none;
	border-color: var(--hhs-black);
	box-shadow: 0 0 0 3px rgba(255, 72, 74, 0.12);
}

.hhs-bga__err { color: var(--hhs-red-deep); font-size: 0.85rem; margin: 0 0 0.85rem; }

.hhs-bga__result {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--hhs-font-mono);
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--hhs-red);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
	:root { --bga-rail: 340px; }
}

@media (max-width: 900px) {
	.hhs-bga {
		grid-template-columns: minmax(0, 1fr);
		height: auto;
		min-height: calc(100vh - var(--bga-nav-h));
		overflow: visible;
	}
	.hhs-bga__chat {
		order: 1;
		border-right: 0;
		/* Fixed to one screen so the composer is always within thumb reach and
		 * the transcript scrolls inside it. The record sits below; the PAGE
		 * scrolls to reach it. */
		height: calc(100vh - var(--bga-nav-h));
		height: calc(100dvh - var(--bga-nav-h));
		min-height: 0;
	}
	.hhs-bga__panel {
		order: 2;
		height: auto;
		overflow: visible;
		border-left: 0;
		border-top: 1px solid var(--bga-line-strong);
	}
	.hhs-bga__msg,
	.hhs-bga__msg--operator { max-width: 100%; }
}

@media (max-width: 600px) {
	:root { --bga-nav-h: 74px; }
	.hhs-bga__title { font-size: 1.2rem; }
	.hhs-bga__transcript { gap: 1.15rem; }
	.hhs-bga__bubble { font-size: 0.97rem; }
}

/* ── Opening starters ────────────────────────────────────────────────────── */

.hhs-bga__starters { margin-top: 0.25rem; }

.hhs-bga__starters-h {
	font-family: var(--hhs-font-mono);
	font-size: 0.62rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--bga-ink-faint);
	margin: 0 0 0.7rem;
}

.hhs-bga__starters-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.hhs-bga__starter {
	font: inherit;
	font-size: 0.87rem;
	line-height: 1.35;
	text-align: left;
	color: rgba(14, 14, 16, 0.78);
	background: rgba(255, 255, 255, 0.65);
	border: 1px solid var(--bga-line-strong);
	border-radius: 999px;
	padding: 0.55rem 1rem;
	cursor: pointer;
	transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}

.hhs-bga__starter:hover {
	background: #fff;
	border-color: var(--hhs-black);
	color: var(--hhs-black);
	transform: translateY(-1px);
}

@media (max-width: 600px) {
	.hhs-bga__starters-row { flex-direction: column; }
	.hhs-bga__starter { width: 100%; }
}

/* ── Opening intro ───────────────────────────────────────────────────────── */

.hhs-bga__intro {
	border-left: 2px solid var(--hhs-red);
	padding: 0.15rem 0 0.15rem 1.1rem;
	max-width: 34rem;
}

.hhs-bga__intro-steps {
	list-style: none;
	margin: 0 0 0.75rem;
	padding: 0;
	display: grid;
	gap: 0.55rem;
}

.hhs-bga__intro-steps li {
	display: flex;
	align-items: baseline;
	gap: 0.7rem;
	font-size: 0.95rem;
	line-height: 1.5;
	color: rgba(14, 14, 16, 0.82);
}

.hhs-bga__intro-steps span {
	flex: 0 0 auto;
	font-family: var(--hhs-font-mono);
	font-size: 0.66rem;
	color: var(--hhs-red);
	letter-spacing: 0.08em;
}

.hhs-bga__intro-note {
	margin: 0;
	font-size: 0.86rem;
	font-style: italic;
	color: var(--bga-ink-soft);
	line-height: 1.55;
}

/* ── App shell: this route behaves like a tool, not a marketing page ─────── */

/* The transcript owns the scrolling. Without this the whole PAGE scrolls and
 * slides conversation up underneath the fixed nav, which looks like a bug. */
body.hhs-bga-page {
	overflow: hidden;
}

body.hhs-bga-page .hhs-footer {
	display: none;
}

@media (max-width: 900px) {
	/* Small screens get the page back: the record sits below the conversation
	 * and has to be reachable by scrolling. */
	body.hhs-bga-page { overflow: auto; }
	body.hhs-bga-page .hhs-footer { display: block; }
}
