/* ═══════════════════════════════════════════════════════════
   realestatebismark — widget del asistente de IA
   Estilos aislados (prefijo .rbc-) para no depender de styles.css
   ═══════════════════════════════════════════════════════════ */

.rbc {
  --rbc-ink: #08161d;
  --rbc-deep: #0c2430;
  --rbc-panel: #0a1f2a;
  --rbc-green: #12463a;
  --rbc-green-bright: #1c6b54;
  --rbc-gold: #c6a972;
  --rbc-paper: #f4f1ea;
  --rbc-mist: #a7c4bc;
  --rbc-line: rgba(198, 169, 114, .22);
  --rbc-user: #163e37;
  --rbc-shadow: 0 24px 60px -12px rgba(0, 0, 0, .5);
  --rbc-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --rbc-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  font-family: var(--rbc-sans);
}

.rbc *, .rbc *::before, .rbc *::after { box-sizing: border-box; }

/* ─── Botón flotante ─────────────────────────────────────── */
.rbc__launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 16px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--rbc-gold);
  color: var(--rbc-ink);
  font-family: var(--rbc-sans);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: var(--rbc-shadow);
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .25s;
}
.rbc__launcher:hover { transform: translateY(-2px); background: #d4bd8e; }
.rbc__launcher:focus-visible { outline: 2px solid var(--rbc-ink); outline-offset: 3px; }
.rbc__launcher svg { width: 22px; height: 22px; flex: none; }
.rbc__launcher-text { white-space: nowrap; }
.rbc.is-open .rbc__launcher { display: none; }

@media (max-width: 480px) {
  .rbc__launcher { height: 52px; padding: 0 16px; }
  .rbc__launcher-text { display: none; }
}

/* ─── Panel ──────────────────────────────────────────────── */
.rbc__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--rbc-panel);
  color: var(--rbc-paper);
  border: 1px solid var(--rbc-line);
  border-radius: 18px;
  box-shadow: var(--rbc-shadow);
}
.rbc.is-open .rbc__panel { display: flex; animation: rbc-in .28s cubic-bezier(.2, .7, .2, 1); }

@keyframes rbc-in {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  .rbc { right: 12px; bottom: 12px; left: 12px; }
  .rbc__panel {
    position: fixed;
    inset: 8px 8px 8px 8px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 16px;
  }
}

/* ─── Cabecera ───────────────────────────────────────────── */
.rbc__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 16px 18px;
  background: linear-gradient(180deg, rgba(28, 107, 84, .18), rgba(10, 31, 42, 0));
  border-bottom: 1px solid var(--rbc-line);
}
.rbc__avatar {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rbc-line);
  color: var(--rbc-gold);
  font-family: var(--rbc-serif);
  font-style: italic;
  font-size: 1rem;
}
.rbc__titles { flex: 1; min-width: 0; line-height: 1.3; }
.rbc__title { font-family: var(--rbc-serif); font-size: 1.02rem; }
.rbc__subtitle {
  font-size: .72rem; color: var(--rbc-mist);
  display: flex; align-items: center; gap: 6px;
}
.rbc__dot { width: 6px; height: 6px; border-radius: 50%; background: #59c39a; flex: none; }
.rbc__icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--rbc-mist);
  border-radius: 8px; cursor: pointer;
  transition: background .2s, color .2s;
}
.rbc__icon-btn:hover { background: rgba(255, 255, 255, .07); color: var(--rbc-paper); }
.rbc__icon-btn:focus-visible { outline: 2px solid var(--rbc-gold); outline-offset: 2px; }
.rbc__icon-btn svg { width: 18px; height: 18px; }

/* ─── Mensajes ───────────────────────────────────────────── */
.rbc__log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.rbc__log::-webkit-scrollbar { width: 8px; }
.rbc__log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 4px; }

.rbc__msg {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.rbc__msg a { color: var(--rbc-gold); text-underline-offset: 2px; }
.rbc__msg strong { font-weight: 600; color: #fff; }
.rbc__msg em { font-style: italic; }
.rbc__msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-bottom-left-radius: 4px;
}
.rbc__msg--user {
  align-self: flex-end;
  background: var(--rbc-user);
  border-bottom-right-radius: 4px;
}
.rbc__msg--error {
  align-self: flex-start;
  background: rgba(180, 70, 47, .16);
  border: 1px solid rgba(180, 70, 47, .35);
  border-bottom-left-radius: 4px;
}

/* indicador "escribiendo" */
.rbc__typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.rbc__typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rbc-mist);
  animation: rbc-bounce 1.2s infinite ease-in-out;
}
.rbc__typing i:nth-child(2) { animation-delay: .15s; }
.rbc__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rbc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ─── Sugerencias ────────────────────────────────────────── */
.rbc__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 12px;
}
.rbc__chip {
  border: 1px solid var(--rbc-line);
  background: transparent;
  color: var(--rbc-paper);
  font-family: var(--rbc-sans);
  font-size: .82rem;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.rbc__chip:hover { background: rgba(198, 169, 114, .14); border-color: var(--rbc-gold); }
.rbc__chip:focus-visible { outline: 2px solid var(--rbc-gold); outline-offset: 2px; }

/* ─── Entrada ────────────────────────────────────────────── */
.rbc__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 10px;
  border-top: 1px solid var(--rbc-line);
  background: rgba(0, 0, 0, .12);
}
.rbc__input {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: var(--rbc-paper);
  font-family: var(--rbc-sans);
  font-size: .92rem;
  line-height: 1.4;
}
.rbc__input::placeholder { color: rgba(167, 196, 188, .7); }
.rbc__input:focus { outline: none; border-color: var(--rbc-green-bright); }
.rbc__input:disabled { opacity: .5; }
.rbc__send {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 11px;
  background: var(--rbc-gold);
  color: var(--rbc-ink);
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.rbc__send:hover:not(:disabled) { background: #d4bd8e; }
.rbc__send:disabled { opacity: .4; cursor: default; }
.rbc__send:focus-visible { outline: 2px solid var(--rbc-gold); outline-offset: 2px; }
.rbc__send svg { width: 18px; height: 18px; }

.rbc__disclaimer {
  padding: 0 14px 10px;
  font-size: .68rem;
  line-height: 1.4;
  color: rgba(167, 196, 188, .75);
  text-align: center;
  background: rgba(0, 0, 0, .12);
}

@media (prefers-reduced-motion: reduce) {
  .rbc.is-open .rbc__panel { animation: none; }
  .rbc__launcher { transition: none; }
  .rbc__typing i { animation-duration: 2s; }
}
