/* ================================================
   REACH DATA CHAT WIDGET
   ================================================ */

/* Chat toggle button */
.chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0D1B2A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30);
  background: #0066FF;
}

.chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: #FFFFFF;
  transition: opacity 0.15s ease;
}

.chat-toggle .icon-chat { display: block; }
.chat-toggle .icon-close { display: none; }
.chat-toggle.is-open .icon-chat { display: none; }
.chat-toggle.is-open .icon-close { display: block; }

/* Chat panel */
.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 380px;
  height: 520px;
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.chat-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  background: #0D1B2A;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0066FF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header__avatar svg {
  width: 18px;
  height: 18px;
  fill: #FFFFFF;
}

.chat-header__info {
  flex: 1;
  min-width: 0;
}

.chat-header__title {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.3;
}

.chat-header__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  margin-top: 2px;
}

.chat-header__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.chat-header__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chat-header__close svg {
  width: 18px;
  height: 18px;
  stroke: rgba(255, 255, 255, 0.75);
  fill: none;
}

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

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

/* Individual messages */
.chat-msg {
  display: flex;
  max-width: 88%;
}

.chat-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg--bot {
  align-self: flex-start;
}

.chat-msg__bubble {
  padding: 10px 13px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.845rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg--user .chat-msg__bubble {
  background: #0066FF;
  color: #FFFFFF;
  border-bottom-right-radius: 3px;
}

.chat-msg--bot .chat-msg__bubble {
  background: #FFFFFF;
  color: #0D1B2A;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Loading dots */
.chat-msg--typing .chat-msg__bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.chat-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0D1B2A;
  opacity: 0.3;
  animation: chatDotPulse 1.2s infinite;
}

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

@keyframes chatDotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40% { opacity: 0.9; transform: scale(1.2); }
}

/* Input area */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #E8ECF0;
  background: #FFFFFF;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1.5px solid #E0E4EB;
  border-radius: 6px;
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.845rem;
  color: #0D1B2A;
  background: #F5F7FA;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  resize: none;
  line-height: 1.45;
  max-height: 100px;
  overflow-y: auto;
}

.chat-input:focus {
  border-color: #0066FF;
  background: #FFFFFF;
}

.chat-input::placeholder {
  color: #9BA5B4;
}

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #0066FF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.chat-send:hover {
  background: #0052CC;
}

.chat-send:active {
  transform: scale(0.93);
}

.chat-send:disabled {
  background: #BCC5D0;
  cursor: not-allowed;
  transform: none;
}

.chat-send svg {
  width: 16px;
  height: 16px;
  fill: #FFFFFF;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 86px;
    height: 65vh;
    max-height: 520px;
  }

  .chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}
