/* mg-inline-form.css — in-article lead form (approved compact spec).
   Enqueued as a real <head> stylesheet. Namespaced .mgi-* / .mgiForm.
   Shares the multi-step engine (.mg-ms) via mg-form-extend.js. No CDN. RTL.

   Spec class map (generic -> real): guru-embed=.mgiForm, guru-card=.mgi-formview,
   guru-badges=.mgi-pills, guru-badge=.mgi-pill, guru-choices=.mgi-goals,
   guru-choice=.mgi-goal, guru-choice__icon=.mgi-goal__ic,
   guru-choice__title=.mgi-goal__t, guru-choice__desc=.mgi-goal__s, guru-title=.mgi-headline. */

.mgiForm{
    --mgi-blue:#1e40af; --mgi-dark:#1e3a8a; --mgi-border:#DDE3F0; --mgi-muted:#5A6274;
    --mgi-err:#D64545; --mgi-purple:#6D28D9; --mgi-purple-bg:#EDE9FE;
    --mgi-orange:#B45309; --mgi-orange-bg:#FFF3E0;
    font-family:'Heebo', system-ui, sans-serif; direction:rtl; text-align:right;
    box-sizing:border-box; width:100%; max-width:720px; margin:20px auto;   /* desktop cap */
}
.mgiForm *{ box-sizing:border-box; }

/* Card: fills the embed (no narrow inner cap, no forced min-height). Both sub-screens
   live inside; height flows to content. */
.mgiForm .mgi-formview{
    width:100%; max-width:none; margin-inline:auto;
    display:flex; flex-direction:column;
    background:#fff; border:1px solid #e6ebf5; border-radius:20px;
    box-shadow:0 14px 40px -16px rgba(30,58,138,.22), 0 2px 6px -3px rgba(30,58,138,.12);
    padding:28px 32px;
}
.mgiForm .mgi-screen[hidden]{ display:none; }

/* Message row of badges — wrapping flex row, each badge sizes to content. */
.mgiForm .mgi-pills{ display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin:0 0 12px; }
.mgiForm .mgi-pill{
    display:inline-flex; align-items:center; gap:5px; width:auto;
    padding:4px 10px; font-size:11.5px; font-weight:700; border-radius:999px;
    line-height:1; white-space:nowrap; color:var(--mgi-dark);   /* clean text, no background */
}
.mgiForm .mgi-pill svg{ width:12px; height:12px; flex:0 0 auto; }
.mgiForm .mgi-pill--ai{ color:var(--mgi-purple); }
.mgiForm .mgi-pill--time{ color:var(--mgi-orange); }
/* Rate badge: the important one — KEEPS its background/emphasis + gentle FINITE pulse. */
.mgiForm .mgi-pill--rate{
    position:relative; background:#EEF2FF; border:1px solid #C7D2F0; padding:5px 11px;
    animation:mgi-rate-pulse 1.5s ease-in-out 2 both;
}
.mgiForm .mgi-pill--rate::after{
    content:""; position:absolute; inset:-3px; border-radius:999px; z-index:-1;
    background:rgba(30,64,175,.25); opacity:0; animation:mgi-rate-glow 1.5s ease-in-out 2 both;
}
@keyframes mgi-rate-pulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.06); } }
@keyframes mgi-rate-glow{ 0%,100%{ opacity:0; } 50%{ opacity:.55; } }

