/* ============================================================
   GREXION AI — Chat Widget Stylesheet
   ============================================================ */

/* ============================================================
   FLOATING CHAT BUTTON
   ============================================================ */
#grexion-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 8px 24px rgba(19, 99, 198, 0.45);
  transition: all 0.3s ease;
  z-index: 9999;
  outline: none;
}

#grexion-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(19, 99, 198, 0.55);
}

#grexion-chat-btn .chat-btn-icon {
  transition: all 0.3s ease;
}

#grexion-chat-btn.chat-open .chat-btn-icon {
  transform: rotate(90deg);
}

/* Pulse ring animation on button */
#grexion-chat-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  opacity: 0.3;
  animation: chat-pulse 2.5s ease-out infinite;
  z-index: -1;
}

@keyframes chat-pulse {
  0% { transform: scale(1); opacity: 0.3; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ============================================================
   CHAT WINDOW
   ============================================================ */
#grexion-chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(19, 99, 198, 0.22), 0 4px 16px rgba(0,0,0,0.1);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden by default */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: bottom right;
}

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

/* ============================================================
   CHAT HEADER
   ============================================================ */
.chat-header {
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #ffffff;
  flex-shrink: 0;
}

.chat-header-text h5 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.chat-header-text span {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
}

.chat-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 5px;
  animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-close-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.1);
}

/* ============================================================
   CHAT MESSAGES AREA
   ============================================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F4F7FE;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(19, 99, 198, 0.2);
  border-radius: 2px;
}

/* ============================================================
   MESSAGE BUBBLES
   ============================================================ */
.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
  animation: msg-appear 0.25s ease;
}

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

.chat-msg.bot {
  background: #ffffff;
  color: #14183E;
  align-self: flex-start;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chat-msg.user {
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  color: #ffffff;
  align-self: flex-end;
  border-radius: 12px 12px 4px 12px;
}

.chat-msg-time {
  font-size: 0.7rem;
  color: rgba(108, 117, 125, 0.7);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.chat-msg.bot .chat-msg-time {
  text-align: left;
  color: rgba(108, 117, 125, 0.7);
}

.chat-msg.user .chat-msg-time {
  color: rgba(255,255,255,0.65);
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
#typing-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  align-self: flex-start;
  max-width: 80px;
}

#typing-indicator.visible {
  display: flex;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================
   CHAT INPUT AREA
   ============================================================ */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
  background: #F4F7FE;
  color: #14183E;
  font-family: 'Inter', sans-serif;
  resize: none;
  min-height: 40px;
  max-height: 100px;
}

#chat-input:focus {
  border-color: #1363C6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(19, 99, 198, 0.08);
}

#chat-input::placeholder {
  color: #a0aec0;
}

#chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1363C6 0%, #15ACE1 100%);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(19, 99, 198, 0.4);
}

#chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   CHAT FOOTER NOTE
   ============================================================ */
.chat-footer-note {
  text-align: center;
  font-size: 0.7rem;
  color: #a0aec0;
  padding: 6px 14px 10px;
  background: #ffffff;
  flex-shrink: 0;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  #grexion-chat-window {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    transform: translateY(100%);
  }

  #grexion-chat-window.chat-open {
    transform: translateY(0);
  }

  #grexion-chat-btn {
    bottom: 20px;
    right: 20px;
  }
}
