/* ═══════════════════════════════════════════════════════════════
   LeaseBase AI Property Advisor — floating chat widget
   ═══════════════════════════════════════════════════════════════ */

.lb-advisor-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lb-primary, #16a34a), #059669);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}
.lb-advisor-fab.visible {
  opacity: 1;
  pointer-events: auto;
}
.lb-advisor-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(22, 163, 74, 0.45);
}
.lb-advisor-fab svg {
  width: 26px;
  height: 26px;
}
.lb-advisor-fab.open {
  opacity: 0;
  pointer-events: none;
}

/* ── Panel ─────────────────────────────────────────────────── */

.lb-advisor-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9991;
  width: 400px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}
.lb-advisor-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ────────────────────────────────────────────────── */

.lb-advisor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--lb-primary, #16a34a), #059669);
  color: #fff;
  flex-shrink: 0;
}
.lb-advisor-header__title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-advisor-header__title svg {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}
.lb-advisor-header__close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.lb-advisor-header__close svg {
  width: 20px;
  height: 20px;
}
.lb-advisor-header__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* ── Messages ──────────────────────────────────────────────── */

.lb-advisor-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 360px;
}
.lb-advisor-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.lb-advisor-msg--user {
  align-self: flex-end;
  background: var(--lb-primary, #16a34a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.lb-advisor-msg--ai {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

/* ── Typing indicator ──────────────────────────────────────── */

.lb-advisor-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.lb-advisor-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: lb-advisor-bounce 1.2s ease-in-out infinite;
}
.lb-advisor-typing span:nth-child(2) { animation-delay: 0.15s; }
.lb-advisor-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes lb-advisor-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── Input ─────────────────────────────────────────────────── */

.lb-advisor-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.lb-advisor-input textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
.lb-advisor-input textarea:focus {
  border-color: var(--lb-primary, #16a34a);
}
.lb-advisor-input button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lb-primary, #16a34a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.lb-advisor-input button:hover {
  background: #15803d;
}
.lb-advisor-input button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* ── Footer / counter ──────────────────────────────────────── */

.lb-advisor-footer {
  padding: 6px 16px 10px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* ── Email gate overlay ────────────────────────────────────── */

.lb-advisor-gate {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  z-index: 5;
  border-radius: 16px;
}
.lb-advisor-gate h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px;
}
.lb-advisor-gate p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px;
}
.lb-advisor-gate input {
  width: 100%;
  max-width: 260px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  margin-bottom: 10px;
}
.lb-advisor-gate input:focus {
  border-color: var(--lb-primary, #16a34a);
}
.lb-advisor-gate button {
  padding: 10px 24px;
  background: var(--lb-primary, #16a34a);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.lb-advisor-gate button:hover {
  background: #15803d;
}

/* ── CTA (after all questions used) ────────────────────────── */

.lb-advisor-cta {
  padding: 20px 16px;
  text-align: center;
  flex-shrink: 0;
}
.lb-advisor-cta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--lb-primary, #16a34a), #059669);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.lb-advisor-cta a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}
.lb-advisor-cta p {
  font-size: 11px;
  color: #94a3b8;
  margin: 8px 0 0;
}

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .lb-advisor-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }
  .lb-advisor-fab {
    bottom: 16px;
    right: 16px;
  }
}
