/* =====================================================================
   LoanIntakeBot — chatbot widget CSS
   Brand: navy/dark-blue (#0b1120) + gold (#e8a93f), DM Sans / Syne
   ===================================================================== */

/* ---- Widget trigger button ---- */
#ff-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent, #e8a93f);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(232, 169, 63, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ff-chat-trigger:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(232, 169, 63, 0.5);
}

#ff-chat-trigger svg {
  width: 26px;
  height: 26px;
  fill: #0b1120;
}

/* ---- Chat window ---- */
#ff-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  background: #132035;
  border: 1px solid rgba(136, 153, 180, 0.18);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#ff-chat-window.ff-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#ff-chat-window.ff-closing {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* ---- Header ---- */
.ff-chat-header {
  background: #0b1120;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(136, 153, 180, 0.1);
  flex-shrink: 0;
}

.ff-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e8a93f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ff-chat-avatar svg {
  width: 20px;
  height: 20px;
  fill: #0b1120;
}

.ff-chat-header-info {
  flex: 1;
}

.ff-chat-header-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e8edf5;
  line-height: 1.2;
}

.ff-chat-header-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: #8899b4;
  margin-top: 2px;
}

.ff-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #8899b4;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.ff-chat-close:hover { color: #e8edf5; }

.ff-chat-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---- Messages area ---- */
#ff-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
#ff-chat-messages::-webkit-scrollbar { width: 4px; }
#ff-chat-messages::-webkit-scrollbar-track { background: transparent; }
#ff-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(136, 153, 180, 0.2);
  border-radius: 2px;
}

.ff-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: ff-fadein 0.25s ease;
}

@keyframes ff-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ff-msg--bot .ff-msg-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8a93f;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ff-msg--bot .ff-msg-dot svg {
  width: 14px;
  height: 14px;
  fill: #0b1120;
}

.ff-msg--user { flex-direction: row-reverse; }

.ff-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
}

.ff-msg--bot .ff-msg-bubble {
  background: #1a2d4a;
  color: #c8d4e8;
  border-bottom-left-radius: 4px;
}

.ff-msg--user .ff-msg-bubble {
  background: #e8a93f;
  color: #0b1120;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.ff-msg-bubble p {
  margin: 0 0 8px;
}
.ff-msg-bubble p:last-child { margin-bottom: 0; }

.ff-msg-bubble strong { font-weight: 600; }
.ff-msg-bubble em { font-style: italic; }

/* ---- Option buttons ---- */
.ff-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ff-option-btn {
  background: #1a2d4a;
  border: 1px solid rgba(232, 169, 63, 0.3);
  color: #e8edf5;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ff-option-btn:hover {
  background: rgba(232, 169, 63, 0.15);
  border-color: #e8a93f;
  color: #e8a93f;
}

.ff-option-btn:active {
  background: rgba(232, 169, 63, 0.25);
}

/* ---- Process steps ---- */
.ff-process-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ff-process-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: #8899b4;
  line-height: 1.5;
}

.ff-process-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(232, 169, 63, 0.15);
  border: 1px solid rgba(232, 169, 63, 0.4);
  font-family: 'Syne', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #e8a93f;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Who handles what ---- */
.ff-who-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ff-who-box {
  background: #0f1929;
  border: 1px solid rgba(136, 153, 180, 0.12);
  border-radius: 10px;
  padding: 12px;
}

.ff-who-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e8a93f;
  margin-bottom: 8px;
}

.ff-who-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ff-who-box li {
  font-size: 0.78rem;
  color: #8899b4;
  padding-left: 12px;
  position: relative;
}

.ff-who-box li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 1px;
  background: rgba(232, 169, 63, 0.5);
}

/* ---- Email form ---- */
.ff-email-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ff-email-input {
  width: 100%;
  background: #1a2d4a;
  border: 1px solid rgba(136, 153, 180, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: #e8edf5;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.ff-email-input::placeholder { color: #5a6a84; }

.ff-email-input:focus { border-color: #e8a93f; }

.ff-email-submit {
  background: #e8a93f;
  color: #0b1120;
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-end;
}

.ff-email-submit:hover { background: #d49730; }

/* ---- CTA button ---- */
.ff-cta-btn {
  display: inline-block;
  background: #e8a93f;
  color: #0b1120;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 12px;
  transition: background 0.15s;
}

.ff-cta-btn:hover { background: #d49730; }

/* ---- Persistent text input area ---- */
.ff-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #0b1120;
  border-top: 1px solid rgba(136, 153, 180, 0.1);
  flex-shrink: 0;
}

.ff-text-input {
  flex: 1;
  background: #1a2d4a;
  border: 1px solid rgba(136, 153, 180, 0.25);
  border-radius: 8px;
  padding: 9px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: #e8edf5;
  outline: none;
  transition: border-color 0.15s;
}

.ff-text-input::placeholder { color: #5a6a84; }
.ff-text-input:focus { border-color: #e8a93f; }

.ff-send-btn {
  background: #e8a93f;
  color: #0b1120;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ff-send-btn:hover { background: #d49730; }
.ff-send-btn:active { background: #c08825; }

.ff-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---- Typing indicator ---- */
.ff-typing {
  display: flex;
  gap: 5px;
  padding: 2px 0;
}

.ff-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8899b4;
  animation: ff-pulse 1.2s ease-in-out infinite;
}

.ff-typing span:nth-child(2) { animation-delay: 0.2s; }
.ff-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ff-pulse {
  0%, 60%, 100% { transform: scale(1); opacity: 0.4; }
  30% { transform: scale(1.2); opacity: 1; }
}

/* ---- Recommendation card ---- */
.ff-rec-card {
  background: rgba(232, 169, 63, 0.07);
  border: 1px solid rgba(232, 169, 63, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}

.ff-rec-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #e8a93f;
  margin-bottom: 10px;
}

.ff-rec-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e8edf5;
  margin-bottom: 6px;
}

.ff-rec-range {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: #8899b4;
  margin-bottom: 10px;
}

.ff-rec-why {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  color: #8899b4;
  line-height: 1.6;
  margin-top: 8px;
}

/* ---- Mobile responsive ---- */
@media (max-width: 500px) {
  #ff-chat-window {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 90px;
    max-height: calc(100vh - 140px);
  }

  #ff-chat-trigger {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }

  .ff-msg-bubble { max-width: 85%; }

  .ff-who-grid { grid-template-columns: 1fr; }
}