/* CODWave order form — self-contained, theme-agnostic.
   The palette is declared on the sticky bar too: it is re-parented to <body> at
   runtime (so a theme transform can't break position:fixed), which puts it
   outside .codwave-form-wrap and out of reach of its variables. */
.codwave-form-wrap,
.codwave-sticky {
	--cw-ink: #17201c;
	--cw-muted: #5a655e;
	--cw-paper: #ffffff;
	--cw-field: #fbfcfb;
	--cw-line: #e4eae5;
	--cw-accent: #0f7a4f;
	--cw-accent-dark: #0c6541;
	--cw-accent-soft: #e7f3ec;
	--cw-warn: #b23b2e;
}
.codwave-form-wrap {
	max-width: 520px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.55;
	color: var(--cw-ink);
	box-sizing: border-box;
}
.codwave-form-wrap *,
.codwave-form-wrap *::before,
.codwave-form-wrap *::after,
.codwave-sticky,
.codwave-sticky *,
.codwave-sticky *::before,
.codwave-sticky *::after { box-sizing: border-box; }

/* Make the hidden attribute stick. Our own display rules (e.g. .codwave-total's
   display:flex) are author styles and would otherwise beat the browser's
   [hidden] rule, leaving "hidden" elements visible. */
.codwave-form-wrap [hidden] { display: none; }

/* Nothing inside the form may exceed the phone's width. Long product names and
   wider currency strings (GHS/KES/TZS) must wrap rather than push a row wide. */
.codwave-form-wrap { max-width: min(520px, 100%); }
.codwave-form-wrap img { max-width: 100%; height: auto; }
.codwave-form-wrap h3,
.codwave-form-wrap p,
.codwave-form-wrap li,
.codwave-form-wrap blockquote,
.codwave-form-wrap strong { overflow-wrap: anywhere; min-width: 0; }

.codwave-form {
	background: var(--cw-paper);
	border: 1px solid var(--cw-line);
	border-radius: 18px;
	padding: 30px 26px;
	box-shadow: 0 1px 2px rgba(23, 32, 28, 0.04), 0 14px 34px rgba(23, 32, 28, 0.08);
}

.codwave-form-header { text-align: center; margin-bottom: 24px; }
.codwave-badge {
	display: inline-block;
	background: var(--cw-accent-soft);
	color: var(--cw-accent);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 6px 13px;
	border-radius: 999px;
	margin-bottom: 12px;
}
.codwave-form-header h3 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; font-weight: 700; }
.codwave-form-header p { margin: 0; font-size: 15px; color: var(--cw-muted); }

