/* JetCopy Lead Form — conversational form. BEM, RTL, responsive, theme-token driven.
   Designed to sit on a colored/imaged section (like the existing form): transparent,
   border-only fields, white text, and the site CTA button (white → red-fill on hover).
   DARK mode (default) = form on a dark/coloured section. LIGHT mode (.jclf-mode-light,
   set by the widget's "מצב תצוגה" control) = same markup re-themed for a white background.
   All mode-specific colours are CSS vars on .jclf; light mode only flips the vars. */
.jclf {
	--jclf-accent: var(--e-global-color-primary, #C4161F);
	--jclf-primary: var(--e-global-color-primary, #cc3433);
	/* match the existing form's fields exactly: transparent bg, #EEEEEE border, #F6F6F6 text, 14px */
	--jclf-border: var(--e-global-color-1fd232b, #eeeeee);
	--jclf-text: var(--e-global-color-secondary, #f6f6f6);
	--jclf-field-bg: var(--e-global-color-7640d3d, transparent);
	/* theme tokens flipped by light mode — defaults below = DARK (white-on-dark) */
	--jclf-on: #fff;                                       /* emphasis: hover/checked/focus borders, checkbox fill, progress, error */
	--jclf-track: rgba(255, 255, 255, 0.25);              /* progress track */
	--jclf-focus-ring: rgba(255, 255, 255, 0.35);         /* input focus ring */
	--jclf-autofill-fallback: var(--jclf-accent, #C4161F); /* opaque autofill paint before JS resolves the real bg */
	--jclf-btn-bg: #fff;
	--jclf-btn-fg: var(--jclf-primary, #cc3433);
	--jclf-btn-fill: var(--jclf-accent, #C4161F);
	--jclf-btn-fg-hover: #fff;
	--jclf-btn-border: #fff;
	--jclf-field-radius: 14px;
	--jclf-gap: 14px;
	--jclf-control-h: 50px; /* shared height for inputs / option pills / buttons (textarea excepted) */
	box-sizing: border-box;
	direction: rtl;
	width: 100%;
	max-width: var(--jclf-max-width, none);
	background: var(--jclf-bg, transparent);
	color: var(--jclf-text);
	font-family: var(--e-global-typography-text-font-family, var(--e-global-typography-primary-font-family, "Noto Sans Hebrew", Arial, sans-serif));
	font-size: 15px;
	font-weight: 500;
	line-height: 1.5;
}
.jclf *, .jclf *::before, .jclf *::after { box-sizing: border-box; }

/* the step-1 question ("private or business?") is conveyed by the two option cards —
   keep it for assistive tech but hide it visually (descendant selector already wins). */
.jclf__step[data-step="type"] .jclf__question {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Progress */
.jclf__progress { height: 4px; border-radius: 99px; background: var(--jclf-track); overflow: hidden; margin-bottom: clamp(1rem, 2.6vw, 1.6rem); }
.jclf__progress-bar { display: block; height: 100%; width: 0; background: var(--jclf-on); border-radius: inherit; transition: width .3s ease; }

.jclf__title { margin: 0 0 1.1rem; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 700; line-height: 1.25; color: var(--jclf-title-color, inherit); }

/* Steps */
.jclf__step { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.jclf__step[hidden] { display: none; }
.jclf__question { padding: 0; margin: 0 0 1rem; font-size: clamp(1.02rem, 1.4vw, 1.18rem); font-weight: 600; line-height: 1.35; color: var(--jclf-text); }
.jclf__hint { font-weight: 500; font-size: .82em; opacity: .75; }

/* Options — styled like the contact fields: transparent, border only, themed text */
.jclf__options { display: flex; flex-direction: column; gap: 10px; }
.jclf__options--cards { flex-direction: row; gap: var(--jclf-gap); }
.jclf__options--inline { flex-direction: row; flex-wrap: wrap; }

.jclf__option {
	display: flex; align-items: center; gap: .6em;
	min-height: var(--jclf-control-h); padding: 6px 16px;
	font-size: 16px; font-weight: 500;
	background: transparent;
	border: 1px solid var(--jclf-border);
	border-radius: var(--jclf-field-radius);
	color: var(--jclf-text);
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
	-webkit-tap-highlight-color: transparent;
}
/* native control kept focusable but visually hidden — the box itself is the affordance */
.jclf__option input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.jclf__option-label { min-width: 0; }
.jclf__option:hover { border-color: var(--jclf-on); }
.jclf__option:has(input:checked) { border-color: var(--jclf-on); box-shadow: inset 0 0 0 1px var(--jclf-on); }
.jclf__option:has(input:checked) .jclf__option-label { font-weight: 700; }
.jclf__option:has(input:focus-visible) { outline: 2px solid var(--jclf-on); outline-offset: 2px; }
/* checkmark for multi-select (checkbox) options only */
.jclf__option:has(input[type="checkbox"]) .jclf__option-label { display: inline-flex; align-items: center; gap: .5em; }
.jclf__option:has(input[type="checkbox"]) .jclf__option-label::before {
	content: ""; flex: 0 0 auto; width: 1.05em; height: 1.05em;
	border: 1px solid var(--jclf-border); border-radius: 5px;
	transition: background-color .15s ease, border-color .15s ease;
}
.jclf__option:has(input[type="checkbox"]:checked) .jclf__option-label::before {
	border-color: var(--jclf-on);
	background-color: var(--jclf-on);
	background-repeat: no-repeat; background-position: center; background-size: .7em;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23cc3433' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E");
}

.jclf__option--card { flex: 1 1 0; justify-content: center; text-align: center; padding: 6px 16px; font-size: 1.05em; font-weight: 600; }
.jclf__option--pill { flex: 0 0 auto; }

/* Contact fields — match the existing form exactly: transparent box, themed border, 14px
   radius, themed text, label conveyed by the placeholder (label kept for AT only). */
.jclf__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jclf__field { display: flex; flex-direction: column; gap: .35em; min-width: 0; }
.jclf__field--full { grid-column: 1 / -1; }
.jclf__label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* .jclf prefix raises specificity above the theme's generic input rules (no !important).
   Metrics copied verbatim from Elementor's .elementor-field-textual.elementor-size-md. */
.jclf .jclf__input {
	width: 100%;
	font-family: inherit; font-size: 16px; font-weight: 500; line-height: 1.4;
	min-height: var(--jclf-control-h); padding: 6px 16px;
	text-align: right; /* keep RTL placeholder/text alignment (esp. the tel field) */
	color: var(--jclf-text);
	background-color: var(--jclf-field-bg);
	border: 1px solid var(--jclf-border);
	border-radius: var(--jclf-field-radius);
	box-shadow: none;
	-webkit-appearance: none; appearance: none;
}
.jclf .jclf__textarea { min-height: 108px; padding: 11px 16px; resize: vertical; line-height: 1.5; }
.jclf .jclf__input::placeholder { color: var(--jclf-text); opacity: .8; }
/* focus uses border + outline (NOT box-shadow) so it never overrides the autofill paint */
.jclf .jclf__input:focus { border-color: var(--jclf-text); outline: 2px solid var(--jclf-focus-ring); outline-offset: 0; }
/* Modern Chrome ignores the background-color transition trick on autofill — the ONLY
   reliable override is an opaque inset box-shadow. JS sets --jclf-autofill-bg to the
   actual section background behind the form, so the autofilled field looks identical
   to the transparent one (section colour + themed text). Covers all interaction states. */
.jclf .jclf__input:-webkit-autofill,
.jclf .jclf__input:-webkit-autofill:hover,
.jclf .jclf__input:-webkit-autofill:focus,
.jclf .jclf__input:-webkit-autofill:active {
	-webkit-text-fill-color: var(--jclf-text) !important;
	caret-color: var(--jclf-text);
	-webkit-box-shadow: 0 0 0 1000px var(--jclf-autofill-bg, var(--jclf-autofill-fallback)) inset !important;
	box-shadow: 0 0 0 1000px var(--jclf-autofill-bg, var(--jclf-autofill-fallback)) inset !important;
}
/* standard :autofill kept separate so an unsupporting browser can't void the rule above */
.jclf .jclf__input:autofill {
	-webkit-text-fill-color: var(--jclf-text) !important;
	box-shadow: 0 0 0 1000px var(--jclf-autofill-bg, var(--jclf-autofill-fallback)) inset !important;
}
/* JS hook: fire an animation the instant a field is autofilled so we can neutralise it */
@keyframes jclf-autofill-detect { from {} to {} }
.jclf .jclf__input:-webkit-autofill { animation-name: jclf-autofill-detect; animation-duration: .01s; }
.jclf .jclf__field--invalid .jclf__input { border-color: var(--jclf-on); }
.jclf__error { margin-top: 3px; font-size: 14px; font-weight: 600; color: var(--jclf-on); min-height: 1em; }
.jclf__error:empty { display: none; }

/* Notes */
.jclf__note { margin: .9rem 0 0; padding: 0; font-size: .95em; font-weight: 600; line-height: 1.45; color: var(--jclf-text); }
.jclf__note::before { content: "* "; }
.jclf__note[hidden] { display: none; }
.jclf__note a { color: inherit; font-weight: 700; }

/* Nav + buttons — primary action full width, secondary (back) below */
.jclf__nav { display: flex; flex-direction: column-reverse; gap: 10px; margin-top: 16px; }
.jclf__btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 100%;
	font: inherit; font-family: var(--e-global-typography-primary-font-family, "Noto Sans Hebrew", Arial, sans-serif);
	font-size: 15px; font-weight: 700; line-height: 1.4;
	min-height: var(--jclf-control-h); padding: 0 1.6em; border-radius: 14px; border: 1px solid transparent;
	cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.jclf__btn[hidden] { display: none; }
.jclf__btn:focus-visible { outline: 2px solid var(--jclf-on); outline-offset: 3px; }
.jclf__btn:disabled { opacity: .65; cursor: default; }

/* primary CTA: themed bg, themed text → fill slides in on hover. Dark = white button /
   red text / red fill. Light = red button / white text / darker-red fill. */
.jclf__btn--next, .jclf__btn--submit {
	--fill-tip: 26px;
	position: relative; overflow: hidden; isolation: isolate;
	background: var(--jclf-btn-bg); color: var(--jclf-btn-fg); border-color: var(--jclf-btn-border);
	transition: color .25s ease;
}
.jclf__btn--next::before, .jclf__btn--submit::before {
	content: ""; position: absolute; top: 0; bottom: 0;
	right: calc(var(--fill-tip) * -1);
	width: calc(100% + (var(--fill-tip) * 2));
	background: var(--jclf-btn-fill); z-index: 0;
	clip-path: polygon(var(--fill-tip) 0, 100% 0, 100% 100%, var(--fill-tip) 100%, 0 50%);
	transform: translateX(100%); transition: transform .35s ease;
}
.jclf__btn--next:hover::before, .jclf__btn--submit:hover::before { transform: translateX(0); }
.jclf__btn--next:hover, .jclf__btn--next:focus, .jclf__btn--next:active,
.jclf__btn--submit:hover, .jclf__btn--submit:focus, .jclf__btn--submit:active { background: var(--jclf-btn-bg); }
.jclf__btn--next:hover, .jclf__btn--submit:hover { color: var(--jclf-btn-fg-hover); }
.jclf__btn-text {
	position: relative; z-index: 1; color: inherit;
	display: inline-flex; align-items: center; gap: .4em;
}
.jclf__btn--next .jclf__btn-text::after, .jclf__btn--submit .jclf__btn-text::after {
	content: ""; display: inline-block; width: .55em; height: .55em;
	border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
	transform: rotate(45deg); transition: transform .25s ease;
	flex: 0 0 auto; position: relative; top: 1px;
}
.jclf__btn--next:hover .jclf__btn-text::after, .jclf__btn--submit:hover .jclf__btn-text::after { transform: translateX(-4px) rotate(45deg); }

/* secondary: ghost */
.jclf__btn--back { background: transparent; color: var(--jclf-text); border-color: var(--jclf-border); }
.jclf__btn--back:hover, .jclf__btn--back:focus { border-color: var(--jclf-on); color: var(--jclf-text); background: transparent; }

.jclf__status { margin: .8rem 0 0; min-height: 1em; font-size: 14px; font-weight: 600; color: var(--jclf-on); }
.jclf__status:empty { display: none; }

/* Success — compact, no decorative element; all buttons hidden once submitted */
.jclf__nav[hidden], .jclf__fields[hidden] { display: none; }
.jclf__step--done { text-align: center; padding: 1.25rem 0; }
.jclf__success { margin: 0; font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; color: var(--jclf-text); }

/* ============================================================================
   LIGHT MODE — same form, themed for a white/light section (e.g. contact page).
   Set by the widget's "מצב תצוגה" → בהיר control (adds .jclf-mode-light on the
   widget wrapper). Only flips the theme tokens; every rule above reads the vars. */
.jclf-mode-light .jclf {
	--jclf-text: #1f2533;                          /* dark body text */
	--jclf-border: #d7d7dc;                        /* visible grey border on white */
	--jclf-on: var(--jclf-accent, #C4161F);        /* emphasis = brand red */
	--jclf-track: rgba(0, 0, 0, 0.10);
	--jclf-focus-ring: rgba(238, 84, 76, 0.30);
	--jclf-autofill-fallback: #fff;
	--jclf-btn-bg: transparent;                    /* outline at rest (border only) */
	--jclf-btn-fg: var(--jclf-accent, #C4161F);    /* red text + chevron at rest */
	--jclf-btn-fill: var(--jclf-accent, #C4161F);  /* red arrow-fill slides in on hover */
	--jclf-btn-fg-hover: #fff;                      /* text + chevron turn white on hover */
	--jclf-btn-border: var(--jclf-accent, #C4161F);
}
/* white checkmark glyph on the (now red) checkbox fill */
.jclf-mode-light .jclf .jclf__option:has(input[type="checkbox"]:checked) .jclf__option-label::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E");
}

/* Responsive */
@media (max-width: 560px) {
	.jclf__fields { grid-template-columns: 1fr; }
	.jclf__options--cards { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
	.jclf__progress-bar, .jclf__option, .jclf__btn, .jclf__btn::before, .jclf__btn-text::after, .jclf__input { transition: none; }
}
