/* Chat web KZ: burbuja discreta integrada al sitio público */

.kz-chat-nudge {
  position: fixed;
  right: max(17px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 60px);
  z-index: 10606;
  padding: 9px 12px;
  border: 1px solid rgba(246, 206, 31, .24);
  border-radius: 999px;
  background: rgba(8, 12, 21, .86);
  color: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.kz-chat-nudge::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: rgba(8, 12, 21, .86);
  border-right: 1px solid rgba(246, 206, 31, .18);
  border-bottom: 1px solid rgba(246, 206, 31, .18);
}

.kz-chat-nudge.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.kz-chat-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10605;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid rgba(246, 206, 31, .32);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 20%, rgba(246, 206, 31, .18), transparent 38%),
    rgba(8, 12, 21, .82);
  color: #f7d847;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease, border-color .2s ease, background .2s ease;
}

.kz-chat-launcher:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 206, 31, .58);
  background: rgba(10, 15, 27, .94);
}

.kz-chat-launcher svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.kz-chat-launcher-label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.kz-chat-widget {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 62px);
  z-index: 10620;
  width: min(380px, calc(100vw - 28px));
  height: min(610px, calc(100dvh - 98px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid rgba(246, 206, 31, .20);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(246, 206, 31, .10), transparent 34%),
    linear-gradient(180deg, rgba(11, 16, 29, .98), rgba(4, 7, 13, .98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .62);
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.kz-chat-widget.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.kz-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .025);
}

.kz-chat-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.kz-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(246, 206, 31, .95), rgba(255, 180, 20, .88));
  color: #080b10;
  font-family: "Oswald", system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -.04em;
  box-shadow: 0 10px 28px rgba(246, 206, 31, .20);
}

.kz-chat-title {
  margin: 0;
  color: #fff;
  font-family: "Oswald", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: .01em;
  text-transform: none;
}

.kz-chat-subtitle {
  margin-top: 4px;
  color: rgba(226, 232, 240, .66);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
}

.kz-chat-close {
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.kz-chat-close:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.kz-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 206, 31, .45) rgba(255, 255, 255, .06);
}

.kz-chat-message {
  display: flex;
  margin: 0 0 11px;
}

.kz-chat-message.is-user {
  justify-content: flex-end;
}

.kz-chat-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.42;
}

.kz-chat-bubble strong {
  color: #fff4a6;
  font-weight: 850;
}

.kz-chat-message.is-assistant .kz-chat-bubble {
  color: rgba(248, 250, 252, .92);
  background: rgba(255, 255, 255, .075);
  border-top-left-radius: 6px;
}

.kz-chat-message.is-user .kz-chat-bubble {
  color: #0c0f16;
  background: linear-gradient(135deg, #f6ce1f, #ffb84b);
  border-top-right-radius: 6px;
  font-weight: 650;
}

.kz-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  color: rgba(248, 250, 252, .72);
}

.kz-chat-typing-label {
  font-size: 12.5px;
  font-weight: 650;
}

.kz-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kz-chat-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(246, 206, 31, .78);
  animation: kzChatTyping 1s infinite ease-in-out;
}

.kz-chat-typing-dots i:nth-child(2) { animation-delay: .12s; }
.kz-chat-typing-dots i:nth-child(3) { animation-delay: .24s; }

@keyframes kzChatTyping {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.kz-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .025);
}

.kz-chat-input {
  width: 100%;
  min-height: 44px;
  max-height: 96px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 16px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  outline: none;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.35;
}

.kz-chat-input:focus {
  border-color: rgba(246, 206, 31, .46);
  box-shadow: 0 0 0 3px rgba(246, 206, 31, .10);
}

.kz-chat-input::placeholder {
  color: rgba(226, 232, 240, .44);
}

.kz-chat-send {
  width: 46px;
  height: 44px;
  border: 0;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: #f6ce1f;
  color: #090d14;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(246, 206, 31, .18);
  transition: transform .18s ease, opacity .18s ease;
}

.kz-chat-send:hover {
  transform: translateY(-1px);
}

.kz-chat-send:disabled,
.kz-chat-input:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.kz-chat-fineprint {
  grid-column: 1 / -1;
  color: rgba(226, 232, 240, .48);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10.5px;
  line-height: 1.35;
  padding: 0 4px 2px;
}

body.kz-chat-open .kz-chat-launcher {
  opacity: .76;
}

@media (max-width: 520px) {
  .kz-chat-nudge {
    right: 13px;
    bottom: 70px;
    font-size: 11.5px;
  }

  .kz-chat-launcher {
    right: 14px;
    bottom: 14px;
    min-width: 46px;
    min-height: 46px;
    padding: 0 13px;
  }

  .kz-chat-launcher-label {
    display: none;
  }

  .kz-chat-widget {
    inset: auto 10px 72px 10px;
    width: auto;
    height: min(590px, calc(100dvh - 94px));
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kz-chat-widget,
  .kz-chat-launcher,
  .kz-chat-nudge,
  .kz-chat-send,
  .kz-chat-close {
    transition: none;
  }

  .kz-chat-typing-dots i {
    animation: none;
  }
}

/* V7: el bloqueo/desenfoque del fondo solo se activa en celular. En PC el chat queda flotante y no bloquea la web. */
.kz-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10600;
  opacity: 0;
  pointer-events: none;
  background: transparent;
  transition: opacity .18s ease;
}

.kz-chat-widget {
  z-index: 10620;
}

.kz-chat-bubble strong {
  font-weight: 900;
  color: inherit;
}

@media (max-width: 520px) {
  html.kz-chat-scroll-locked {
    overflow: hidden !important;
  }

  body.kz-chat-open {
    overflow: hidden !important;
  }

  body.kz-chat-open .kz-chat-backdrop {
    opacity: 1;
    pointer-events: auto;
    background: rgba(4, 8, 18, .48);
    backdrop-filter: blur(7px) saturate(1.08);
    -webkit-backdrop-filter: blur(7px) saturate(1.08);
  }
}


/* V8: el chat debe quedar por encima del menú hamburguesa.
   El sidebar usa z-index 10500/10501, por eso Kairo vive arriba de esa capa. */
body.kz-chat-layer-active .kz-chat-widget {
  z-index: 10620 !important;
}

body.kz-chat-layer-active .kz-chat-backdrop {
  z-index: 10600 !important;
}

body.kz-chat-layer-active .kz-chat-launcher {
  z-index: 10605 !important;
}

body.kz-chat-layer-active .kz-chat-nudge {
  z-index: 10606 !important;
}

/* Si por una transición el menú queda activo un instante, Kairo sigue siendo la capa superior. */
.sidebar-menu.active ~ .kz-chat-widget,
body.kz-chat-layer-active .kz-chat-widget.is-open {
  z-index: 10620 !important;
}
