:root {
  --coop-green: #166534;
  --coop-green-dark: #0f4f28;
  --coop-green-light: #dcfce7;
  --coop-white: #ffffff;
  --coop-background: #f5f7f5;
  --coop-text: #172019;
  --coop-muted: #657068;
  --coop-border: rgba(23, 32, 25, 0.12);
  --coop-shadow: 0 24px 70px rgba(15, 79, 40, 0.22);
}
button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}



/* Texto accesible únicamente para lectores de pantalla */

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

/* Botón flotante */

.chatbot-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 18px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--coop-green),
    var(--coop-green-dark)
  );
  color: var(--coop-white);
  box-shadow: 0 16px 45px rgba(15, 79, 40, 0.35);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.chatbot-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 55px rgba(15, 79, 40, 0.4);
}

.chatbot-toggle__icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 20px;
}

.chatbot-toggle__text {
  font-weight: 700;
}

/* Ventana principal */

.chatbot {
  position: absolute;
  right: 24px;
  bottom: 96px;
  z-index: 1001;
  display: grid;
  width: min(410px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 130px));
  grid-template-rows: auto 1fr auto auto auto;
  overflow: hidden;
  border: 1px solid var(--coop-border);
  border-radius: 26px;
  background: var(--coop-white);
  box-shadow: var(--coop-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 180ms ease;
}

.chatbot--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  background: linear-gradient(
    135deg,
    var(--coop-green),
    var(--coop-green-dark)
  );
  color: var(--coop-white);
}

.chatbot__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot__avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 14px;
  font-weight: 800;
}

.chatbot__header h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.chatbot__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.chatbot__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #86efac;
  box-shadow: 0 0 0 4px rgba(134, 239, 172, 0.16);
}

.chatbot__close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--coop-white);
  font-size: 28px;
  line-height: 1;
}

.chatbot__messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 20px 16px;
  overscroll-behavior: contain;
}

.chatbot-message {
  display: flex;
  width: 100%;
}

.chatbot-message--assistant {
  justify-content: flex-start;
}

.chatbot-message--user {
  justify-content: flex-end;
}

.chatbot-message__content {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.5;
}

.chatbot-message__content p {
  margin: 0;
}

.chatbot-message--assistant .chatbot-message__content {
  border-bottom-left-radius: 6px;
  background: #f0f4f1;
  color: var(--coop-text);
}

.chatbot-message--user .chatbot-message__content {
  border-bottom-right-radius: 6px;
  background: var(--coop-green);
  color: var(--coop-white);
}

.chatbot-message__action {
  display: inline-flex;
  margin-top: 10px;
  padding: 9px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--coop-green);
  color: var(--coop-white);
  font-size: 13px;
  font-weight: 700;
}

.chatbot-quick-actions,
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatbot-quick-actions button,
.chatbot-suggestions button {
  padding: 9px 12px;
  border: 1px solid rgba(22, 101, 52, 0.25);
  border-radius: 999px;
  background: var(--coop-white);
  color: var(--coop-green-dark);
  font-size: 12px;
  font-weight: 700;
  transition:
    background 150ms ease,
    color 150ms ease;
}

.chatbot-quick-actions button:hover,
.chatbot-suggestions button:hover {
  background: var(--coop-green);
  color: var(--coop-white);
}

/* Indicador de escritura */

.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  color: var(--coop-muted);
  font-size: 12px;
}

.chatbot-typing[hidden] {
  display: none;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coop-green);
  animation: typing-bounce 1s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.chatbot-typing span:nth-child(3) {
  animation-delay: 240ms;
}

.chatbot-typing p {
  margin: 0 0 0 5px;
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Formulario */

.chatbot__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--coop-border);
  background: var(--coop-white);
}

.chatbot__form textarea {
  width: 100%;
  min-height: 46px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--coop-border);
  border-radius: 16px;
  outline: none;
  padding: 12px 14px;
  color: var(--coop-text);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.chatbot__form textarea:focus {
  border-color: var(--coop-green);
  box-shadow: 0 0 0 4px rgba(22, 101, 52, 0.1);
}

.chatbot__send {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  align-self: end;
  border: 0;
  border-radius: 15px;
  background: var(--coop-green);
  color: var(--coop-white);
  font-size: 18px;
}

.chatbot__send:disabled,
.chatbot__form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chatbot__footer {
  padding: 0 14px 12px;
  color: var(--coop-muted);
  text-align: center;
  font-size: 10px;
}

@media (max-width: 600px) {
  .demo-page {
    width: min(100% - 24px, 1100px);
  }

  .demo-section {
    padding: 32px 24px;
  }

  .chatbot-toggle {
    right: 14px;
    bottom: 14px;
  }

  .chatbot-toggle__text {
    display: none;
  }

  .chatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    transform-origin: bottom center;
  }
}