/* Assistente de IA — Dra. Elisangela Fernandes
   Paleta alinhada a site-v9.css: --green #0f6b46, --ink #163129, --mint #eaf5ef, Manrope + Playfair */
:root {
  --ef-green: #0f6b46;
  --ef-green2: #0a5638;
  --ef-mint: #eaf5ef;
  --ef-ink: #163129;
  --ef-muted: #64746e;
  --ef-line: #dbe7e1;
  --ef-white: #fff;
  --ef-shadow: 0 20px 60px rgba(13, 64, 43, 0.18);
  --ef-radius: 20px;
  --ef-z: 99980;
}

#ef-chat-root {
  all: initial;
  font-family: Manrope, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ef-ink);
  position: fixed;
  z-index: var(--ef-z);
  inset: auto 20px 20px auto;
  width: 0;
  height: 0;
}

#ef-chat-root *, #ef-chat-root *::before, #ef-chat-root *::after {
  box-sizing: border-box;
}

.ef-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  padding: 0;
  cursor: pointer;
  background: var(--ef-green);
  box-shadow: 0 12px 28px rgba(15, 107, 70, 0.35);
  overflow: hidden;
  z-index: calc(var(--ef-z) + 2);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ef-fab:hover, .ef-fab:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 36px rgba(15, 107, 70, 0.42);
  outline: 3px solid rgba(15, 107, 70, 0.35);
  outline-offset: 2px;
}

.ef-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.ef-fab-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: var(--ef-green);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--ef-green);
  font-family: inherit;
}

.ef-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: min(400px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 120px));
  max-height: 82vh;
  background: var(--ef-white);
  border: 1px solid var(--ef-line);
  border-radius: var(--ef-radius);
  box-shadow: var(--ef-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: calc(var(--ef-z) + 1);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ef-panel[data-open="true"] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ef-header {
  background: linear-gradient(135deg, var(--ef-green) 0%, #0e7e53 70%, #175e76 100%);
  color: #fff;
  padding: 14px 14px 12px;
  display: grid;
  grid-template-columns: 48px 1fr auto 36px;
  gap: 10px;
  align-items: center;
}

.ef-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.55);
  object-fit: cover;
}

.ef-header h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.ef-header p {
  margin: 4px 0 0;
  font-size: 11px;
  opacity: 0.92;
  font-weight: 600;
}

.ef-close {
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  font-family: inherit;
}

.ef-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ef-disclaimer {
  background: #fff8e8;
  color: #5c4a1e;
  border-bottom: 1px solid #f0e0b8;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 600;
}

.ef-disclaimer strong {
  font-weight: 800;
}

.ef-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  background: #f7faf8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ef-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ef-msg[data-role="assistant"] {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ef-line);
  color: var(--ef-ink);
  border-bottom-left-radius: 4px;
}

.ef-msg[data-role="user"] {
  align-self: flex-end;
  background: var(--ef-green);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ef-msg a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.ef-msg.ef-typing {
  color: var(--ef-muted);
  font-style: italic;
}

.ef-human {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--ef-line);
  background: #fff;
}

.ef-human a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  color: var(--ef-green);
  border: 1px solid rgba(15, 107, 70, 0.22);
  background: var(--ef-mint);
  font-family: inherit;
}

.ef-human a:hover, .ef-human a:focus-visible {
  background: #dff0e7;
  outline: 2px solid rgba(15, 107, 70, 0.35);
  outline-offset: 1px;
}

.ef-form {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ef-line);
  background: #fff;
}

.ef-form label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.ef-form textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid #cfded7;
  border-radius: 14px;
  padding: 12px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ef-ink);
  background: #fff;
}

.ef-form textarea:focus-visible {
  outline: 2px solid rgba(15, 107, 70, 0.45);
  border-color: var(--ef-green);
}

.ef-send {
  border: 0;
  border-radius: 14px;
  background: var(--ef-green);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.ef-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ef-send:focus-visible {
  outline: 2px solid rgba(15, 107, 70, 0.55);
  outline-offset: 2px;
}

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

@media (max-width: 480px) {
  .ef-panel {
    right: 8px;
    left: 8px;
    bottom: 88px;
    width: auto;
    height: min(78vh, 640px);
  }
  .ef-fab {
    right: 14px;
    bottom: 14px;
  }
  .ef-human {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ef-fab, .ef-panel {
    transition: none;
  }
}

/* ---- Modo inline (página /assistente) ---- */
#ef-chat-root.ef-inline {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  display: block;
  z-index: auto;
}
#ef-chat-root.ef-inline .ef-panel {
  position: relative;
  inset: auto;
  left: auto; right: auto; bottom: auto;
  width: 100%;
  height: 100%;
  max-height: none;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  z-index: auto;
  transition: none;
}
#ef-chat-root.ef-inline .ef-close { display: none; }
#ef-chat-root.ef-inline .ef-header { grid-template-columns: 48px 1fr auto; }

/* ---- Oferta de material e formulário de contato ---- */
.ef-offer, .ef-lead {
  flex-shrink: 0;
  align-self: stretch;
  background: #fff;
  border: 1px solid var(--ef-line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ef-ink);
  font-family: inherit;
}
.ef-offer span { display: block; margin-bottom: 8px; }
.ef-offer-actions, .ef-lead-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ef-offer button, .ef-lead button {
  font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
  border-radius: 999px; padding: 8px 14px; border: 1px solid var(--ef-green);
}
.ef-offer-yes, .ef-lead-submit { background: var(--ef-green); color: #fff; }
.ef-offer-no, .ef-lead-cancel { background: #fff; color: var(--ef-green); }
.ef-lead-submit:disabled { opacity: .6; cursor: wait; }
.ef-lead { display: flex; flex-direction: column; gap: 8px; }
.ef-lead-title { font-size: 14px; color: var(--ef-green); }
.ef-lead-hint { margin: 0; font-size: 12px; color: var(--ef-muted); }
.ef-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; }
.ef-field input, .ef-field textarea {
  font-family: inherit; font-size: 14px; font-weight: 400; color: var(--ef-ink);
  border: 1px solid var(--ef-line); border-radius: 10px; padding: 8px 10px; background: #fbfdfc; width: 100%;
}
.ef-field input:focus-visible, .ef-field textarea:focus-visible { outline: 2px solid rgba(15,107,70,.35); border-color: var(--ef-green); }
.ef-checks { border: 1px solid var(--ef-line); border-radius: 10px; margin: 0; padding: 6px 10px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.ef-checks legend { font-size: 12px; font-weight: 700; padding: 0 4px; }
.ef-check { font-size: 12px; display: flex; gap: 6px; align-items: flex-start; }
.ef-check input { margin-top: 2px; accent-color: var(--ef-green); }
.ef-consent { font-size: 11.5px; color: #3c5a52; }
.ef-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ef-lead-status { margin: 0; font-size: 12px; min-height: 1em; color: var(--ef-muted); }
.ef-lead-status.ef-err { color: #a3302a; }
.ef-lead-done a { font-weight: 800; color: var(--ef-green); }
@media (max-width: 480px) { .ef-checks { grid-template-columns: 1fr; } }

/* ---- Botão Nova conversa ---- */
.ef-new {
  border: 1px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.ef-new:hover, .ef-new:focus-visible { background: rgba(255,255,255,0.24); outline: 2px solid #fff; outline-offset: 1px; }
@media (max-width: 380px) { .ef-new { padding: 5px 8px; font-size: 10px; } }
