/**
 * Poradca pri vybere - storefront styles.
 *
 * Scoped under .pav-* and built on its own custom properties so the Porto/Nest
 * theme cannot reach in and this cannot leak out. Kept beside the script rather
 * than in the theme's main.css so the module stays self-contained and survives a
 * theme update.
 *
 * The look is a garden centre's own: paper, ink, a leaf green that carries every
 * action, and generous hit targets because a good share of this traffic is on a
 * phone in a garden.
 */

.pav-widget,
.pav-wizard {
	--pav-ink: #21301d;
	--pav-ink-soft: #5a6a55;
	--pav-ink-faint: #8b978a;
	--pav-paper: #fff;
	--pav-paper-sunk: #f5f7f2;
	--pav-line: #e0e6da;
	--pav-line-strong: #c6d0bd;
	--pav-leaf: #2f7d3f;
	--pav-leaf-dark: #24632f;
	--pav-leaf-wash: #eaf4e9;
	--pav-radius: 16px;
	--pav-shadow: 0 18px 48px rgba(24, 40, 22, .18);
	--pav-sans: "Quicksand", "Helvetica Neue", Helvetica, Arial, sans-serif;

	box-sizing: border-box;
	font-family: var(--pav-sans);
	color: var(--pav-ink);
}

.pav-widget *,
.pav-widget *::before,
.pav-widget *::after,
.pav-wizard *,
.pav-wizard *::before,
.pav-wizard *::after {
	box-sizing: border-box;
}

body.pav-locked {
	overflow: hidden;
}

/* ------------------------------------------------------------------- fab */

.pav-widget {
	position: fixed;
	right: 200px;
	bottom: 24px;
	z-index: 1040;
}

