/*
 * JMJ Cow Share: base components.
 * Used inside the existing theme (My Account, checkout, order received) and by the /cowshare page.
 * Inside the theme these inherit the theme's fonts; colours come from the tokens below.
 */

:root {
	--cs-green: #186038;
	--cs-green-press: #0f4528;
	--cs-green-tint: #e4efe7;
	--cs-orange: #f09820;
	--cs-orange-ink: #8a5300;
	--cs-orange-tint: #fcf0dc;
	--cs-ink: #17201a;
	--cs-muted: #59615a;
	--cs-line: #d9d6cc;
	--cs-paper: #f1efe7;
	--cs-surface: #fbfaf6;
	--cs-bad: #9b2c22;
	--cs-bad-tint: #f8e4e1;
	--cs-info: #24507a;
	--cs-info-tint: #e3ecf5;
	--cs-on-primary: #ffffff;
	--cs-radius-s: 4px;
	--cs-radius: 8px;
	--cs-focus: 0 0 0 3px color-mix(in srgb, var(--cs-orange) 55%, transparent);
	--cs-ease: cubic-bezier(.2, .7, .2, 1);
}

.jmjcs-ui { color: var(--cs-ink); }
.jmjcs-ui *, .jmjcs-ui *::before, .jmjcs-ui *::after { box-sizing: border-box; }
.jmjcs-small { font-size: .875rem; color: var(--cs-muted); }
.jmjcs-muted { color: var(--cs-muted); }

/* Buttons */
.jmjcs-btn, .jmjcs-ui button.jmjcs-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	min-height: 48px; padding: .75rem 1.25rem;
	background: var(--cs-green); color: var(--cs-on-primary);
	border: 0; border-radius: var(--cs-radius-s);
	font: inherit; font-weight: 650; line-height: 1.2; text-decoration: none;
	cursor: pointer; transition: background-color .15s var(--cs-ease), transform .1s var(--cs-ease);
}
.jmjcs-btn:hover { background: var(--cs-green-press); color: var(--cs-on-primary); }
.jmjcs-btn:active { transform: translateY(1px); }
.jmjcs-btn:focus-visible { outline: none; box-shadow: var(--cs-focus); }
.jmjcs-btn[disabled], .jmjcs-btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.jmjcs-btn--ghost { background: transparent; color: var(--cs-green); box-shadow: inset 0 0 0 1.5px currentColor; }
.jmjcs-btn--ghost:hover { background: var(--cs-green-tint); color: var(--cs-green); }

/* WhatsApp CTA: a community invitation, not a shout */
.jmjcs-wa {
	display: inline-flex; align-items: center; gap: .5rem;
	min-height: 44px; padding: .6rem 1rem;
	border-radius: var(--cs-radius-s);
	font-weight: 600; line-height: 1.2; text-decoration: none;
	transition: background-color .15s var(--cs-ease), color .15s var(--cs-ease);
}
.jmjcs-wa svg { flex: none; color: #1d9e4f; }
.jmjcs-wa--primary { background: var(--cs-green); color: var(--cs-on-primary); }
.jmjcs-wa--primary svg { color: currentColor; }
.jmjcs-wa--primary:hover { background: var(--cs-green-press); color: var(--cs-on-primary); }
.jmjcs-wa--quiet { background: transparent; color: var(--cs-ink); box-shadow: inset 0 0 0 1px var(--cs-line); }
.jmjcs-wa--quiet:hover { background: var(--cs-green-tint); color: var(--cs-ink); }
.jmjcs-wa--link { padding-inline: 0; min-height: 44px; color: var(--cs-green); }
.jmjcs-wa--link span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.jmjcs-wa--link:hover span { text-decoration-thickness: 2px; }
.jmjcs-wa:focus-visible { outline: none; box-shadow: var(--cs-focus); }
.jmjcs-wa-inline { margin: .75rem 0 0; }

/* Status badges: colour plus text, never colour alone */
.jmjcs-badge {
	display: inline-block; padding: .2rem .55rem;
	border-radius: var(--cs-radius-s);
	font-size: .8125rem; font-weight: 600; line-height: 1.3; white-space: nowrap;
	background: color-mix(in srgb, var(--cs-ink) 7%, transparent); color: var(--cs-ink);
}
.jmjcs-badge.is-good { background: var(--cs-green-tint); color: var(--cs-green); }
.jmjcs-badge.is-wait { background: var(--cs-orange-tint); color: var(--cs-orange-ink); }
.jmjcs-badge.is-bad { background: var(--cs-bad-tint); color: var(--cs-bad); }
.jmjcs-badge.is-info { background: var(--cs-info-tint); color: var(--cs-info); }

/* Notices */
.jmjcs-notice, .jmjcs-callout {
	margin: 0 0 1rem; padding: .875rem 1rem;
	border-left: 4px solid var(--cs-green);
	background: var(--cs-green-tint); color: var(--cs-ink);
	border-radius: 0 var(--cs-radius-s) var(--cs-radius-s) 0;
}
.jmjcs-notice.is-bad, .jmjcs-callout.is-bad { border-color: var(--cs-bad); background: var(--cs-bad-tint); }
.jmjcs-notice.is-info, .jmjcs-callout.is-wait { border-color: var(--cs-orange); background: var(--cs-orange-tint); }
.jmjcs-callout a { color: inherit; font-weight: 650; }

/* Booking status */
.jmjcs-status { margin: 0 0 2rem; }
.jmjcs-status__head h2 { margin: 0 0 .35rem; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.15; }
.jmjcs-status__head p { margin: 0 0 1.25rem; color: var(--cs-muted); max-width: 60ch; }
.jmjcs-status.is-confirmed .jmjcs-status__head h2 { color: var(--cs-green); }

.jmjcs-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1px; margin: 0 0 1.5rem; background: var(--cs-line); border: 1px solid var(--cs-line); border-radius: var(--cs-radius); overflow: hidden; }
.jmjcs-facts > div { background: var(--cs-surface); padding: .8rem 1rem; }
.jmjcs-facts dt { font-size: .8125rem; color: var(--cs-muted); margin: 0 0 .2rem; }
.jmjcs-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.jmjcs-facts dd span { display: block; font-weight: 400; font-size: .875rem; color: var(--cs-muted); }

