/* ג'חנון גדרה — "how and when" bar and picker.
   Reads the theme's brand tokens; the fallbacks keep it usable without them. */

.jgo-bar,
.jgo-dialog {
	--jgo-red: var(--jg-red, #a01c20);
	--jgo-ink: var(--jg-ink, #241a17);
	--jgo-muted: var(--jg-ink-muted, #6e5b54);
	--jgo-line: var(--jg-border, #e4dbcd);
	--jgo-sunk: var(--jg-surface-sunk, #f6f1e7);
	--jgo-paper: var(--jg-surface, #fffcf7);
	--jgo-tint: #fbeeee;
	--jgo-focus: var(--jg-focus, #a01c20);
}

/* ---- bar ---------------------------------------------------------------- */

.jgo-bar {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 24px;
	padding: 12px 14px;
	border: 1.5px solid var(--jgo-line);
	border-radius: 18px;
	background: var(--jgo-sunk);
	color: var(--jgo-ink);
}

.jgo-bar.is-set { background: #fff; border-color: var(--jgo-red); }
.jgo-bar.is-problem { border-color: var(--jgo-red); background: var(--jgo-tint); }

.jgo-bar__icon {
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--jgo-red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f9e6' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.6'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E") center / 22px no-repeat;
}

.jgo-bar__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	line-height: 1.35;
}

.jgo-bar__text strong { font-size: 16.5px; }
.jgo-bar__text span { color: var(--jgo-muted); font-size: 14.5px; }
.jgo-bar.is-problem .jgo-bar__text span { color: var(--jgo-red); font-weight: 600; }
/* Keeps "משלוח 07:30–13:30" whole, so a line never ends on the dash. */
.jgo-nb { white-space: nowrap; }
/* Narrow screens can't hold both ranges on one line, and a wrapped "·" is
   left dangling at the line end — so stack them and drop the separator. */
@media (max-width: 430px) {
	.jgo-bar__text [data-jgo-when] { display: flex; flex-direction: column; align-items: flex-start; }
	.jgo-bar__text .jgo-sep { display: none; }
}

.jgo-bar .jgo-bar__btn {
	flex: none;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	box-shadow: inset 0 0 0 1.5px var(--jgo-ink);
	color: var(--jgo-ink);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.jgo-bar .jgo-bar__btn:hover { box-shadow: inset 0 0 0 1.5px var(--jgo-red); color: var(--jgo-red); background: transparent; }
.jgo-bar .jgo-bar__btn[hidden] { display: none; }

/* ---- dialog: centred on desktop, a bottom sheet on phones ---------------- */

.jgo-dialog {
	box-sizing: border-box;
	width: min(560px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100dvh - 32px);
	padding: 0;
	overflow: auto;
	border: 0;
	border-radius: 22px;
	background: var(--jgo-paper);
	color: var(--jgo-ink);
	box-shadow: 0 30px 80px -24px rgba(36, 26, 23, .5);
}

.jgo-dialog::backdrop { background: rgba(36, 26, 23, .5); }

@media (max-width: 600px) {
	.jgo-dialog {
		width: 100%;
		max-height: 92dvh;
		margin: auto 0 0;
		border-radius: 22px 22px 0 0;
	}
}

.jgo-dialog.is-loading [data-jgo-slots],
.jgo-dialog.is-loading [data-jgo-dates] { opacity: .4; }

.jgo-dialog .jg-sr {
	position: absolute !important;
	width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.jgo-form {
	display: grid;
	gap: 18px;
	padding: 18px 20px 22px;
}

.jgo-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.jgo-form__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.jgo-form__title {
	margin: 0;
	font-family: var(--jg-font-display, inherit);
	font-size: 30px;
	font-weight: 400;
	line-height: 1.1;
	color: var(--jgo-red);
}

.jgo-dialog .jgo-x {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--jgo-ink);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.jgo-dialog .jgo-x:hover { background: var(--jgo-sunk); }

.jgo-label {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	color: var(--jgo-muted);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
}

/* hidden native radios, drawn by their sibling span */
.jgo-seg input,
.jgo-card input,
.jgo-chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.jgo-dialog :focus-visible,
.jgo-seg input:focus-visible + span,
.jgo-card input:focus-visible + span,
.jgo-chip input:focus-visible + span {
	outline: 2px solid var(--jgo-focus);
	outline-offset: 2px;
}

/* delivery / pickup switch */
.jgo-seg {
	display: grid !important;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	padding: 4px !important;
	border-radius: 14px;
	background: var(--jgo-sunk);
}

.jgo-seg label { position: relative; margin: 0; }

.jgo-seg span {
	display: block;
	padding: 12px;
	border-radius: 11px;
	font-size: 16px;
	font-weight: 700;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s, color .15s, box-shadow .15s;
}

.jgo-seg input:checked + span {
	background: #fff;
	color: var(--jgo-red);
	box-shadow: 0 1px 3px rgba(36, 26, 23, .18);
}

.jgo-select {
	box-sizing: border-box;
	width: 100%;
	min-height: 50px;
	padding: 0 14px;
	border: 1.5px solid var(--jgo-line);
	border-radius: 12px;
	background: #fff;
	color: var(--jgo-ink);
	font: inherit;
	font-size: 16px;
}

/* branches */
.jgo-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jgo-card { position: relative; margin: 0; }

.jgo-card span {
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border: 1.5px solid var(--jgo-line);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
}

.jgo-card small { color: var(--jgo-muted); font-size: 13.5px; }
.jgo-card input:checked + span { border-color: var(--jgo-red); background: var(--jgo-tint); }

/* dates and windows */
.jgo-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Dates read as word + number ("השבת הקרובה / 14.11"), so they need equal
   widths rather than a wrapping row of different-length labels. */
.jgo-chips--dates {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.jgo-chips--dates .jgo-chip span { padding: 8px 8px; min-height: 56px; }
.jgo-chips--dates .jgo-chip b { font-size: 15px; white-space: normal; text-align: center; }
.jgo-chips--dates .jgo-chip small { font-size: 12.5px; color: var(--jgo-muted); }
.jgo-chips--dates .jgo-chip input:checked + span small { color: inherit; }

/* A later Saturday is a real choice, not an error — hence amber, a notice
   voice, and a way back rather than a block. */
.jgo-ahead {
	margin-top: 10px;
	padding: 11px 12px;
	border: 1.5px solid #e0b43a;
	border-radius: 12px;
	background: #fdf6e3;
	opacity: 0;
	transform: translateY(-2px);
	transition: opacity .16s cubic-bezier(.23, 1, .32, 1), transform .16s cubic-bezier(.23, 1, .32, 1);
}
.jgo-ahead.is-shown { opacity: 1; transform: none; }
.jgo-ahead[hidden] { display: none; }
.jgo-ahead p {
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
	color: #5c4409;
}
.jgo-ahead strong { font-weight: 700; color: var(--jgo-ink); }
/* The theme paints every bare <button> red on hover, which swallowed this
   one's label. Scoped selectors (as .jgo-bar__btn already does) win it back. */
.jgo-ahead .jgo-ahead__btn {
	display: block;
	width: 100%;
	margin-top: 10px;
	min-height: 44px;
	padding: 10px 12px;
	border: 0;
	border-radius: 10px;
	box-shadow: inset 0 0 0 1.5px var(--jgo-ink);
	background: #fff;
	color: var(--jgo-ink);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: box-shadow .15s, color .15s, background-color .15s;
}
.jgo-ahead .jgo-ahead__btn:hover,
.jgo-ahead .jgo-ahead__btn:focus {
	background: #fff;
	box-shadow: inset 0 0 0 1.5px var(--jgo-red);
	color: var(--jgo-red);
}
.jgo-ahead .jgo-ahead__btn:active { background: var(--jgo-tint); }

@media (prefers-reduced-motion: reduce) {
	.jgo-ahead { transition: opacity .16s ease; transform: none; }
}

/* The reminder follows the choice out of the dialog: the bar keeps saying
   "(שבוע הבא)" on the menu and at checkout. */
.jgo-bar.is-set.is-ahead { border-color: #e0b43a; }
.jgo-bar.is-set.is-ahead .jgo-bar__text span { color: #8a6508; font-weight: 600; }

/* delivery: 4 ranges in two columns; pickup: 12 start times in four */
.jgo-chips--slots {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

/* Pickup is a two-step choice: pick an hour (one row of 4–5 chips), then the
   quarter inside it. Keeps the dialog short on mobile, no nested scroll. */
.jgo-chips--slots[data-type="pickup"] { display: block; }
/* minmax(0,…) — a plain 1fr refuses to shrink below the chip's own
   min-content width, which overflowed the dialog on a phone once the pickup
   day grew to twelve hours. Four per row on a phone, six once there's room. */
.jgo-hours { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.jgo-hours .jgo-chip span { min-height: 44px; font-size: 15px; font-weight: 700; padding: 6px 4px; }
@media (min-width: 420px) {
	.jgo-hours { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.jgo-hint {
	margin: 10px 2px 0;
	font-size: 12.5px;
	color: var(--jgo-muted);
	text-align: center;
}

.jgo-sub {
	margin-top: 10px;
	padding: 12px;
	background: #fbf3e3;
	border: 1px solid #ecdcb8;
	border-radius: 12px;
}
.jgo-sub .jgo-chip span { background: #fff; }
.jgo-sub__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 12.5px;
	color: var(--jgo-muted);
	margin-bottom: 8px;
}
.jgo-sub__head b { color: var(--jgo-ink, #241a17); font-weight: 700; }
.jgo-link {
	background: transparent;
	border: 0;
	color: var(--jgo-red, #a01c20);
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	padding: 2px 4px;
}
.jgo-link:hover { text-decoration: underline; }

.jgo-quarters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.jgo-quarters .jgo-chip span { min-height: 42px; font-size: 14px; font-weight: 600; padding: 4px 3px; }

.jgo-chip { position: relative; margin: 0; }

.jgo-chip span {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	box-sizing: border-box;
	padding: 6px 14px;
	border: 1.5px solid var(--jgo-line);
	border-radius: 12px;
	background: #fff;
	font-size: 15.5px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}

.jgo-chip b { font-weight: 700; unicode-bidi: isolate; white-space: nowrap; }
.jgo-chip small { margin-top: 2px; font-size: 11.5px; font-weight: 700; }
.jgo-chip:hover span { border-color: var(--jgo-ink); }
.jgo-chip input:checked + span { border-color: var(--jgo-red); background: var(--jgo-tint); color: var(--jgo-red); }

.jgo-chip.is-disabled span {
	border-style: dashed;
	background: transparent;
	color: var(--jgo-muted);
	cursor: not-allowed;
}

.jgo-chip.is-disabled:hover span { border-color: var(--jgo-line); }

.jgo-empty,
.jgo-note { margin: 0; color: var(--jgo-muted); font-size: 14px; }

.jgo-error {
	margin: 0;
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--jgo-tint);
	color: var(--jgo-red);
	font-weight: 600;
}

.jgo-error[hidden] { display: none; }

/* The way out of the error, inside the error itself. */
.jgo-fix {
	display: block;
	width: 100%;
	margin: 10px 0 0;
	min-height: 44px;
	padding: 10px 14px;
	border: 0;
	border-radius: 10px;
	background: var(--jgo-red, #a01c20);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.jgo-fix:hover { filter: brightness(1.08); }
.jgo-fix:disabled { opacity: .6; cursor: default; }

/* works without the theme's button styles too */
.jgo-dialog .jgo-save {
	width: 100%;
	min-height: 52px;
	border: 0;
	border-radius: 12px;
	background: var(--jg-gold, #ffdd33);
	color: var(--jg-gold-ink, #241a17);
	font: inherit;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
}

.jgo-dialog .jgo-save:hover { background: var(--jg-gold-hover, #f5cf14); color: var(--jg-gold-ink, #241a17); }
.jgo-dialog .jgo-save:disabled { opacity: .55; cursor: not-allowed; }

/* order pages */
.jgo-order-when { padding: 12px 14px; border-radius: 12px; background: var(--jg-surface-sunk, #f6f1e7); }

@media (prefers-reduced-motion: reduce) {
	.jgo-seg span, .jgo-chip span { transition: none; }
}

/* ---- paid extras (product page now, the quick-add popup next) ----------- */

.jgo-extras {
	display: grid;
	gap: 8px;
	margin: 0 0 18px;
	padding: 0;
	border: 0;
}

.jgo-extras .jgo-label {
	display: block;
	margin: 0 0 4px;
	color: var(--jg-ink-muted, #6e5b54);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
}

.jgo-extra {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	box-sizing: border-box;
	padding: 8px 14px;
	border: 1.5px solid var(--jg-border, #e4dbcd);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
}

.jgo-extra input { width: 18px; height: 18px; margin: 0; accent-color: var(--jg-red, #a01c20); }
.jgo-extra__name { flex: 1; font-weight: 600; }
.jgo-extra__price { color: var(--jg-ink-muted, #6e5b54); font-weight: 700; font-variant-numeric: tabular-nums; }
.jgo-extra:has(input:checked) { border-color: var(--jg-red, #a01c20); background: #fbeeee; }
.jgo-extra:has(input:focus-visible) { outline: 2px solid var(--jg-focus, #a01c20); outline-offset: 2px; }

/* checkout: below the delivery minimum — explain, offer the two ways out */
.jgo-alert {
	display: grid;
	gap: 14px;
	margin: 0 0 24px;
	padding: 18px 20px;
	border: 1.5px solid var(--jg-red, #a01c20);
	border-radius: 18px;
	background: #fbeeee;
	color: var(--jg-ink, #241a17);
}

.jgo-alert p { margin: 0; font-weight: 600; }
.jgo-alert__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.jgo-alert button.jg-btn { background: transparent; cursor: pointer; }
