/* ---------------------------------------------
   צ'אט האתר — באותה שפה חזותית של "לפנות בוקר".
   --------------------------------------------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

button.agent-launcher { padding: 0; cursor: pointer; font: inherit; }
.agent-launcher[aria-expanded="true"]::after { animation: none; }
.agent-launcher:focus-visible { outline: 2px solid var(--dawn); outline-offset: 3px; }

.faq-chat {
  margin-top: 1.5rem;
  color: var(--ivory-dim);
  font-size: 0.98rem;
}

.faq-chat-btn {
  margin-inline-start: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dawn);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
  min-height: 44px;
}
.faq-chat-btn:hover { color: var(--dawn-bright); }

.chat-panel {
  position: fixed;
  z-index: 60;
  left: 1.25rem;
  bottom: 6.5rem;
  width: min(24rem, calc(100vw - 2.5rem));
  height: min(36rem, calc(100dvh - 8.5rem));
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--dawn) 28%, var(--seam));
  border-radius: 1.25rem;
  background: var(--night-soft);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  font-size: 15px;
  line-height: 1.6;
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--seam);
  background: var(--night-lift);
}
.chat-head-glyph { height: 1.6rem; width: auto; flex: none; }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-size: 1.15rem; font-weight: 400; color: var(--ivory); }
.chat-sub { font-size: 0.8rem; color: var(--dusk); }

.chat-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ivory-dim);
  cursor: pointer;
}
.chat-close:hover, .chat-close:focus-visible { background: var(--night-soft); color: var(--ivory); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--seam) transparent;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chat-msg {
  max-width: 88%;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  overflow-wrap: anywhere;
}
.chat-msg p + p, .chat-msg p + ul, .chat-msg ul + p { margin-top: 0.4rem; }
.chat-msg ul { margin: 0.25rem 0 0; padding-inline-start: 1.1rem; }
.chat-msg strong { font-weight: 600; color: var(--ivory); }

.chat-msg--bot {
  align-self: flex-start;
  background: var(--night-lift);
  color: var(--ivory);
  border-start-start-radius: 0.3rem;
}
.chat-msg--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--dawn) 85%, var(--night));
  color: var(--night);
  border-start-end-radius: 0.3rem;
}

.chat-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chat-chip {
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--dawn) 45%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--dawn-bright);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.chat-chip:hover:not(:disabled) { background: color-mix(in srgb, var(--dawn) 14%, transparent); }
.chat-chip:disabled { opacity: 0.5; cursor: default; }

.chat-wait {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 1rem;
  background: var(--night-lift);
  color: var(--ivory-dim);
  font-size: 0.9rem;
}
.chat-wait-meta { color: var(--dusk); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.chat-job-id { font-family: ui-monospace, Consolas, monospace; }
.chat-wait-dots { display: inline-flex; gap: 3px; }
.chat-wait-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dawn);
  animation: chat-dot 1.2s ease-in-out infinite;
}
.chat-wait-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-wait-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-wait-dots i { animation: none; opacity: 0.7; }
}

.chat-error {
  align-self: stretch;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--ember) 55%, transparent);
  background: color-mix(in srgb, var(--ember) 14%, var(--night-soft));
  color: var(--ivory);
}
.chat-error b { display: block; color: #f0a58c; }
.chat-error p { color: var(--ivory-dim); font-size: 0.9rem; margin-top: 0.15rem; }
.chat-retry {
  margin-top: 0.6rem;
  min-height: 44px;
  padding: 0.4rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--dawn);
  color: var(--night);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chat-form {
  padding: 0.75rem 1rem 0.85rem;
  border-top: 1px solid var(--seam);
  background: var(--night-soft);
}
.chat-input-row { display: flex; align-items: flex-end; gap: 0.5rem; }
#chat-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 7.5rem;
  resize: none;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--seam);
  border-radius: 1rem;
  background: var(--night);
  color: var(--ivory);
  font: inherit;
  font-size: 16px; /* מתחת ל-16px iOS מגדיל את המסך */
  line-height: 1.45;
  field-sizing: content;
}
#chat-input::placeholder { color: var(--dusk); }
#chat-input:focus { outline: none; border-color: color-mix(in srgb, var(--dawn) 60%, transparent); }

.chat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--dawn);
  color: var(--night);
  cursor: pointer;
}
.chat-send:hover:not(:disabled) { background: var(--dawn-bright); }
.chat-send:disabled { opacity: 0.45; cursor: default; }

.chat-form-error { margin-top: 0.4rem; color: #f0a58c; font-size: 0.85rem; }
.chat-foot { margin-top: 0.5rem; color: var(--dusk); font-size: 0.75rem; line-height: 1.5; }
.chat-foot a { color: var(--ivory-dim); text-decoration: underline; text-underline-offset: 0.2em; }

@media (max-width: 640px) {
  .chat-panel {
    left: 16px;
    right: 16px;
    bottom: 5rem;
    width: auto;
    height: min(34rem, calc(100dvh - 6.5rem));
  }
}