/* Payment card */
.jmjcs-pay { margin: 0 0 1.5rem; padding: 1.25rem; border: 1.5px solid var(--cs-green); border-radius: var(--cs-radius); background: var(--cs-surface); }
.jmjcs-pay h3 { margin: 0 0 .75rem; font-size: 1.125rem; }
.jmjcs-pay__rows { margin: 0; }
.jmjcs-pay__rows > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--cs-line); }
.jmjcs-pay__rows > div:last-child { border-bottom: 0; }
.jmjcs-pay__rows dt { color: var(--cs-muted); }
.jmjcs-pay__rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.jmjcs-pay__rows .is-ref dd strong { font-size: 1.375rem; letter-spacing: .04em; color: var(--cs-green); }
.jmjcs-pay__ref-note { margin: .75rem 0 .25rem; font-weight: 600; }
[data-jmjcs-copy] { cursor: copy; }
.jmjcs-copy-btn { margin-left: .5rem; padding: .15rem .45rem; border: 1px solid var(--cs-line); border-radius: var(--cs-radius-s); background: transparent; color: var(--cs-green); font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; vertical-align: middle; }
.jmjcs-copy-btn:focus-visible { outline: none; box-shadow: var(--cs-focus); }

/* Uploads */
.jmjcs-upload, .jmjcs-review-form { display: grid; gap: .6rem; margin: 0 0 1.5rem; padding: 1.25rem; border: 1px solid var(--cs-line); border-radius: var(--cs-radius); background: var(--cs-surface); }
.jmjcs-upload h3, .jmjcs-review-form h3 { margin: 0; font-size: 1.125rem; }
.jmjcs-upload input[type="text"], .jmjcs-review-form input[type="text"], .jmjcs-review-form textarea { width: 100%; min-height: 44px; padding: .6rem .75rem; border: 1px solid var(--cs-line); border-radius: var(--cs-radius-s); background: #fff; font: inherit; color: var(--cs-ink); }
.jmjcs-drop { position: relative; display: grid; gap: .2rem; place-items: center; min-height: 96px; padding: 1rem; border: 1.5px dashed color-mix(in srgb, var(--cs-green) 55%, var(--cs-line)); border-radius: var(--cs-radius); background: color-mix(in srgb, var(--cs-green-tint) 45%, transparent); text-align: center; cursor: pointer; }
.jmjcs-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.jmjcs-drop:focus-within { box-shadow: var(--cs-focus); }
.jmjcs-drop__label { font-weight: 650; color: var(--cs-green); }
.jmjcs-drop__file { font-size: .875rem; color: var(--cs-muted); word-break: break-all; }
.jmjcs-drop.has-file { border-style: solid; }
.jmjcs-field-error { margin: 0; color: var(--cs-bad); font-weight: 600; }
.jmjcs-check { display: flex; gap: .5rem; align-items: flex-start; }
.jmjcs-row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

.jmjcs-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: .15rem; margin: 0; padding: 0; border: 0; }
.jmjcs-rating legend { float: left; width: 100%; margin-bottom: .25rem; font-weight: 600; }
.jmjcs-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jmjcs-rating label { font-size: 2rem; line-height: 1; color: var(--cs-line); cursor: pointer; padding: .1rem; }
.jmjcs-rating input:checked ~ label, .jmjcs-rating label:hover, .jmjcs-rating label:hover ~ label { color: var(--cs-orange); }
.jmjcs-rating input:focus-visible + label { outline: 2px solid var(--cs-orange); border-radius: 2px; }

