/* Erfolg Assistant widget. Colours come from the active theme's variables (light gallery or
   Mercury dark), with safe fallbacks if the theme changes. Everything is position:fixed, so the
   widget never shifts the page layout. */
.ea-launcher, .ea-panel {
  --ea-accent: var(--ep-cobalt, #0071e3);
  --ea-accent-hover: var(--ep-cobalt-hover, #0077ed);
  --ea-bg: var(--ep-card, #ffffff);
  --ea-soft: var(--ep-canvas, #f5f5f7);
  --ea-raised: var(--ep-raised, #e8e8ed);
  --ea-text: var(--ep-ivory, #1d1d1f);
  --ea-muted: var(--ep-ash, #6e6e73);
  --ea-line: var(--ep-hair-2, rgba(0, 0, 0, .14));
  --ea-font: var(--ep-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif);
  --ea-gap: calc(var(--ep-mobilebar-h, 0px) + 24px + env(safe-area-inset-bottom, 0px));
  font-family: var(--ea-font);
  box-sizing: border-box;
}
.ea-launcher *, .ea-panel * { box-sizing: border-box; }
.ea-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- launcher ---------- */
.ea-launcher {
  position: fixed; right: 24px; bottom: var(--ea-gap); z-index: 9990;
  display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px;
  background: var(--ea-accent); color: #fff; cursor: pointer;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  transition: background-color .2s, transform .2s;
}
.ea-launcher:hover { background: var(--ea-accent-hover); transform: translateY(-2px); }
.ea-launcher:focus-visible { outline: 3px solid var(--ea-text); outline-offset: 3px; }
.ea-is-open .ea-launcher { display: none; }
.ep-nav-open .ea-launcher { display: none; }   /* hide while the mobile menu is open */

/* ---------- panel ---------- */
.ea-panel {
  position: fixed; right: 24px; bottom: var(--ea-gap); z-index: 9991;
  width: 380px; height: min(620px, calc(100vh - var(--ea-gap) - 90px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ea-bg); color: var(--ea-text);
  border: 1px solid var(--ea-line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  font-size: 15px; line-height: 1.45;
}
.ea-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .ea-panel:not([hidden]) { animation: ea-in .22s ease-out; }
  @keyframes ea-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
}

.ea-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 20px; background: var(--ea-accent); color: #fff; }
.ea-title { margin: 0; font-size: 17px; font-weight: 600; color: #fff; letter-spacing: -.01em; font-family: var(--ea-font); line-height: 1.2; }
.ea-sub { margin: 2px 0 0; font-size: 13px; opacity: .85; }
.ea-close { flex-shrink: 0; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; }
.ea-close:hover { background: rgba(255, 255, 255, .26); }
.ea-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ea-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--ea-soft); overscroll-behavior: contain; }
.ea-log:focus-visible { outline: 2px solid var(--ea-accent); outline-offset: -2px; }
.ea-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; word-wrap: break-word; }
.ea-msg p { margin: 0 0 6px; }
.ea-msg p:last-child { margin-bottom: 0; }
.ea-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.ea-msg li { margin: 2px 0; }
.ea-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ea-msg--assistant { align-self: flex-start; background: var(--ea-bg); color: var(--ea-text); border: 1px solid var(--ea-line); border-bottom-left-radius: 6px; }
.ea-msg--user { align-self: flex-end; background: var(--ea-accent); color: #fff; border-bottom-right-radius: 6px; }
.ea-msg--error { border-color: #d70015; }

.ea-typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.ea-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ea-muted); opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .ea-dot { animation: ea-blink 1.2s infinite ease-in-out; }
  .ea-dot:nth-child(3) { animation-delay: .15s; }
  .ea-dot:nth-child(4) { animation-delay: .3s; }
  @keyframes ea-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
}

.ea-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; background: var(--ea-soft); }
.ea-quick[hidden] { display: none; }
.ea-chip {
  min-height: 36px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ea-accent); background: transparent; color: var(--ea-accent);
  font: inherit; font-size: 14px; font-weight: 500;
  transition: background-color .2s, color .2s;
}
.ea-chip:hover, .ea-chip:focus-visible { background: var(--ea-accent); color: #fff; outline: none; }

.ea-cta {
  display: inline-block; margin-top: 10px; min-height: 36px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ea-accent); background: transparent; color: var(--ea-accent); font: inherit; font-size: 14px; font-weight: 600;
}
.ea-cta:hover, .ea-cta:focus-visible { background: var(--ea-accent); color: #fff; outline: none; }
.ea-cta--solid { margin-top: 0; background: var(--ea-accent); color: #fff; }
.ea-cta--solid:hover { background: var(--ea-accent-hover); }
.ea-cta:disabled { opacity: .6; cursor: default; }
.ea-link { border: 0; background: none; color: var(--ea-muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px; }

.ea-status:empty { display: none; }
.ea-status { margin: 0; padding: 6px 16px 0; font-size: 13px; color: var(--ea-muted); background: var(--ea-soft); }

.ea-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 8px; background: var(--ea-bg); border-top: 1px solid var(--ea-line); margin: 0; }
.ea-input {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; margin: 0;
  padding: 11px 14px; border: 1px solid var(--ea-line); border-radius: 22px;
  background: var(--ea-soft); color: var(--ea-text); font: inherit; font-size: 15px; line-height: 1.4;
}
.ea-input::placeholder { color: var(--ea-muted); }
.ea-input:focus { outline: none; border-color: var(--ea-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ea-accent) 25%, transparent); }
.ea-input:disabled { opacity: .7; }
.ea-send { flex-shrink: 0; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--ea-accent); color: #fff; cursor: pointer; }
.ea-send:hover { background: var(--ea-accent-hover); }
.ea-send:focus-visible { outline: 3px solid var(--ea-text); outline-offset: 2px; }
.ea-send:disabled { opacity: .5; cursor: default; }
.ea-disclaimer { margin: 0; padding: 0 16px 12px; font-size: 12px; color: var(--ea-muted); text-align: center; background: var(--ea-bg); }

/* ---------- callback form ---------- */
.ea-leadwrap { max-width: 100%; width: 100%; }
.ea-lead { margin: 0; }
.ea-lead__intro { font-weight: 600; margin-bottom: 10px !important; }
.ea-field { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.ea-field label { font-size: 13px; font-weight: 600; color: var(--ea-text); }
.ea-field input, .ea-field textarea {
  width: 100%; margin: 0; padding: 9px 12px; border: 1px solid var(--ea-line); border-radius: 10px;
  background: var(--ea-bg); color: var(--ea-text); font: inherit; font-size: 15px;
}
.ea-field input:focus, .ea-field textarea:focus { outline: none; border-color: var(--ea-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ea-accent) 25%, transparent); }
.ea-field [aria-invalid="true"] { border-color: #d70015; }
.ea-field--check { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.ea-field--check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--ea-accent); }
.ea-field--check label { flex: 1; font-weight: 400; font-size: 13px; line-height: 1.4; }
.ea-err { font-size: 12px; color: #d70015; width: 100%; }
.ea-err:empty { display: none; }
.ea-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ea-lead__actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ea-lead__msg { margin: 8px 0 0 !important; font-size: 13px; color: #d70015; }
.ea-lead__msg:empty { display: none; }

/* ---------- phones: full screen panel, launcher above the Call/WhatsApp bar ---------- */
@media (max-width: 767px) {
  .ea-launcher { right: 16px; width: 56px; padding: 0; justify-content: center; }
  .ea-launcher__label { display: none; }
  .ea-panel { inset: 0; width: auto; height: auto; height: 100dvh; border-radius: 0; border: 0; z-index: 10000; }
  .ea-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .ea-disclaimer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .ea-input, .ea-field input, .ea-field textarea { font-size: 16px; }   /* stops iOS zooming in */
}
@media (prefers-reduced-motion: reduce) {
  .ea-launcher, .ea-chip, .ea-cta { transition: none; }
  .ea-launcher:hover { transform: none; }
}