/* Heading (dark blue, 800). */
.mgiForm .mgi-headline{ font-size:20px; font-weight:800; color:#1e3a8a; line-height:1.3; letter-spacing:-.3px; text-align:center; margin:0 0 12px; }

/* The ONE feedback line per screen: small, green, at the TOP, above the inputs.
   Same green accent + subtle fade as the engine's .mg-ms__feedback. */
.mgiForm .mgi-feedback{ margin:0 0 10px; font-size:13px; font-weight:700; line-height:1.45; color:#15803d; text-align:center; }
.mgiForm .mgi-feedback.is-play{ animation:mgi-fb-in .26s ease both; }
@keyframes mgi-fb-in{ from{ opacity:0; transform:translateY(-4px); } to{ opacity:1; transform:none; } }

/* Two choice cards — identical, equal width, centered column (icon on top). */
.mgiForm .mgi-goals{ display:flex; gap:12px; margin:0 0 12px; }
.mgiForm .mgi-goal{
    flex:1 1 0; min-width:0;
    display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px;
    padding:12px 10px; cursor:pointer; font-family:inherit;
    background:#fff; border:1.5px solid var(--mgi-border); border-radius:12px;
    transition:border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.mgiForm .mgi-goal:hover{ border-color:var(--mgi-blue); background:#F6F8FF; }
.mgiForm .mgi-goal.is-sel{ border-color:var(--mgi-blue); background:#EEF2FF; box-shadow:0 0 0 3px rgba(30,64,175,.12); }
.mgiForm .mgi-goal:focus-visible{ outline:2px solid var(--mgi-blue); outline-offset:2px; }
/* Icon slot — inline SVG only (no external load). Swap the inner <svg> to rebrand. */
.mgiForm .mgi-goal__ic{ flex:none; width:36px; height:36px; border-radius:9px; background:#EAF0FF; color:var(--mgi-blue); display:flex; align-items:center; justify-content:center; }
.mgiForm .mgi-goal__ic svg{ width:20px; height:20px; }
.mgiForm .mgi-goal.is-sel .mgi-goal__ic{ background:var(--mgi-blue); color:#fff; }
.mgiForm .mgi-goal__txt{ display:flex; flex-direction:column; align-items:center; gap:2px; min-width:0; }
.mgiForm .mgi-goal__t{ font-size:14.5px; font-weight:700; color:#1F2540; line-height:1.25; white-space:normal; }
.mgiForm .mgi-goal__s{ font-size:12px; font-weight:500; color:var(--mgi-muted); line-height:1.3; }

/* "למטרות נוספות" reveal — small + tight. Collapsed group reserves ZERO height. */
.mgiForm .mgi-more-btn{
    display:inline-flex; align-items:center; gap:5px; margin:10px 0 0; padding:6px 4px;
    background:none; border:none; cursor:pointer; font-family:inherit;
    font-size:13px; font-weight:700; color:#1e40af; text-decoration:underline;
}
.mgiForm .mgi-more-btn svg{ width:14px; height:14px; flex:0 0 auto; transition:transform .15s ease; }
.mgiForm .mgi-more-btn[aria-expanded="true"] svg{ transform:rotate(180deg); }
.mgiForm .mgi-more-btn:focus-visible{ outline:2px solid var(--mgi-blue); outline-offset:2px; }
.mgiForm .mgi-more{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 0; }
.mgiForm .mgi-more[hidden]{ display:none; }   /* collapsed = zero reserved height */
.mgiForm .mgi-more:not([hidden]){ animation:mgi-reveal .18s ease both; }
@keyframes mgi-reveal{ from{ opacity:0; transform:translateY(-4px); } to{ opacity:1; transform:none; } }
.mgiForm .mgi-chip{
    min-height:44px; padding:9px 16px; cursor:pointer; font-family:inherit;
    font-size:14px; font-weight:700; color:var(--mgi-dark);
    background:#fff; border:1.5px solid var(--mgi-border); border-radius:999px;
    transition:border-color .12s ease, background .12s ease, color .12s ease;
}
.mgiForm .mgi-chip:hover{ border-color:var(--mgi-blue); background:#F6F8FF; }
.mgiForm .mgi-chip.is-sel{ border-color:var(--mgi-blue); background:var(--mgi-blue); color:#fff; }
.mgiForm .mgi-chip:focus-visible{ outline:2px solid var(--mgi-blue); outline-offset:2px; }

/* Hidden purpose <select> — engine reads its selected option TEXT (byte-exact). */
.mgiForm .mgi-purpose-hidden{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* Screen B: details. Back link + fields + consent + submit. */
.mgiForm .mgi-back{
    display:inline-flex; align-items:center; gap:5px; margin:0 0 10px; padding:4px 2px;
    background:none; border:none; cursor:pointer; font-family:inherit;
    font-size:13.5px; font-weight:700; color:var(--mgi-muted);
}
.mgiForm .mgi-back svg{ width:15px; height:15px; flex:0 0 auto; }
.mgiForm .mgi-back:hover{ color:var(--mgi-blue); }
.mgiForm .mgi-back:focus-visible{ outline:2px solid var(--mgi-blue); outline-offset:2px; }
.mgiForm .mgi-b-title{ font-size:18px; font-weight:800; color:var(--mgi-dark); text-align:center; margin:0 0 14px; }
.mgiForm .mgi-fields{ display:flex; flex-direction:column; gap:12px; }
.mgiForm .mgi-row2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }  /* name+phone side-by-side desktop */
.mgiForm .mgi-field{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.mgiForm .mgi-field label{ font-size:13px; font-weight:700; color:var(--mgi-dark); }
.mgiForm input[type=text], .mgiForm input[type=tel]{
    width:100%; height:54px; font-family:inherit; font-size:16px; color:#1F2540; /* 16px: no iOS zoom */
    background:#fff; border:1.5px solid var(--mgi-border); border-radius:12px; padding:0 14px; text-align:right;
}
.mgiForm input:focus{ outline:none; border-color:var(--mgi-blue); box-shadow:0 0 0 4px rgba(30,64,175,.12); }

/* Consent: checkbox to the RIGHT of its text (RTL row -> first child sits right). */
.mgiForm .mgi-consent{ display:flex; flex-direction:row; align-items:flex-start; gap:10px; text-align:right; cursor:pointer; font-size:12.5px; line-height:1.5; color:var(--mgi-muted); }
.mgiForm .mgi-consent input{ margin-top:2px; width:18px; height:18px; accent-color:var(--mgi-blue); flex:0 0 auto; }
.mgiForm .mgi-consent a{ color:var(--mgi-blue); font-weight:700; text-decoration:underline; }

.mgiForm .mgi-err{ color:var(--mgi-err); font-size:12.5px; font-weight:700; margin:0; }

.mgiForm .mgi-submit{
    height:54px; border:none; border-radius:12px; background:var(--mgi-blue); color:#fff;
    font-size:16px; font-weight:800; font-family:inherit; cursor:pointer; transition:background .15s ease;
}
.mgiForm .mgi-submit:hover, .mgiForm .mgi-submit:focus, .mgiForm .mgi-submit:active{ background:var(--mgi-dark); color:#fff; opacity:1; }
.mgiForm .mgi-submit:focus-visible{ outline:none; box-shadow:0 0 0 4px rgba(30,64,175,.3); }
.mgiForm .mgi-loader{ font-size:13px; font-weight:600; color:var(--mgi-blue); text-align:center; }

/* Success (briefly shown to trip the engine observer, then engine takes over). */
.mgiForm .mgi-success{
    display:none; width:100%; max-width:520px; margin-inline:auto; flex-direction:column; gap:4px; text-align:center;
    padding:18px; background:#F0F9F4; border:1px solid #BBE7CB; border-radius:16px;
}
.mgiForm .mgi-success strong{ font-size:18px; color:var(--mgi-dark); }
.mgiForm .mgi-success span{ font-size:13.5px; color:var(--mgi-muted); }

/* MOBILE (<=767px): full width minus 16px page gutter, 3 badges only, choice cards
   equal width with no sub-desc, smaller heading — compact goal screen. */
@media (max-width:767px){
    .mgiForm{ max-width:100%; margin:12px 0; padding:0 16px; }        /* full width, 16px page gutter */
    .mgiForm .mgi-formview{ padding:16px; border-radius:16px; }        /* inner padding 16px, not more */
    .mgiForm .mgi-pill--assoc, .mgiForm .mgi-pill--time{ display:none; } /* keep only rate / 20yr / AI */
    .mgiForm .mgi-headline{ font-size:16.5px; margin-bottom:10px; }
    .mgiForm .mgi-goal{ padding:12px 8px; }
    .mgiForm .mgi-goal__t{ font-size:14px; }
    .mgiForm .mgi-goal__s{ display:none; }                            /* drop sub-desc on mobile */
    .mgiForm .mgi-row2{ grid-template-columns:1fr; gap:10px; }        /* name/phone stacked (usable width) */
    .mgiForm input[type=text], .mgiForm input[type=tel]{ height:50px; }
}

/* Honor reduced-motion: no reveal animation, no chevron rotation, no rate pulse. */
@media (prefers-reduced-motion: reduce){
    .mgiForm .mgi-more:not([hidden]){ animation:none; }
    .mgiForm .mgi-more-btn svg{ transition:none; }
    .mgiForm .mgi-pill--rate{ animation:none; }
    .mgiForm .mgi-pill--rate::after{ animation:none; opacity:0; }
    .mgiForm .mgi-feedback.is-play{ animation:none; }   /* no fade on the feedback line */
    /* Static small check, no self-draw (the shared engine CSS already stops the draw). */
    .mgiForm .mg-ms__anim.is-play{ animation:none; }
    /* Stage-1 field errors appear instantly - no fade, no movement. */
    .mgiForm .mgi-fielderr.is-play{ animation:none; }
}

/* Inline instance ONLY: let each ENGINE step (SMS / Stage 2 / Stage 3 / thank-you)
   size to its OWN content — no large reserved gap below. The inline flow inserts
   .mg-ms--ext inside .mgiForm, so this is scoped to the inline instance; the
   sidebar/popup frame lives inside .mkSideForm and keeps its 512/480px height,
   UNCHANGED. Small floor prevents collapse on the shortest step. */
.mgiForm .mg-ms--ext{ min-height:120px; }
.mgiForm .mg-ms--ext .mg-ms__step:not([hidden]){ max-height:none; overflow-y:visible; }

/* Stage2->Stage3 checkmark, INLINE instance only: shrink 56px -> 32px and drop the
   margin 10px -> 6px, so it adds no card/page height. Aspect ratio and the self-draw
   stroke animation are unchanged (viewBox 0 0 52 52 just renders smaller). This is the
   deliberate inline-only size decision; the sidebar/popup checkmark keeps its 56px.
   ALL other insurance offer + sub-flow styling now lives in mg-multistep.css (shared),
   scoped to .mg-ms--ext, so both instances render it. */
.mgiForm .mg-ms__anim{ margin:0 0 6px; }
.mgiForm .mg-ms__anim svg{ width:32px; height:32px; }

/* ==== Stage-1 red field errors (INLINE form only: .mgi-* fields) =================
   The insurance sub-flow's .mg-ms__fielderr lives in the shared stylesheet now. */
.mgiForm .mgi-fielderr{
    margin:4px 0 0; padding:0;
    font-family:inherit; font-size:13px; font-weight:500; line-height:1.4;
    color:#D92D20; text-align:right; direction:rtl;
}
.mgiForm .mgi-fielderr[hidden]{ display:none; }
.mgiForm .mgi-fielderr.is-play{ animation:mgi-err-in .2s ease both; }
@keyframes mgi-err-in{ from{ opacity:0; transform:translateY(-3px); } to{ opacity:1; transform:none; } }

/* The invalid field itself: red border + red focus ring. */
.mgiForm [aria-invalid="true"]{ border-color:#D92D20; }
.mgiForm [aria-invalid="true"]:focus-visible{ outline-color:#D92D20; }
/* The goal cards and the consent checkbox have no border to redden, so mark them. */
.mgiForm .mgi-goals:has(+ .mgi-fielderr:not([hidden])) .mgi-goal{ border-color:#D92D20; }
.mgiForm input[type="checkbox"][aria-invalid="true"]{ outline:2px solid #D92D20; outline-offset:1px; }

/* Typography-bleed guard: the engine inserts the .mg-ms flow INSIDE .mg-content. */
.mg-content .mg-ms p{ max-width:none; }
.mg-content .mg-ms .mg-ms__prize{ text-decoration:none; }
.mg-content .mg-ms a{ text-decoration:underline; }
.mg-content .mg-ms img{ margin:0; border-radius:0; }
