/* קליל: טופס אפיון חכם + עוזרת AI באתר */

/* ---------- spec section ---------- */
.aispec { background: var(--teal-100); }
.aispec-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.aispec h2 { max-width: 18ch; }
.aispec-form { margin-top: 26px; }
.aispec-form .hint { display: block; font-size: 13px; color: var(--slate); margin-top: 6px; }
.aispec-form .btn { min-width: 220px; }
.aispec-form .btn[aria-busy=true] { opacity: .75; cursor: progress; }

.aispec-paper {
  position: sticky; top: 110px;
  background: #fff; border-radius: 6px 6px 22px 6px; padding: clamp(22px, 3vw, 36px);
  box-shadow: 0 1px 0 var(--line), 0 22px 50px rgba(8,45,43,.14);
  transform: rotate(-1.2deg); transition: transform .5s cubic-bezier(.2,.8,.2,1);
  min-height: 420px; outline: none;
}
.aispec-paper.filled { transform: none; }
.paper-tag { display: inline-block; font: 600 14px var(--font-head); background: var(--lemon); padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.paper-empty p { color: var(--slate); margin-top: 22px; }
.ghost-line { height: 12px; border-radius: 6px; background: #edf3f2; margin: 12px 0; }
.ghost-line.w70 { width: 70%; height: 20px; } .ghost-line.w90 { width: 90%; } .ghost-line.w55 { width: 55%; }
.ghost-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 26px; }
.ghost-steps i { height: 54px; border-radius: 12px; border: 2px dashed #cfe0dc; }
.aispec-paper.loading .ghost-line, .aispec-paper.loading .ghost-steps i { animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: .45; } }

.spec-out h3 { font-size: clamp(22px, 2.4vw, 30px); margin-bottom: 10px; }
.spec-out h4 { font: 600 15px var(--font-head); color: var(--teal-700); margin: 20px 0 6px; }
.spec-out p { margin: 0; }
.spec-out ul { margin: 0; padding-inline-start: 20px; }
.spec-out li { margin: 4px 0; }
.spec-out .systems { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-out .systems span { background: var(--teal-100); color: var(--teal-900); border-radius: 999px; padding: 3px 12px; font-size: 14px; }
.spec-out ol.phases { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; counter-reset: ph; }
.spec-out ol.phases li { counter-increment: ph; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; margin: 0; }
.spec-out ol.phases li::before { content: counter(ph); width: 30px; height: 30px; border-radius: 50%; background: var(--teal-900); color: #fff; display: grid; place-items: center; font: 600 15px var(--font-head); }
.spec-out ol.phases b { display: block; }
.spec-out .note { margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: #fff6cc; font-size: 15px; }
.spec-out .btn-row { margin-top: 18px; }
.spec-out .fit-unclear { color: var(--slate); }

/* ---------- chat launcher ---------- */
.kai-launch {
  position: fixed; z-index: 46; inset-inline-start: 18px; bottom: 90px;
  display: flex; align-items: center; gap: 10px; border: 0; cursor: pointer; padding: 0;
  background: none; font: 600 15px var(--font-body); color: var(--ink);
}
.kai-orb {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #b9fbe9, var(--mint) 45%, var(--teal-700));
  box-shadow: 0 0 0 6px rgba(63,216,182,.22), 0 10px 24px rgba(19,32,43,.25);
  display: grid; place-items: center;
}
.kai-orb svg { width: 26px; height: 26px; fill: none; stroke: var(--teal-950); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kai-label { background: #fff; border-radius: 999px; padding: 8px 14px; box-shadow: 0 6px 18px rgba(19,32,43,.16); white-space: nowrap; }
.kai-launch[aria-expanded=true] .kai-label { display: none; }
@media (max-width: 600px) { .kai-label { display: none; } }

/* ---------- chat panel ---------- */
.kai-panel {
  position: fixed; z-index: 60; inset-inline-start: 18px; bottom: 160px;
  width: min(380px, calc(100vw - 36px)); height: min(620px, calc(100vh - 190px));
  background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(8,45,43,.3);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; transition: opacity .25s, transform .25s;
}
.kai-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.kai-head { background: var(--teal-900); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.kai-head .kai-orb { width: 36px; height: 36px; box-shadow: none; }
.kai-head .kai-orb svg { width: 18px; height: 18px; }
.kai-head b { display: block; font: 600 17px var(--font-head); }
.kai-head small { color: #a9cfc8; font-size: 12.5px; }
.kai-x { margin-inline-start: auto; background: none; border: 0; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.kai-x:hover { background: rgba(255,255,255,.12); }
.kai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f6faf9; }
.kai-msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.kai-msg.bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-start-start-radius: 4px; }
.kai-msg.me { background: var(--teal-700); color: #fff; align-self: flex-end; border-start-end-radius: 4px; }
.kai-msg.typing { color: var(--slate); }
.kai-msg.typing i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 2px; animation: kaiDot 1s infinite; }
.kai-msg.typing i:nth-child(2) { animation-delay: .15s; } .kai-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes kaiDot { 50% { opacity: .2; } }
.kai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; background: #f6faf9; }
.kai-chips button { border: 1.5px solid var(--teal-700); color: var(--teal-900); background: #fff; border-radius: 999px; padding: 5px 12px; font: 14px var(--font-body); cursor: pointer; }
.kai-chips button:hover { background: var(--teal-100); }
.kai-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.kai-form textarea { min-height: 44px; max-height: 120px; resize: none; padding: 10px 12px; font-size: 15px; border-radius: 12px; }
.kai-form button { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--lemon); cursor: pointer; display: grid; place-items: center; }
.kai-form button:disabled { opacity: .5; cursor: default; }
.kai-form svg { width: 20px; height: 20px; fill: var(--ink); transform: scaleX(-1); }
.kai-foot { font-size: 11.5px; color: var(--slate); padding: 0 12px 8px; background: #fff; }
.kai-foot a { color: inherit; }

@media (max-width: 860px) {
  .aispec-grid { grid-template-columns: minmax(0, 1fr); }
  .aispec-paper { position: static; transform: none; min-height: 0; }
}
@media (max-width: 600px) {
  .kai-panel { inset-inline: 10px; width: auto; bottom: 10px; height: calc(100dvh - 20px); }
}
@media (prefers-reduced-motion: reduce) {
  .aispec-paper, .kai-panel { transition: none; }
  .kai-msg.typing i, .aispec-paper.loading * { animation: none; }
}

/* ---------- nav link + back to top ---------- */
.head-links .spec-link { font-weight: 600; text-decoration: none; background: var(--lemon); color: var(--ink); border-radius: 999px; padding: 6px 14px; }
.head-links .spec-link:hover { background: var(--lemon-deep); text-decoration: none; }
@media (max-width: 980px) { .head-links .spec-link { display: inline-block !important; padding: 6px 12px; font-size: 14px; } }
.to-top {
  position: fixed; z-index: 44; inset-inline-start: 24px; bottom: 90px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ink); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(19,32,43,.25);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .25s, transform .25s;
}
.to-top[hidden] { display: grid; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.to-top:hover { background: var(--teal-700); }
body.has-kai .to-top { bottom: 162px; }
body.kai-open .to-top { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }

/* ---------- menu chat ---------- */
.kai-chips { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px; padding: 4px 16px 12px; max-height: 58%; overflow-y: auto; flex: none; }
.kai-chips button { text-align: start; border-radius: 12px; padding: 6px 12px; font-size: 14px; }
.kai-chips button.alt { border-style: dashed; border-color: #9fbdb7; color: var(--slate); }
.kai-form[hidden] { display: none; }
.kai-lead { display: grid; gap: 8px; }
.kai-lead input[type=text], .kai-lead input[type=tel] { min-height: 42px; padding: 8px 12px; font-size: 15px; }
.kai-lead .consent { margin: 0; font-size: 12.5px; }
.kai-chips .kai-lead .btn { min-height: 42px; font-size: 15px; background: var(--lemon); border: 0; color: var(--ink); text-align: center; font-weight: 600; }
.kai-chips .kai-lead .btn:hover { background: var(--lemon-deep); }
.kai-lead .err { margin: 0; }