.codwave-field { display: block; margin-bottom: 16px; }
.codwave-field > span {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 7px;
	color: #3a453e;
}
.codwave-field input,
.codwave-field select,
.codwave-field textarea {
	/* Same reasoning as the sticky bar: width:100% plus padding only behaves if
	   border-box is guaranteed, so declare it here rather than rely on the `*`
	   rule surviving a host theme. */
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 46px;
	padding: 13px 15px;
	font-size: 16px;
	font-family: inherit;
	line-height: 1.4;
	border: 1px solid var(--cw-line);
	border-radius: 12px;
	background: var(--cw-field);
	color: var(--cw-ink);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.codwave-field textarea { min-height: 88px; }
.codwave-field input::placeholder,
.codwave-field textarea::placeholder { color: #9aa39c; }
.codwave-field input:hover,
.codwave-field select:hover,
.codwave-field textarea:hover { border-color: #cdd6cf; }
.codwave-field input:focus,
.codwave-field select:focus,
.codwave-field textarea:focus {
	outline: none;
	background: #fff;
	border-color: var(--cw-accent);
	box-shadow: 0 0 0 3px var(--cw-accent-soft);
}
.codwave-field select:disabled { background: #f0f2f0; color: #9aa39c; cursor: not-allowed; }

/* The total is the number the customer decides on — give it real weight. */
.codwave-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 20px;
	background: var(--cw-accent-soft);
	border: 2px solid var(--cw-accent);
	border-radius: 14px;
	margin: 10px 0 20px;
	box-shadow: 0 4px 14px rgba(15, 122, 79, 0.12);
}
.codwave-total span {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #4a564e;
}
.codwave-total strong {
	font-size: 30px;
	font-weight: 800;
	line-height: 1.1;
	color: var(--cw-accent);
	letter-spacing: -0.01em;
}

.codwave-submit {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 52px;
	padding: 16px;
	font-size: 17px;
	font-weight: 700;
	font-family: inherit;
	color: #fff;
	background: var(--cw-accent);
	border: none;
	border-radius: 14px;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(15, 122, 79, 0.25);
	transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.codwave-submit:hover { background: var(--cw-accent-dark); box-shadow: 0 8px 20px rgba(15, 122, 79, 0.3); }
.codwave-submit:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(15, 122, 79, 0.22); }
.codwave-submit:disabled { opacity: 0.55; cursor: progress; box-shadow: none; }

.codwave-message { margin-top: 16px; font-size: 15px; text-align: center; }
.codwave-message.is-error { color: var(--cw-warn); font-weight: 600; }
.codwave-message.is-success {
	color: var(--cw-accent);
	background: var(--cw-accent-soft);
	padding: 15px;
	border-radius: 12px;
	font-weight: 600;
}
.codwave-notice { text-align: center; color: var(--cw-muted); font-size: 15px; }
.codwave-unavailable {
	background: #fdecea;
	color: var(--cw-warn);
	padding: 16px 18px;
	border-radius: 12px;
	font-weight: 600;
}

/* Trust badges — a quiet row of reassurance at the top of the card. */
.codwave-badges {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 10px;
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
}
.codwave-badge-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 12px;
	background: var(--cw-field);
	border: 1px solid var(--cw-line);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	color: #3a453e;
	line-height: 1.3;
}
.codwave-badge-icon { font-size: 14px; line-height: 1; }

/* Reassurance strip — the last doubts, answered right above the button. */
.codwave-reassure {
	list-style: none;
	margin: 0 0 16px;
	padding: 14px 16px;
	background: var(--cw-field);
	border: 1px solid var(--cw-line);
	border-radius: 12px;
}
.codwave-reassure li {
	position: relative;
	padding-left: 24px;
	margin: 0 0 7px;
	font-size: 14px;
	line-height: 1.45;
	color: #3a453e;
}
.codwave-reassure li:last-child { margin-bottom: 0; }
.codwave-reassure li::before {
	content: "✓";
	position: absolute;
	left: 0;
	top: 0;
	color: var(--cw-accent);
	font-weight: 700;
}

/* The one "Select Pack" control — what they're buying, and its price.
   Given a little extra weight: it's the purchase decision. */
.codwave-pack-field select {
	font-size: 16px;
	font-weight: 600;
	border-color: #cfdcd4;
}
.codwave-pack-field select:disabled { background: #f0f2f0; color: var(--cw-muted); }

/* Honest stock-scarcity indicator. */
.codwave-scarcity {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: 10px;
	background: #fff4e5;
	border: 1px solid #f3d9b0;
	color: #a35a00;
	font-size: 14.5px;
	font-weight: 600;
	text-align: center;
}
.codwave-scarcity strong { color: #8a4b00; }

/* Thank-you page ([codwave_thank_you]) — the real order, read from the DB. */
.codwave-thanks {
	background: var(--cw-paper);
	border: 1px solid var(--cw-line);
	border-radius: 18px;
	padding: 32px 26px;
	text-align: center;
	box-shadow: 0 1px 2px rgba(23, 32, 28, 0.04), 0 14px 34px rgba(23, 32, 28, 0.08);
}
.codwave-thanks-mark {
	width: 56px;
	height: 56px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: var(--cw-accent-soft);
	color: var(--cw-accent);
	font-size: 30px;
	line-height: 56px;
	font-weight: 700;
}
.codwave-thanks-title { margin: 0 0 8px; font-size: 22px; line-height: 1.25; color: var(--cw-ink); }
.codwave-thanks-lead { margin: 0 0 22px; font-size: 15px; color: var(--cw-muted); }
.codwave-thanks-details { list-style: none; margin: 0; padding: 0; text-align: left; }
.codwave-thanks-details li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 12px 0;
	border-bottom: 1px solid var(--cw-line);
	font-size: 15px;
}
.codwave-thanks-details li:last-child { border-bottom: none; }
.codwave-thanks-details span { color: var(--cw-muted); }
.codwave-thanks-details strong { color: var(--cw-ink); text-align: right; }
.codwave-thanks-total {
	margin-top: 6px;
	padding: 14px 16px !important;
	background: var(--cw-accent-soft);
	border-radius: 10px;
	border-bottom: none !important;
}
.codwave-thanks-total strong { font-size: 20px; color: var(--cw-accent); }

/* Delivery-readiness box + closing line (shared copy, classic styling). */
.codwave-thanks-note {
	margin: 20px 0 0;
	padding: 16px 18px;
	text-align: left;
	background: var(--cw-accent-soft);
	border: 1px solid var(--cw-line);
	border-radius: 12px;
}
.codwave-thanks-note-title {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
	color: var(--cw-ink);
}
.codwave-thanks-note ul { list-style: none; margin: 0; padding: 0; }
.codwave-thanks-note li {
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--cw-ink);
	padding: 7px 0;
	border-top: 1px solid rgba(23, 32, 28, 0.08);
}
.codwave-thanks-note li:first-child { border-top: none; }
.codwave-thanks-closing {
	margin: 18px 0 0;
	font-style: italic;
	font-size: 15px;
	line-height: 1.4;
	color: var(--cw-muted);
	text-align: center;
}

/* Testimonials / social proof — shown under the form. */
.codwave-testimonials { margin: 20px auto 0; max-width: 520px; }
.codwave-testimonials-title {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 700;
	color: var(--cw-ink);
	text-align: center;
}
.codwave-testimonial {
	margin: 0 0 12px;
	padding: 16px 18px;
	background: var(--cw-paper);
	border: 1px solid var(--cw-line);
	border-radius: 14px;
	box-shadow: 0 1px 2px rgba(23, 32, 28, 0.04), 0 8px 20px rgba(23, 32, 28, 0.05);
}
.codwave-stars { color: #f0a500; font-size: 15px; letter-spacing: 1px; margin-bottom: 6px; }
.codwave-testimonial-text { margin: 0 0 8px; font-size: 15px; line-height: 1.5; color: #2c352f; }
.codwave-testimonial-by { font-size: 13.5px; color: var(--cw-muted); }
.codwave-testimonial-by strong { color: var(--cw-ink); }

/* Order bump — offered in a popup; this chip confirms an accepted offer. */
.codwave-bump-added {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	margin: 0 0 16px;
	border: 2px dashed var(--cw-accent);
	border-radius: 12px;
	background: var(--cw-accent-soft);
}
.codwave-bump-added-text { font-size: 15px; font-weight: 700; color: var(--cw-ink); }
.codwave-bump-price { color: var(--cw-accent); font-weight: 700; }
.codwave-bump-remove {
	flex: 0 0 auto;
	padding: 4px 8px;
	font-size: 13.5px;
	font-family: inherit;
	font-weight: 600;
	color: var(--cw-muted);
	background: none;
	border: none;
	text-decoration: underline;
	cursor: pointer;
}
.codwave-bump-remove:hover { color: var(--cw-warn); }

/* Order-bump popup. Fixed overlay, re-parented to <body> at runtime. */
.codwave-bump-modal {
	--cw-ink: #17201c;
	--cw-muted: #5a655e;
	--cw-paper: #ffffff;
	--cw-line: #e4eae5;
	--cw-accent: #0f7a4f;
	--cw-accent-dark: #0c6541;
	--cw-accent-soft: #e7f3ec;
	box-sizing: border-box;
	position: fixed;
	inset: 0;
	/* Explicit offsets as well as `inset`, for older mobile browsers that don't
	   understand the shorthand. */
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 99995;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100vw;
	overflow-x: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.codwave-bump-modal[hidden] { display: none; }
.codwave-bump-modal *,
.codwave-bump-modal *::before,
.codwave-bump-modal *::after { box-sizing: border-box; }
.codwave-bump-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(23, 32, 28, 0.55);
}
.codwave-bump-dialog {
	/* Declared here, not inherited from a `*` rule — see the note on the sticky
	   bar. Without it the 24px side padding adds to width:100% and the offer
	   spills off the right edge of the phone. */
	box-sizing: border-box;
	position: relative;
	/* Sized by flex rather than width:100%: flex works from the container's free
	   space, so margins and padding are accounted for and the dialog cannot
	   exceed the screen even if border-box is lost. */
	flex: 1 1 auto;
	min-width: 0;
	max-width: 400px;
	margin: 16px;
	padding: 26px 24px 22px;
	background: var(--cw-paper);
	border-radius: 18px;
	box-shadow: 0 20px 50px rgba(23, 32, 28, 0.3);
	text-align: center;
	/* Long product names, long offers and wider currency strings (GHS/KES) must
	   wrap, never widen the dialog. */
	overflow-wrap: anywhere;
}
.codwave-bump-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 36px;
	height: 36px;
	font-size: 24px;
	line-height: 1;
	font-family: inherit;
	color: var(--cw-muted);
	background: none;
	border: none;
	border-radius: 50%;
	cursor: pointer;
}
.codwave-bump-close:hover { background: #f1f4f2; color: var(--cw-ink); }
.codwave-bump-title { margin: 0 0 6px; font-size: 19px; line-height: 1.3; color: var(--cw-ink); }
.codwave-bump-modal-price { margin: 0 0 10px; font-size: 22px; font-weight: 700; color: var(--cw-accent); }
.codwave-bump-modal-desc { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--cw-muted); }
.codwave-bump-accept {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 15px;
	font-size: 16px;
	font-weight: 700;
	font-family: inherit;
	color: #fff;
	background: var(--cw-accent);
	border: none;
	border-radius: 12px;
	cursor: pointer;
}
.codwave-bump-accept:hover { background: var(--cw-accent-dark); }
.codwave-bump-decline {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin-top: 10px;
	padding: 10px;
	font-size: 14.5px;
	font-family: inherit;
	color: var(--cw-muted);
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: underline;
}

/* Stop the page scrolling behind the popup. */
body.codwave-modal-open { overflow: hidden; }

/* Phones: present the offer as a bottom sheet. */
@media (max-width: 480px) {
	.codwave-bump-modal { align-items: flex-end; }
	.codwave-bump-dialog {
		max-width: none;
		margin: 0;
		border-radius: 18px 18px 0 0;
		padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
	}
}

/* Sticky mobile order bar.
   The bar's APPEARANCE is defined unconditionally — deliberately. It used to
   live entirely inside the media query, so anywhere that query didn't resolve as
   expected (a theme with no viewport meta, an over-eager CSS optimiser) the bar
   degraded to an unstyled button and stray text. The media query below now does
   one job only: decide whether it shows. */
.codwave-sticky {
	/* Declared on the element itself, not inherited from a `*` rule: a host
	   theme or a CSS optimiser must not be able to take it away, or the padding
	   below starts adding to the width and the button overflows the screen. */
	box-sizing: border-box;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	/* Lay the button out with flex. Flex sizes items from the container's free
	   space *including* their padding, so the button fits even if border-box is
	   somehow lost — belt and braces. */
	display: flex;
	max-width: 100vw;
	padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
	background: var(--cw-paper);
	border-top: 1px solid var(--cw-line);
	box-shadow: 0 -6px 20px rgba(23, 32, 28, 0.12);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	transition: transform 0.25s ease;
}
.codwave-sticky.is-hidden { transform: translateY(130%); }
.codwave-sticky-btn {
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: 0;
	max-width: 100%;
	min-height: 52px;
	padding: 14px 18px;
	font-size: 17px;
	font-weight: 700;
	font-family: inherit;
	line-height: 1.2;
	color: #fff;
	background: var(--cw-accent);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(15, 122, 79, 0.25);
	/* A long button label must wrap, never push the bar wider. */
	overflow-wrap: anywhere;
}
.codwave-sticky-btn:hover { background: var(--cw-accent-dark); }
.codwave-sticky-btn:active { background: var(--cw-accent-dark); }

/* Show it on phones/tablets only. This is the ONLY thing the query controls.
   Note it must restore `flex`, not `block` — the bar lays its button out with
   flex above. */
.codwave-sticky { display: none; }
@media (max-width: 767px) {
	.codwave-sticky { display: flex; }
}

/* Phones — most customers order here. */
@media (max-width: 480px) {
	.codwave-form { padding: 22px 18px; border-radius: 16px; }
	.codwave-form-header { margin-bottom: 20px; }
	.codwave-form-header h3 { font-size: 21px; }
	.codwave-total strong { font-size: 21px; }
	.codwave-submit { min-height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
	.codwave-field input,
	.codwave-field select,
	.codwave-field textarea,
	.codwave-sticky,
	.codwave-submit { transition: none; }
}

/* Admin-only diagnostic on the thank-you page. Never shown to customers. */
.codwave-admin-note {
	max-width: 520px;
	margin: 14px auto 0;
	padding: 10px 14px;
	border: 1px dashed #c9a227;
	border-radius: 8px;
	background: #fffbf0;
	color: #6b5410;
	font-size: 13px;
	line-height: 1.5;
}
