/* ============================================
   FRACTIONAL AGENT — Chat Widget Styles
   ============================================ */

/* --- Toggle Button --- */
.fa-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 48px;
  padding: 0 18px 0 14px;
  border-radius: 24px;
  background: #B87333;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 9990;
  transition: transform 0.2s ease, background 0.2s ease;
  color: #FFFFFF;
}
.fa-chat-toggle:hover {
  transform: scale(1.04);
  background: #D4945A;
}
.fa-chat-toggle__label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.fa-chat-toggle__icon--close { display: none; }
.fa-chat-toggle--open .fa-chat-toggle__icon--chat { display: none; }
.fa-chat-toggle--open .fa-chat-toggle__label { display: none; }
.fa-chat-toggle--open .fa-chat-toggle__icon--close { display: block; }
.fa-chat-toggle--open {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

/* --- Chat Panel --- */
.fa-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #0F1D35;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}
.fa-chat-panel--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* --- Header --- */
.fa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #0F1D35;
  color: #F5F0E8;
  flex-shrink: 0;
}
.fa-chat-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fa-chat-header__mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fa-chat-header__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.fa-chat-header__status {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  color: #B87333;
  letter-spacing: 0.04em;
}
.fa-chat-header__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9A9488;
  padding: 4px;
  transition: color 0.15s ease;
}
.fa-chat-header__close:hover { color: #F5F0E8; }

/* --- Messages --- */
.fa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8F6F2;
}
.fa-chat-messages::-webkit-scrollbar { width: 4px; }
.fa-chat-messages::-webkit-scrollbar-track { background: transparent; }
.fa-chat-messages::-webkit-scrollbar-thumb { background: #C8C2B8; border-radius: 2px; }

.fa-chat-msg {
  display: flex;
  max-width: 85%;
}
.fa-chat-msg--bot { align-self: flex-start; }
.fa-chat-msg--user { align-self: flex-end; }

.fa-chat-msg__bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.fa-chat-msg--bot .fa-chat-msg__bubble {
  background: #FFFFFF;
  color: #1B2A4A;
  border: 1px solid #E8E4DC;
  border-bottom-left-radius: 4px;
}
.fa-chat-msg--user .fa-chat-msg__bubble {
  background: #1B2A4A;
  color: #F5F0E8;
  border-bottom-right-radius: 4px;
}

/* --- Typing Indicator --- */
.fa-chat-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.fa-chat-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B87333;
  animation: faChatBounce 1.2s infinite;
}
.fa-chat-dots span:nth-child(2) { animation-delay: 0.2s; }
.fa-chat-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes faChatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* --- Input --- */
.fa-chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #E8E4DC;
  background: #FFFFFF;
  flex-shrink: 0;
}
.fa-chat-input__field {
  flex: 1;
  border: 1px solid #E8E4DC;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
  background: #F8F6F2;
  color: #1B2A4A;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.fa-chat-input__field::placeholder { color: #9A9488; }
.fa-chat-input__field:focus { border-color: #B87333; }

.fa-chat-input__send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #B87333;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.fa-chat-input__send:hover { background: #D4945A; }

/* --- Mobile --- */
.fa-chat-schedule-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  background: #B87333;
  color: #FFFFFF !important;
  border-radius: 6px;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.85rem;
  font-family: 'Outfit', sans-serif;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fa-chat-schedule-btn:hover { background: #D4945A; }

@media (max-width: 480px) {
  .fa-chat-panel {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: 65vh;
    max-height: 65vh;
    border-radius: 12px;
  }
  .fa-chat-toggle--open {
    display: flex;
  }
}
