/* Prosper AI Chat Widget */
:root {
  --chat-navy: #08121E;
  --chat-gold: #C9A84C;
  --chat-cream: #F4F1EC;
  --chat-radius: 16px;
}

#prosper-chat-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', -apple-system, sans-serif;
}

/* Toggle button */
#prosper-chat-toggle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--chat-navy);
  border: 2px solid var(--chat-gold);
  color: var(--chat-cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  margin-left: auto;
}
#prosper-chat-toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(201,168,76,0.3);
}
.chat-icon--close { display: none; }
#prosper-chat-widget.chat-open .chat-icon--open  { display: none; }
#prosper-chat-widget.chat-open .chat-icon--close { display: block; }

.chat-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 18px; height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Panel */
#prosper-chat-panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: var(--chat-navy);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--chat-radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideIn 0.22s ease;
}
@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.chat-header {
  background: rgba(201,168,76,0.08);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header__avatar {
  width: 38px; height: 38px;
  background: var(--chat-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--chat-navy);
  flex-shrink: 0;
}
.chat-header__info { flex: 1; }
.chat-header__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--chat-cream);
  line-height: 1.2;
}
.chat-header__status {
  font-size: 11px;
  color: rgba(244,241,236,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chat-status-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.chat-header__close {
  background: none;
  border: none;
  color: rgba(244,241,236,0.4);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}
.chat-header__close:hover { color: var(--chat-cream); }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  animation: msgFadeIn 0.18s ease;
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg--bot {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--chat-cream);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg--user {
  background: var(--chat-gold);
  color: var(--chat-navy);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chat-msg--typing {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  padding: 14px 18px;
}
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: rgba(244,241,236,0.4);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  gap: 8px;
  align-items: center;
}
#prosper-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--chat-cream);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
#prosper-chat-input:focus { border-color: rgba(201,168,76,0.5); }
#prosper-chat-input::placeholder { color: rgba(244,241,236,0.3); }

#prosper-chat-send {
  width: 36px; height: 36px;
  background: var(--chat-gold);
  border: none;
  border-radius: 8px;
  color: var(--chat-navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#prosper-chat-send:hover  { background: #d4b652; }
#prosper-chat-send:active { transform: scale(0.94); }
#prosper-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Mobile */
@media (max-width: 420px) {
  #prosper-chat-widget { bottom: 80px; right: 12px; }
  #prosper-chat-panel  { width: calc(100vw - 24px); right: -12px; }
}