/* Community block */
.jmjcs-community { display: grid; gap: .5rem; justify-items: start; margin: 0 0 1.5rem; padding: 1.25rem; border-radius: var(--cs-radius); background: var(--cs-green-tint); }
.jmjcs-community h3 { margin: 0; font-size: 1.0625rem; }
.jmjcs-community p { margin: 0; }

/* Account list */
.jmjcs-account__group { margin: 1.5rem 0 .75rem; font-size: 1.125rem; }
.jmjcs-cards { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .75rem; }
.jmjcs-card { display: grid; gap: .35rem; padding: 1rem 1.1rem; border: 1px solid var(--cs-line); border-radius: var(--cs-radius); background: var(--cs-surface); color: var(--cs-ink); text-decoration: none; transition: border-color .15s var(--cs-ease); }
.jmjcs-card:hover { border-color: var(--cs-green); color: var(--cs-ink); }
.jmjcs-card:focus-visible { outline: none; box-shadow: var(--cs-focus); }
.jmjcs-card__title { font-weight: 700; font-size: 1.0625rem; }
.jmjcs-card__meta, .jmjcs-card__ref { color: var(--cs-muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.jmjcs-card__badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.jmjcs-card__due { font-weight: 650; color: var(--cs-orange-ink); }
.jmjcs-back { margin: 0 0 1rem; }
.jmjcs-back a::before { content: "‹ "; }
.jmjcs-detail section { margin: 0 0 1.75rem; }
.jmjcs-detail h3 { margin: 0 0 .75rem; font-size: 1.125rem; }
.jmjcs-receipt-list { margin: 0; padding-left: 1.1rem; }
.jmjcs-dash { margin: 0 0 1.5rem; }
.jmjcs-empty { padding: 2rem 1.25rem; border: 1px dashed var(--cs-line); border-radius: var(--cs-radius); text-align: center; }
.jmjcs-empty h2 { margin: 0 0 .5rem; font-size: 1.25rem; }
.jmjcs-empty p { margin: 0 auto 1rem; max-width: 46ch; color: var(--cs-muted); }

/* Journey timeline */
.cs-journey { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; counter-reset: cs-step; }
.cs-journey li { position: relative; padding-top: 1.35rem; font-size: .8125rem; line-height: 1.25; color: var(--cs-muted); }
.cs-journey li::before { content: ""; position: absolute; top: .3rem; left: 0; right: 0; height: 3px; background: var(--cs-line); }
.cs-journey li::after { content: ""; position: absolute; top: 0; left: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--cs-surface); box-shadow: inset 0 0 0 2px var(--cs-line); }
.cs-journey li span { display: block; padding-right: .5rem; }
.cs-journey li.is-done { color: var(--cs-ink); }
.cs-journey li.is-done::before, .cs-journey li.is-done::after { background: var(--cs-green); box-shadow: none; }
.cs-journey li.is-current { color: var(--cs-ink); font-weight: 700; }
.cs-journey li.is-current::before { background: linear-gradient(90deg, var(--cs-green) 0 50%, var(--cs-line) 50%); }
.cs-journey li.is-current::after { background: var(--cs-orange); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cs-orange) 28%, transparent); }
@media (max-width: 640px) {
	.cs-journey { grid-template-columns: 1fr; gap: .1rem; }
	.cs-journey li { padding: .35rem 0 .35rem 1.6rem; }
	.cs-journey li::before { top: 0; bottom: 0; left: 4px; right: auto; width: 3px; height: auto; }
	.cs-journey li::after { top: .55rem; }
	.cs-journey li.is-current::before { background: linear-gradient(180deg, var(--cs-green) 0 50%, var(--cs-line) 50%); }
}

/* Checkout summary (inside the theme's checkout) */
.jmjcs-checkout-summary { display: grid; gap: .35rem; margin: 0 0 1.5rem; padding: 1rem 1.25rem; border-left: 4px solid var(--cs-green); background: var(--cs-green-tint); border-radius: 0 var(--cs-radius) var(--cs-radius) 0; }
.jmjcs-checkout-summary p { margin: 0; }
.jmjcs-checkout-summary__title { font-weight: 700; font-size: 1.125rem; }
.jmjcs-checkout .woocommerce-form-coupon-toggle { display: none; }
/* The theme's "Add £X for free shipping" bar doesn't apply to cow shares. */
.jmjcs-checkout [class*="free-progress"], .jmjcs-checkout [class*="free-shipping-bar"], .jmjcs-checkout [class*="shipping-progress"], .jmjcs-checkout [class*="free-shipping-notice"] { display: none !important; }
.jmjcs-qty { font-variant-numeric: tabular-nums; }

/* Screen reader text (theme may not define it) */
.jmjcs-ui .screen-reader-text, .cs-page .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
	.jmjcs-ui *, .jmjcs-btn, .jmjcs-wa { transition: none !important; animation: none !important; }
}

/* PayPal "Pay in 3" messaging doesn't apply to cow shares (bank transfer only). */
.jmjcs-checkout .ppcp-messages, .jmjcs-checkout [data-pp-message] { display: none !important; }
