/* Ertheo Eva Chat Widget */
/* Brand: Teal #115E67 · Gold #B3A369 */

:root {
  --eva-teal: #115E67;
  --eva-teal-dk: #0d4a52;
  --eva-teal-lt: #1a7a86;
  --eva-gold: #B3A369;
  --eva-gold-lt: #c9b97d;
  --eva-bg: #f0f0f0;
  --eva-white: #fff;
  --eva-text: #1a1a1a;
  --eva-muted: #666;
  --eva-border: #e0e0e0;
  --eva-shadow: 0 8px 32px rgba(17,94,103,.18);
  --eva-radius: 16px;
}

/* ── Launcher ────────────────────────────────────────────────── */

/* Positioned above the back-to-top button (60px @ right:40px bottom:40px) */
#eva-launcher {
  position: fixed;
  bottom: 112px;
  right: 40px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
}

#eva-launcher:hover { transform: scale(1.12); }

#eva-launcher svg { width: 54px; height: 54px; fill: var(--eva-gold); transition: fill .2s; }
#eva-launcher:hover svg { fill: var(--eva-gold-lt); }

/* Close icon: white on teal circle */
#eva-launcher.open { background: var(--eva-teal); box-shadow: var(--eva-shadow); border-radius: 50%; }
#eva-launcher.open svg { width: 28px; height: 28px; fill: var(--eva-white); }
#eva-launcher .eva-ic-close { display: none; }
#eva-launcher.open .eva-ic-chat  { display: none; }
#eva-launcher.open .eva-ic-close { display: block; }

/* ── Widget ──────────────────────────────────────────────────── */

#eva-widget {
  position: fixed;
  bottom: 184px;
  right: 40px;
  z-index: 9999;
  width: 370px;
  height: min(560px, calc(100dvh - 200px));
  background: var(--eva-white);
  border-radius: var(--eva-radius);
  box-shadow: var(--eva-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

#eva-widget.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────────── */

#eva-header {
  background: var(--eva-teal);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#eva-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--eva-teal-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#eva-avatar svg { width: 20px; height: 20px; fill: var(--eva-white); }

#eva-hdr-info { flex: 1; }
#eva-hdr-info h3 { margin: 0; color: var(--eva-white); font-size: 14px; font-weight: 700; }
#eva-hdr-info p  { margin: 2px 0 0; color: rgba(255,255,255,.7); font-size: 11px; font-weight: 500; }

#eva-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(74,222,128,.6);
}

/* ── Messages ────────────────────────────────────────────────── */

#eva-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--eva-bg);
  min-height: 0;
}
#eva-msgs::-webkit-scrollbar       { width: 4px; }
#eva-msgs::-webkit-scrollbar-track { background: transparent; }
#eva-msgs::-webkit-scrollbar-thumb { background: var(--eva-border); border-radius: 2px; }

.eva-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: evaIn .2s ease;
}
@keyframes evaIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.eva-msg.bot {
  background: var(--eva-white);
  color: var(--eva-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.eva-msg.user {
  background: var(--eva-teal);
  color: var(--eva-white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.eva-msg a       { color: var(--eva-gold); text-decoration: underline; }
.eva-msg.bot a   { color: var(--eva-teal); }
.eva-msg ul      { margin: 6px 0 0; padding-left: 18px; }
.eva-msg li      { margin-bottom: 4px; }
.eva-msg strong  { font-weight: 700; }

/* ── Typing indicator ────────────────────────────────────────── */

.eva-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--eva-white);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.eva-typing span {
  width: 7px; height: 7px;
  background: var(--eva-teal-lt);
  border-radius: 50%;
  animation: evaTyp 1.2s infinite;
}
.eva-typing span:nth-child(2) { animation-delay: .2s; }
.eva-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes evaTyp { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* ── Input bar ───────────────────────────────────────────────── */

#eva-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--eva-white);
  border-top: 1px solid var(--eva-border);
  flex-shrink: 0;
}

#eva-input {
  flex: 1;
  border: 1.5px solid var(--eva-border);
  border-radius: 22px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--eva-text);
  background: var(--eva-bg);
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 80px;
  transition: border-color .2s;
}
#eva-input:focus { border-color: var(--eva-teal); background: var(--eva-white); }
#eva-input::placeholder { color: var(--eva-muted); }

#eva-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--eva-teal);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}
#eva-send:hover { background: var(--eva-teal-dk); transform: scale(1.05); }
#eva-send svg { fill: var(--eva-white); width: 16px; height: 16px; }


/* ── Responsive — Bricks breakpoints ─────────────────────────── */

/* Tablet ≤ 991px */
@media (max-width: 991px) {
  #eva-widget { height: 500px; max-height: 500px; }
}

/* Mobile landscape ≤ 767px */
@media (max-width: 767px) {
  #eva-widget {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 86px;
    height: 80dvh;
    max-height: 80dvh;
  }
  #eva-launcher { bottom: 16px; right: 16px; }
}

/* Mobile portrait ≤ 480px */
@media (max-width: 480px) {
  #eva-widget {
    height: calc(100dvh - 100px);
    max-height: calc(100dvh - 100px);
  }
  #eva-launcher { width: 50px; height: 50px; }
  #eva-launcher svg { width: 24px; height: 24px; }
}
