/* Chat flotante: usa las variables y tipografías de styles.css */
.chat-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--bg);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

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

.chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 91;
  display: none;
  flex-direction: column;
  width: 24rem;
  height: min(34rem, calc(100dvh - 2rem));
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.chat-panel.open { display: flex; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--secondary);
}

.chat-head strong {
  font-family: var(--display);
  font-size: 1.125rem;
}

.chat-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.chat-msg {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg-alt);
}

.chat-msg.me {
  align-self: flex-end;
  background: var(--primary);
  color: var(--bg);
}

.chat-msg a { text-decoration: underline; font-weight: 700; }

.chat-sugs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.chat-sug {
  padding: 0.5rem 0.875rem;
  min-height: 2.5rem;
  border: 1px solid var(--secondary);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.chat-sug:hover { background: var(--bg-alt); }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--secondary);
}

.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem; /* 16px evita el zoom en iPhone */
}

.chat-send {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--bg);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.chat-send:disabled { opacity: 0.5; cursor: default; }

/* Celular: el chat ocupa toda la pantalla */
@media (max-width: 30rem) {
  .chat-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-fab:hover { transform: none; }
}
