/* ERE chat widget — self-hosted (mirrors the Gorgias look: teal #00696b, Inter) */
:root { --ere-teal:#00696b; --ere-teal-d:#00514f; --ere-bg:#f4f6f6; --ere-ink:#1a2b2b; }

#ere-chat *, #ere-chat *::before, #ere-chat *::after { box-sizing:border-box; }
#ere-chat {
  position:fixed; bottom:20px; right:20px; z-index:2147483000;
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}

/* Launcher bubble */
#ere-launcher {
  width:60px; height:60px; border-radius:50%; background:var(--ere-teal);
  border:none; cursor:pointer; box-shadow:0 6px 20px rgba(0,0,0,.25);
  display:flex; align-items:center; justify-content:center; transition:transform .15s, background .15s;
}
#ere-launcher:hover { background:var(--ere-teal-d); transform:scale(1.05); }
#ere-launcher svg { width:28px; height:28px; fill:#fff; }

/* Panel */
#ere-panel {
  position:absolute; bottom:76px; right:0; width:380px; max-width:calc(100vw - 40px);
  height:560px; max-height:calc(100vh - 110px); background:#fff; border-radius:16px;
  box-shadow:0 12px 48px rgba(0,0,0,.28); display:none; flex-direction:column; overflow:hidden;
}
#ere-chat.open #ere-panel { display:flex; }
#ere-chat.open #ere-launcher { display:none; }

#ere-header {
  background:var(--ere-teal); color:#fff; padding:16px 18px; display:flex; align-items:center; gap:12px;
}
#ere-header .ava { width:38px; height:38px; border-radius:50%; background:#fff; flex:0 0 auto;
  display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--ere-teal); }
#ere-header .meta { flex:1; line-height:1.2; }
#ere-header .meta b { font-size:15px; }
#ere-header .meta span { font-size:12px; opacity:.85; display:flex; align-items:center; gap:5px; }
#ere-header .meta span::before { content:''; width:7px; height:7px; border-radius:50%; background:#7CFC9A; }
#ere-close { background:none; border:none; color:#fff; cursor:pointer; font-size:22px; opacity:.85; line-height:1; }
#ere-close:hover { opacity:1; }

#ere-body { flex:1; overflow-y:auto; padding:16px; background:var(--ere-bg); }
.ere-msg { max-width:82%; padding:10px 13px; border-radius:14px; margin-bottom:10px; font-size:14px; line-height:1.45; word-wrap:break-word; }
.ere-msg.bot  { background:#fff; color:var(--ere-ink); border:1px solid #e3e8e8; border-bottom-left-radius:4px; margin-right:auto; }
.ere-msg.user { background:var(--ere-teal); color:#fff; border-bottom-right-radius:4px; margin-left:auto; }
.ere-msg.bot a { color:var(--ere-teal); font-weight:600; }
.ere-msg.bot table { border-collapse:collapse; width:100%; margin:6px 0; font-size:13px; }
.ere-msg.bot th, .ere-msg.bot td { border:1px solid #d5dcdc; padding:4px 7px; text-align:left; }
.ere-msg.bot h1,.ere-msg.bot h2,.ere-msg.bot h3 { font-size:14px; margin:8px 0 4px; }
.ere-msg.bot p { margin:4px 0; }
.ere-msg.bot ul { margin:4px 0 4px 18px; padding:0; }
/* Quick-reply chips (shown under the greeting) */
.ere-quick { display:flex; flex-wrap:wrap; gap:8px; margin:2px 0 12px; }
.ere-chip {
  font-family:inherit; font-size:13px; font-weight:600; color:var(--ere-teal);
  background:#fff; border:1.5px solid var(--ere-teal); border-radius:18px;
  padding:8px 14px; cursor:pointer; line-height:1.2;
  transition:background .15s, color .15s;
}
.ere-chip:hover { background:var(--ere-teal); color:#fff; }
.ere-chip:active { transform:scale(.97); }

/* Inline lead form (quote / contact capture) */
.ere-leadform { display:flex; flex-direction:column; gap:8px; margin:2px 0 12px; max-width:100%; }
.ere-fld {
  font-family:inherit; font-size:16px; color:var(--ere-ink); width:100%;
  border:1px solid #cdd6d6; border-radius:10px; padding:11px 12px; background:#fff;
}
.ere-fld::placeholder { color:#9bb0b0; }
.ere-fld:focus { outline:none; border-color:var(--ere-teal); }
textarea.ere-fld { resize:vertical; min-height:48px; }
.ere-form-btn {
  font-family:inherit; font-size:15px; font-weight:700; color:#fff; background:var(--ere-teal);
  border:none; border-radius:10px; padding:12px; cursor:pointer; margin-top:2px;
}
.ere-form-btn:hover { background:var(--ere-teal-d); }
.ere-form-btn:disabled { opacity:.6; cursor:default; }
.ere-form-err { color:#c0392b; font-size:12px; line-height:1.3; }

.ere-typing { display:inline-flex; gap:4px; padding:12px 14px; }
.ere-typing span { width:7px; height:7px; border-radius:50%; background:#9bb0b0; animation:ere-blink 1.2s infinite; }
.ere-typing span:nth-child(2){ animation-delay:.2s; } .ere-typing span:nth-child(3){ animation-delay:.4s; }
@keyframes ere-blink { 0%,80%,100%{opacity:.3} 40%{opacity:1} }

/* Pre-chat email */
#ere-prechat { padding:18px; }
#ere-prechat p { font-size:14px; color:var(--ere-ink); margin:0 0 12px; }
#ere-prechat label { font-size:12px; font-weight:600; color:#5a6a6a; display:block; margin-bottom:5px; }
#ere-email { width:100%; padding:11px 12px; border:1px solid #cdd6d6; border-radius:9px; font-size:16px; }
#ere-email:focus { outline:none; border-color:var(--ere-teal); }
#ere-start { width:100%; margin-top:12px; padding:11px; background:var(--ere-teal); color:#fff; border:none;
  border-radius:9px; font-size:14px; font-weight:600; cursor:pointer; }
#ere-start:hover { background:var(--ere-teal-d); }
.ere-err { color:#c0392b; font-size:12px; margin-top:6px; min-height:14px; }

/* Footer input */
#ere-footer { display:none; padding:10px; border-top:1px solid #e3e8e8; gap:8px; }
#ere-chat.started #ere-footer { display:flex; }
#ere-chat.started #ere-prechat { display:none; }
#ere-input { flex:1; padding:10px 12px; border:1px solid #cdd6d6; border-radius:20px; font-size:16px; resize:none; max-height:90px; }
#ere-input:focus { outline:none; border-color:var(--ere-teal); }
#ere-send { width:40px; height:40px; flex:0 0 auto; border:none; border-radius:50%; background:var(--ere-teal); cursor:pointer;
  display:flex; align-items:center; justify-content:center; }
#ere-send:hover { background:var(--ere-teal-d); } #ere-send svg { width:18px; height:18px; fill:#fff; }
#ere-foot-note { font-size:11px; color:#9bb0b0; text-align:center; padding:0 0 8px; }

/* ── Mobile (≤480px): full-screen panel + safe-area padding ────────────────────
   Inputs are already 16px globally so iOS Safari does NOT auto-zoom on focus.
   On phones the panel fills the screen instead of a cramped 380px desktop card. */
@media (max-width: 480px) {
  #ere-panel {
    position:fixed; inset:0; width:auto; height:auto;
    max-width:none; max-height:none; border-radius:0;
  }
  #ere-footer { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
  #ere-body   { padding-bottom:calc(16px + env(safe-area-inset-bottom)); }
}
