.iga-chat {
  --iga-blue: #173f70;
  --iga-orange: #ed9652;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #fff;
  line-height: 1.4;
}
.iga-chat *, .iga-chat *::before, .iga-chat *::after { box-sizing: border-box; }
.iga-chat .iga-chat__panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(480px, calc(100dvh - 110px));
  margin-bottom: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 48px rgba(14, 35, 62, .24);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}
.iga-chat .iga-chat__panel[hidden] { display: none; }
.iga-chat[data-open="true"] .iga-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.iga-chat .iga-chat__header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 78px;
  padding: 15px 17px;
  background: var(--iga-blue);
  color: #fff;
}
.iga-chat__avatar {
  display: grid;
  flex: 0 0 41px;
  width: 41px;
  height: 41px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  font-size: 23px;
  font-weight: 700;
}
.iga-chat__identity { min-width: 0; flex: 1; }
.iga-chat__identity strong, .iga-chat__identity small { display: block; color: #fff; }
.iga-chat__identity strong { font-size: 15px; font-weight: 700; }
.iga-chat__identity small { margin-top: 3px; font-size: 13px; line-height: 1.4; }
.iga-chat__status { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #94dfb0; }
.iga-chat .iga-chat__close {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  box-shadow: none;
  color: #fff;
  font: 24px/1 Arial, sans-serif;
  cursor: pointer;
}
.iga-chat .iga-chat__close:hover { background: rgba(255,255,255,.24); color: #fff; }
.iga-chat .iga-chat__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  background: #f5f7fb;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.iga-chat .iga-chat__message {
  align-self: flex-start;
  max-width: 88%;
  padding: 11px 14px;
  border: 1px solid #e7ebf1;
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(18, 43, 74, .04);
  color: #233348;
  line-height: 1.5;
}
.iga-chat .iga-chat__message--user {
  align-self: flex-end;
  border-color: var(--iga-blue);
  border-radius: 15px 15px 4px 15px;
  background: var(--iga-blue);
  color: #fff;
}
.iga-chat .iga-chat__message--bot a {
  color: #155eab;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.iga-chat .iga-chat__message--bot a:hover { color: #0e477f; }
.iga-chat .iga-chat__form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border-top: 1px solid #ebeff4;
  background: #fff;
}
.iga-chat .iga-chat__form input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid #d6dfea;
  border-radius: 12px;
  outline: none;
  background: #fff;
  box-shadow: none;
  color: #233348;
  font: inherit;
}
.iga-chat .iga-chat__form input::placeholder { color: #596878; opacity: 1; }
.iga-chat .iga-chat__form input:focus { border-color: var(--iga-blue); box-shadow: none; }
/* Mantener el campo consistente aunque el tema imponga estilos de formulario. */
#iga-web-chat .iga-chat__form #iga-chat-input { border-radius: 12px !important; font-size: 16px !important; }
.iga-chat .iga-chat__form button {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #244e76;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
}
.iga-chat .iga-chat__form button:hover { background: #34699a; color: #fff; }
.iga-chat .iga-chat__form button:disabled { opacity: .55; cursor: wait; }
.iga-chat .iga-chat__form button svg, .iga-chat .iga-chat__toggle svg { display: block; width: 19px; height: 19px; }
.iga-chat .iga-chat__toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  min-height: 48px;
  margin: 0 0 0 auto;
  padding: 11px 18px;
  border: 0;
  border-radius: 100px;
  background: var(--iga-blue);
  box-shadow: 0 5px 18px rgba(14,35,62,.22);
  color: #fff;
  font: 700 14px/1.3 Arial, Helvetica, sans-serif;
  cursor: pointer;
}
.iga-chat .iga-chat__toggle:hover { background: #245c93; color: #fff; transform: translateY(-1px); }
.iga-chat .iga-chat__close:focus-visible, .iga-chat .iga-chat__toggle:focus-visible, .iga-chat .iga-chat__form button:focus-visible { outline: 2px solid #a9d1f1; outline-offset: 2px; }
.iga-chat .iga-chat__messages { background: #f5f7fb; color: #233348; }
.iga-chat .iga-chat__header, .iga-chat .iga-chat__message--user, .iga-chat .iga-chat__close, .iga-chat .iga-chat__form button, .iga-chat .iga-chat__toggle { color: #fff; }
.iga-chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 767px) {
  .iga-chat { right: 12px; bottom: 12px; }
  html.iga-chat-mobile-open, body.iga-chat-mobile-open { overflow: hidden; }
  .iga-chat:is([data-open="true"], [data-closing="true"]) {
    top: var(--iga-chat-view-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100vw;
    height: var(--iga-chat-view-height, 100dvh);
  }
  .iga-chat:is([data-open="true"], [data-closing="true"]) .iga-chat__panel {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .iga-chat:is([data-open="true"], [data-closing="true"]) .iga-chat__toggle { display: none; }
  .iga-chat .iga-chat__header { min-height: 75px; padding-top: calc(15px + env(safe-area-inset-top)); }
  .iga-chat .iga-chat__form { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .iga-chat .iga-chat__panel, .iga-chat .iga-chat__toggle { transition: none; }
}

/* Diseño visual: especificidad acotada al widget frente a Elementor/el tema.
   Manrope utiliza la fuente ya cargada por el sitio de IGA. */
#iga-web-chat { font-family: 'Manrope', sans-serif; }
#iga-web-chat .iga-chat__panel { border: 0; background: #f6f8fb; }
#iga-web-chat .iga-chat__header {
  background: #e7eef6;
  color: #173f70;
  min-height: 84px;
  padding: 18px 20px;
  border-bottom: 1px solid #d7e2ee;
  gap: 12px;
}
#iga-web-chat .iga-chat__avatar {
  border: 0;
  background: #fff url('logo_chat.jpeg') center / contain no-repeat;
  color: transparent;
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: 0;
  overflow: hidden;
}
#iga-web-chat .iga-chat__identity strong { color: #173f70; font-family: 'Manrope', sans-serif; font-size: 16px; font-weight: 700; }
#iga-web-chat .iga-chat__identity small { color: #617185; font-family: 'Manrope', sans-serif; font-size: 13px; opacity: 1; line-height: 1.4; letter-spacing: normal; }
#iga-web-chat .iga-chat__status { display: none; }
#iga-web-chat .iga-chat__close { background: rgba(23,63,112,.07); color: #526b87; font-size: 22px; }
#iga-web-chat .iga-chat__close:hover { background: rgba(23,63,112,.13); color: #173f70; }
#iga-web-chat .iga-chat__messages {
  background: #f6f8fb;
  padding: 22px 20px;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #b0c1d4 transparent;
}
#iga-web-chat .iga-chat__messages::-webkit-scrollbar { width: 6px; }
#iga-web-chat .iga-chat__messages::-webkit-scrollbar-track { background: transparent; }
#iga-web-chat .iga-chat__messages::-webkit-scrollbar-thumb { background: #b0c1d4; border-radius: 20px; }
#iga-web-chat .iga-chat__messages::-webkit-scrollbar-thumb:hover { background: #819bb7; }
#iga-web-chat .iga-chat__message {
  background: #fff;
  border: 0;
  box-shadow: none;
  border-radius: 16px 16px 16px 5px;
  padding: 12px 15px;
  color: #334155;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.6;
}
#iga-web-chat .iga-chat__message--user { background: #173f70; color: #fff; border-radius: 16px 16px 5px 16px; }
#iga-web-chat .iga-chat__form {
  margin: 0 16px 16px;
  padding: 5px 6px 5px 12px;
  border: 1px solid #dce5ef;
  border-radius: 18px;
  background: #edf2f7;
  gap: 6px;
}
#iga-web-chat .iga-chat__form:focus-within { border-color: #8ba8c6; }
#iga-web-chat .iga-chat__form #iga-chat-input {
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 16px !important;
  font-weight: 400;
  letter-spacing: normal;
  height: 44px;
  padding: 8px 4px;
  color: #293e54;
}
#iga-web-chat .iga-chat__form #iga-chat-input::placeholder { color: #748296; }
#iga-web-chat .iga-chat__form button {
  background: #173f70;
  border-radius: 13px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  flex-basis: 40px;
  box-shadow: none;
}
#iga-web-chat .iga-chat__form button:hover { background: #245c93; }
#iga-web-chat .iga-chat__toggle { font-family: 'Manrope', sans-serif; }
#iga-web-chat .iga-chat__toggle,
#iga-web-chat .iga-chat__toggle:hover,
#iga-web-chat .iga-chat__toggle:focus,
#iga-web-chat .iga-chat__toggle:focus-visible,
#iga-web-chat .iga-chat__toggle:active { background: #173f70 !important; color: #fff !important; }
#iga-web-chat .iga-chat__toggle span, #iga-web-chat .iga-chat__toggle svg { color: inherit !important; }
@media (min-width: 768px) {
  #iga-web-chat .iga-chat__panel { box-shadow: 0 18px 55px rgba(10,27,48,.30), 0 4px 14px rgba(10,27,48,.16); }
}
@media (max-width: 767px) {
  #iga-web-chat .iga-chat__header { padding-top: calc(18px + env(safe-area-inset-top)); }
  #iga-web-chat .iga-chat__form { margin-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
