/* Chat visual de NOA. Se mantiene aislado de los héroes aprobados. */
body.noa-chat-open {
  overflow: hidden;
}

.noa-chat {
  position: fixed;
  inset: auto 28px 26px auto;
  z-index: 10000;
  width: min(424px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 48px));
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(239, 193, 100, 0.7);
  border-radius: 24px;
  color: #f8f4ea;
  background:
    radial-gradient(circle at 18% 0%, rgba(239, 193, 100, 0.12), transparent 35%),
    linear-gradient(145deg, #090806 0%, #020202 48%, #080603 100%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.82),
    0 0 0 1px rgba(255, 229, 140, 0.06),
    0 0 38px rgba(239, 193, 100, 0.14),
    inset 0 1px 0 rgba(255, 242, 194, 0.1);
  font-family: Montserrat, Inter, Arial, sans-serif;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 220ms ease, transform 260ms ease;
}

.noa-chat[open] {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.noa-chat::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}

.noa-chat__panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.noa-chat__header {
  min-height: 90px;
  padding: 18px 18px 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(239, 193, 100, 0.18);
  background:
    linear-gradient(90deg, rgba(239, 193, 100, 0.08), transparent 62%),
    rgba(0, 0, 0, 0.38);
}

.noa-chat__identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.noa-chat__avatar {
  position: relative;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 229, 140, 0.82);
  border-radius: 50%;
  color: #120d03;
  background:
    radial-gradient(circle at 34% 28%, #fff6c9 0 10%, transparent 11%),
    linear-gradient(145deg, #ffeaa1, #c2861e 56%, #f4cf69);
  box-shadow:
    0 0 22px rgba(239, 193, 100, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.noa-chat__avatar::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  content: "";
  border: 2px solid #070604;
  border-radius: 50%;
  background: #50db83;
  box-shadow: 0 0 10px rgba(80, 219, 131, 0.78);
}

.noa-chat__avatar span {
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.noa-chat__identity-copy h2 {
  margin: 0;
  color: #ffe58c;
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
}

.noa-chat__identity-copy p {
  margin: 7px 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(248, 244, 234, 0.72);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.16em;
}

.noa-chat__status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #50db83;
  box-shadow: 0 0 10px rgba(80, 219, 131, 0.82);
}

.noa-chat__close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 193, 100, 0.42);
  border-radius: 50%;
  color: #f7e5ae;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.noa-chat__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.noa-chat__close:hover,
.noa-chat__close:focus-visible {
  color: #fff2bc;
  border-color: rgba(255, 229, 140, 0.9);
  background: rgba(239, 193, 100, 0.1);
  transform: rotate(4deg);
}

.noa-chat__conversation {
  min-height: 0;
  padding: 30px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(239, 193, 100, 0.42) transparent;
}

.noa-chat__conversation::-webkit-scrollbar {
  width: 5px;
}

.noa-chat__conversation::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(239, 193, 100, 0.42);
}

.noa-chat__message {
  width: fit-content;
  max-width: 86%;
  padding: 14px 16px;
  border-radius: 18px;
  animation: noaMessageIn 220ms ease both;
}

.noa-chat__message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.58;
}

.noa-chat__message-name {
  margin-bottom: 7px;
  display: block;
  color: #efc164;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.16em;
}

.noa-chat__message--noa {
  align-self: flex-start;
  border: 1px solid rgba(239, 193, 100, 0.26);
  border-top-left-radius: 5px;
  color: #f8f4ea;
  background:
    linear-gradient(135deg, rgba(239, 193, 100, 0.09), rgba(255, 255, 255, 0.025)),
    #0b0906;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
}

.noa-chat__message--visitor {
  align-self: flex-end;
  border: 1px solid rgba(255, 229, 140, 0.5);
  border-top-right-radius: 5px;
  color: #100c04;
  background: linear-gradient(135deg, #ffeaa0, #d39b35 64%, #f2ca61);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(239, 193, 100, 0.1);
}

.noa-chat__message--typing {
  color: rgba(248, 244, 234, 0.66);
  font-style: italic;
}

.noa-chat__actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.noa-chat__response-cta {
  padding: 9px 12px;
  border: 1px solid rgba(255, 229, 140, 0.62);
  border-radius: 999px;
  color: #ffe58c;
  background: rgba(239, 193, 100, 0.08);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.noa-chat__response-cta:hover,
.noa-chat__response-cta:focus-visible {
  border-color: #ffe58c;
  background: rgba(239, 193, 100, 0.16);
  transform: translateY(-1px);
}

.noa-chat__composer {
  padding: 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  align-items: end;
  gap: 10px;
  border-top: 1px solid rgba(239, 193, 100, 0.18);
  background:
    linear-gradient(180deg, rgba(239, 193, 100, 0.035), transparent),
    #050403;
}

.noa-chat__composer textarea {
  width: 100%;
  min-height: 50px;
  max-height: 112px;
  padding: 14px 16px;
  resize: none;
  overflow-y: auto;
  border: 1px solid rgba(239, 193, 100, 0.34);
  border-radius: 17px;
  outline: none;
  color: #fff;
  caret-color: #efc164;
  background: rgba(0, 0, 0, 0.72);
  box-shadow: inset 0 1px 12px rgba(0, 0, 0, 0.55);
  font-size: 14px;
  line-height: 1.42;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.noa-chat__composer textarea::placeholder {
  color: rgba(248, 244, 234, 0.42);
}

.noa-chat__composer textarea:focus {
  border-color: rgba(255, 229, 140, 0.78);
  box-shadow:
    inset 0 1px 12px rgba(0, 0, 0, 0.55),
    0 0 0 3px rgba(239, 193, 100, 0.09);
}

.noa-chat__send {
  position: relative;
  width: 50px;
  height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 239, 184, 0.9);
  border-radius: 17px;
  color: #100c04;
  background: linear-gradient(135deg, #fff0ae, #d4972b 56%, #f2d06d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 7px 18px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(239, 193, 100, 0.18);
  cursor: pointer;
  transition: filter 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.noa-chat__send svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.noa-chat__send:hover,
.noa-chat__send:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 10px 22px rgba(0, 0, 0, 0.58),
    0 0 20px rgba(239, 193, 100, 0.3);
}

.noa-chat__send:active {
  transform: translateY(0) scale(0.97);
}

.noa-chat__send:disabled,
.noa-chat__composer textarea:disabled {
  cursor: wait;
  opacity: 0.58;
}

.noa-chat__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes noaMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .noa-chat {
    inset: 8px;
    width: auto;
    height: calc(100dvh - 16px);
    border-radius: 22px;
  }

  .noa-chat__header {
    min-height: 82px;
    padding: 14px 14px 13px 16px;
  }

  .noa-chat__avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .noa-chat__identity-copy h2 {
    font-size: 23px;
  }

  .noa-chat__conversation {
    padding: 24px 15px;
  }

  .noa-chat__message {
    max-width: 90%;
  }

  .noa-chat__composer {
    padding: 12px;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .noa-chat__composer textarea,
  .noa-chat__send {
    min-height: 48px;
    height: 48px;
  }

  .noa-chat__send {
    width: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .noa-chat,
  .noa-chat__message {
    animation: none;
    transition: none;
  }
}