.pav-fab {
	align-items: center;
	background: linear-gradient(135deg, var(--pav-leaf) 0%, #3d9553 100%);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 16px 36px rgba(31, 110, 55, .3);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	font-family: inherit;
	gap: 12px;
	height: 56px;
	padding: 0 20px 0 8px;
	position: relative;
	transition: transform .18s ease, box-shadow .18s ease;
}

.pav-fab:hover {
	box-shadow: 0 20px 42px rgba(31, 110, 55, .36);
	transform: translateY(-2px);
}

.pav-fab:active {
	transform: translateY(0) scale(.97);
	transition-duration: .08s;
}

.pav-fab-icon {
	align-items: center;
	background: rgba(255, 255, 255, .18);
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 50%;
	display: flex;
	flex: none;
	height: 40px;
	justify-content: center;
	width: 40px;
}

.pav-fab-icon svg {
	display: block;
	height: 20px;
	width: 20px;
}

.pav-fab-text {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	line-height: 1.2;
	text-align: left;
}

.pav-fab-text strong {
	font-size: 14px;
	font-weight: 700;
}

.pav-fab-text small {
	color: rgba(255, 255, 255, .82);
	font-size: 11px;
	font-weight: 600;
	margin-top: 2px;
}

/* --------------------------------------------------------------- overlay */

/*
 * Opening is a two class affair: .is-open takes the panel out of display:none so
 * it can be laid out, then .is-visible (added a frame later by the script) drives
 * the transition. Closing removes .is-visible first and only drops .is-open once
 * the panel has finished getting out of the way.
 */

.pav-overlay {
	display: none;
	inset: 0;
	position: fixed;
	z-index: 1041;
}

.pav-overlay.is-open {
	display: block;
}

.pav-backdrop {
	background: rgba(22, 33, 21, .38);
	inset: 0;
	opacity: 0;
	position: absolute;
	transition: opacity .3s ease;
}

.pav-overlay.is-visible .pav-backdrop {
	opacity: 1;
}

.pav-shell {
	background: var(--pav-paper);
	border-radius: 22px;
	bottom: 24px;
	box-shadow: var(--pav-shadow);
	display: flex;
	flex-direction: column;
	height: min(760px, calc(100vh - 48px));
	opacity: 0;
	overflow: hidden;
	position: absolute;
	right: 24px;
	width: min(640px, calc(100vw - 32px));

	/* grows out of the corner the button sits in */
	transform: translate3d(0, 16px, 0) scale(.94);
	transform-origin: 100% 100%;
	transition: opacity .24s ease, transform .42s cubic-bezier(.16, .84, .34, 1);
	will-change: transform, opacity;
}

.pav-overlay.is-visible .pav-shell {
	opacity: 1;
	transform: translate3d(0, 0, 0) scale(1);
}

/* The panel is on its way out: quicker, and it drops back towards the button. */
.pav-overlay:not(.is-visible) .pav-shell {
	transition: opacity .18s ease, transform .22s cubic-bezier(.4, 0, .7, .2);
}

/* Head and body follow the shell in, just late enough to be felt. */
.pav-overlay .pav-shell .pav-w-head,
.pav-overlay .pav-shell .pav-w-body {
	opacity: 0;
	transform: translate3d(0, 10px, 0);
	transition: opacity .16s ease, transform .2s ease;
}

.pav-overlay.is-visible .pav-shell .pav-w-head {
	opacity: 1;
	transform: none;
	transition: opacity .3s ease .1s, transform .4s cubic-bezier(.16, .84, .34, 1) .1s;
}

.pav-overlay.is-visible .pav-shell .pav-w-body {
	opacity: 1;
	transform: none;
	transition: opacity .3s ease .17s, transform .4s cubic-bezier(.16, .84, .34, 1) .17s;
}

.pav-close {
	background: rgba(255, 255, 255, .9);
	border: 1px solid var(--pav-line);
	border-radius: 50%;
	color: var(--pav-ink-soft);
	cursor: pointer;
	height: 32px;
	position: absolute;
	right: 14px;
	top: 14px;
	width: 32px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pav-close:hover {
	background: var(--pav-paper-sunk);
	color: var(--pav-ink);
}

/* ---------------------------------------------------------------- wizard */

.pav-wizard {
	background: var(--pav-paper);
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1 1 auto;
}

.pav-w-head {
	border-bottom: 1px solid var(--pav-line);
	flex: none;
	padding: 20px 56px 14px 24px;
}

.pav-w-title {
	font-size: 17px;
	font-weight: 700;
}

/* The step count sits above the bar rather than beside it, so the bar itself
   runs the whole width of the head. */
.pav-w-progress {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
}

.pav-w-step {
	color: var(--pav-ink-soft);
	flex: none;
	font-size: 12px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

.pav-w-bar {
	background: var(--pav-line);
	border-radius: 999px;
	height: 4px;
	overflow: hidden;

	/* The head keeps 56px clear on the right for the close button, but the bar
	   sits well below it - so it reaches back into that space and ends level
	   with the 24px inset on the left. */
	margin-right: -32px;
	width: auto;
}

.pav-w-bar i {
	background: var(--pav-leaf);
	display: block;
	height: 100%;
	transition: width .25s ease;
	width: 0;
}

.pav-w-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 22px 24px;
	-webkit-overflow-scrolling: touch;
}

.pav-w-q {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0 0 6px;
}

.pav-w-help,
.pav-w-intro {
	color: var(--pav-ink-soft);
	font-size: 14px;
	line-height: 1.5;
	margin: 0 0 14px;
}

.pav-w-context {
	background: var(--pav-leaf-wash);
	border-radius: 999px;
	color: var(--pav-leaf-dark);
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	margin: 0 0 14px;
	padding: 6px 11px;
}

/* --------------------------------------------------------------- options */

.pav-w-options {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	margin-top: 16px;
}

.pav-w-option {
	background: var(--pav-paper);
	border: 1.5px solid var(--pav-line-strong);
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	font-family: inherit;
	gap: 3px;
	min-height: 56px;
	justify-content: center;
	padding: 12px 16px;
	text-align: left;
	transition: border-color .15s, background .15s, transform .1s;
}

.pav-w-option:hover {
	background: var(--pav-leaf-wash);
	border-color: var(--pav-leaf);
}

.pav-w-option:active {
	transform: scale(.99);
}

.pav-w-option.is-on {
	background: var(--pav-leaf-wash);
	border-color: var(--pav-leaf);
	box-shadow: inset 0 0 0 1px var(--pav-leaf);
}

.pav-w-option-label {
	color: var(--pav-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.pav-w-option-hint {
	color: var(--pav-ink-soft);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.5em;
}

/* The way out of a question the customer cannot answer reads as an aside, not
   as a rejected option. */
.pav-w-option.is-escape {
	border-style: dashed;
	grid-column: 1 / -1;
	min-height: 0;
	padding: 10px 16px;
}

.pav-w-option.is-escape .pav-w-option-label {
	color: var(--pav-ink-soft);
	font-size: 14px;
	font-weight: 500;
}

/* ------------------------------------------------------------- free text */

.pav-w-textarea {
	background: var(--pav-paper);
	border: 1.5px solid var(--pav-line-strong);
	border-radius: 12px;
	color: var(--pav-ink);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	margin-top: 8px;
	padding: 12px 14px;
	resize: vertical;
	width: 100%;
}

.pav-w-textarea:focus {
	border-color: var(--pav-leaf);
	box-shadow: 0 0 0 3px var(--pav-leaf-wash);
	outline: none;
}

/* ---------------------------------------------------------- product chat */

.pav-w-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 16px 0;
}

.pav-w-suggestion {
	background: var(--pav-paper-sunk);
	border: 1px solid var(--pav-line-strong);
	border-radius: 999px;
	color: var(--pav-ink);
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	padding: 9px 13px;
	text-align: left;
}

.pav-w-suggestion:hover {
	background: var(--pav-leaf-wash);
	border-color: var(--pav-leaf);
}

.pav-w-chat {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 16px 0;
}

.pav-w-message {
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.55;
	max-width: 88%;
	padding: 10px 13px;
	white-space: pre-wrap;
}

.pav-w-message.is-user {
	align-self: flex-end;
	background: var(--pav-leaf);
	border-bottom-right-radius: 4px;
	color: #fff;
}

.pav-w-message.is-assistant {
	align-self: flex-start;
	background: var(--pav-paper-sunk);
	border: 1px solid var(--pav-line);
	border-bottom-left-radius: 4px;
}

.pav-w-contact-link {
	color: var(--pav-leaf-dark);
	font-weight: 700;
	overflow-wrap: anywhere;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.pav-w-thinking {
	align-items: center;
	display: inline-flex;
	gap: 9px;
}

.pav-w-thinking-dot {
	animation: pav-thinking 1s ease-in-out infinite;
	background: var(--pav-leaf);
	border-radius: 50%;
	display: inline-block;
	height: 8px;
	width: 8px;
}

@keyframes pav-thinking {
	0%, 100% { opacity: .35; transform: scale(.8); }
	50% { opacity: 1; transform: scale(1.15); }
}

.pav-w-chat-error {
	background: #fff6ed;
	border: 1px solid #efd4b9;
	border-radius: 12px;
	color: #7b4a20;
	font-size: 13px;
	line-height: 1.45;
	margin: 14px 0 8px;
	padding: 10px 12px;
}

.pav-w-chat-input {
	margin-top: 12px;
}

.pav-w-character-count {
	color: var(--pav-ink-soft);
	font-size: 12px;
	line-height: 1.3;
	margin-top: 5px;
	text-align: right;
}

/* --------------------------------------------------------------- results */

.pav-w-results {
	display: grid;
	gap: 12px;
	margin-top: 16px;
}

.pav-w-card {
	align-items: center;
	background: var(--pav-paper);
	border: 1px solid var(--pav-line);
	border-radius: 14px;
	color: inherit;
	display: flex;
	gap: 14px;
	overflow: hidden;
	padding: 12px;
	text-decoration: none;
	transition: border-color .15s, box-shadow .15s;
}

.pav-w-card:hover {
	border-color: var(--pav-leaf);
	box-shadow: 0 8px 20px rgba(24, 40, 22, .08);
	color: inherit;
	text-decoration: none;
}

.pav-w-card-media {
	background: var(--pav-paper-sunk);
	border-radius: 10px;
	flex: none;
	height: 84px;
	overflow: hidden;
	width: 84px;
}

.pav-w-card-media img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.pav-w-card-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.pav-w-card-name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.pav-w-card-reason {
	color: var(--pav-ink-soft);
	font-size: 13px;
	line-height: 1.45;
}

.pav-w-card-stock {
	color: #a04432;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
}

.pav-w-card-price {
	align-items: baseline;
	display: flex;
	gap: 8px;
	margin-top: 2px;
}

.pav-w-card-price strong {
	color: var(--pav-leaf-dark);
	font-size: 15px;
	font-weight: 700;
}

.pav-w-card-price s {
	color: var(--pav-ink-faint);
	font-size: 13px;
}

/* --------------------------------------------------------- states, foot */

.pav-w-loading,
.pav-w-error {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: 14px;
	justify-content: center;
	min-height: 220px;
	text-align: center;
}

.pav-w-loading p,
.pav-w-error p {
	color: var(--pav-ink-soft);
	margin: 0;
}

.pav-w-spinner {
	animation: pav-spin .8s linear infinite;
	border: 3px solid var(--pav-line);
	border-radius: 50%;
	border-top-color: var(--pav-leaf);
	display: block;
	height: 34px;
	width: 34px;
}

@keyframes pav-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.pav-w-spinner { animation-duration: 2.4s; }
	.pav-w-thinking-dot { animation: none; opacity: 1; }
	.pav-w-bar i,
	.pav-fab,
	.pav-w-option { transition: none; }
}

.pav-w-foot {
	align-items: center;
	border-top: 1px solid var(--pav-line);
	display: flex;
	flex: none;
	gap: 10px;
	padding: 14px 24px;
}

.pav-w-spacer {
	flex: 1 1 auto;
}

.pav-w-btn {
	background: var(--pav-leaf);
	border: 1.5px solid var(--pav-leaf);
	border-radius: 999px;
	color: #fff;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	padding: 9px 20px;
	transition: background .15s, border-color .15s, opacity .15s;
}

.pav-w-btn:hover {
	background: var(--pav-leaf-dark);
	border-color: var(--pav-leaf-dark);
}

.pav-w-btn[disabled] {
	cursor: default;
	opacity: .45;
}

.pav-w-btn-ghost {
	background: transparent;
	border-color: var(--pav-line-strong);
	color: var(--pav-ink-soft);
}

.pav-w-btn-ghost:hover {
	background: var(--pav-paper-sunk);
	border-color: var(--pav-ink-faint);
	color: var(--pav-ink);
}

/* The honeypot must be reachable by a bot and invisible to a person, so it is
   moved off screen rather than display:none - some bots skip hidden fields. */
.pav-w-hp {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 0;
}

/* ------------------------------------------------------------------ page */

.pav-page {
	padding-bottom: 40px;
}

/* same width and centring as .pav-page-wizard below, so the intro sits
   squarely above the card instead of hanging off to its left */
.pav-page-head {
	margin: 0 auto 22px;
	max-width: 720px;
	text-align: center;
}

.pav-page-head h1 {
	margin: 0 0 8px;
}

.pav-page-intro {
	color: #5a6a55;
	font-size: 16px;
	line-height: 1.6;
	margin: 0;
}

.pav-page-wizard {
	border: 1px solid #e0e6da;
	border-radius: 18px;
	box-shadow: 0 10px 30px rgba(24, 40, 22, .07);
	margin: 0 auto;
	max-width: 720px;
	overflow: hidden;
}

.pav-page-wizard .pav-w-head {
	padding-right: 24px;
}

/* No close button on the page, so nothing to reach back into. */
.pav-page-wizard .pav-w-bar {
	margin-right: 0;
}

.pav-page-wizard .pav-w-body {
	max-height: none;
	min-height: 320px;
	overflow: visible;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 767px) {
	.pav-widget {
		bottom: 14px;
		right: 70px;
	}

	/* 48px matches the opening hours popup in the opposite corner, so the two
	   floating pills sit on one line on a phone instead of stepping. */
	.pav-fab {
		gap: 0;
		height: 48px;
		justify-content: center;
		padding: 0;
		width: 48px;
	}

	.pav-fab-icon {
		height: 34px;
		width: 34px;
	}

	.pav-fab-icon svg {
		height: 17px;
		width: 17px;
	}

	.pav-fab-text {
		display: none;
	}

	.pav-shell {
		border-radius: 18px;
		bottom: 10px;
		height: auto;
		left: 10px;
		right: 10px;
		top: 10px;
		width: auto;
	}

	.pav-w-head {
		padding: 16px 52px 12px 18px;
	}

	/* matches the tighter head padding above */
	.pav-w-bar {
		margin-right: -34px;
	}

	.pav-w-body {
		padding: 18px;
	}

	.pav-w-foot {
		padding: 12px 18px;
	}

	.pav-w-options {
		grid-template-columns: 1fr;
	}

	.pav-w-q {
		font-size: 17px;
	}

	.pav-w-card-media {
		height: 68px;
		width: 68px;
	}
}

/* -------------------------------------------------------- reduced motion */

/*
 * Someone who has asked their machine to stop moving things gets the panel
 * without the travel - a plain fade, which still reads as "this opened".
 */
@media (prefers-reduced-motion: reduce) {
	.pav-fab,
	.pav-fab:hover,
	.pav-fab:active {
		transform: none;
	}

	.pav-shell,
	.pav-overlay:not(.is-visible) .pav-shell,
	.pav-overlay .pav-shell .pav-w-head,
	.pav-overlay .pav-shell .pav-w-body {
		transform: none;
		transition: opacity .12s linear;
	}

	.pav-overlay.is-visible .pav-shell .pav-w-head,
	.pav-overlay.is-visible .pav-shell .pav-w-body {
		transition: opacity .12s linear;
	}
}
