/* ==========================================================================
   Awaken AI Care Navigator - Front-End Chatbot Widget Styling
   ========================================================================== */

/* Launcher Trigger Button */
.awaken-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--navy-900, #062a4d);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(6, 42, 77, 0.25), 0 4px 12px rgba(201, 20, 45, 0.2);
  cursor: pointer;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.awaken-chat-launcher:hover {
  background: var(--navy-800, #0c3b69);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 38px rgba(6, 42, 77, 0.32), 0 6px 16px rgba(201, 20, 45, 0.25);
}

.awaken-chat-launcher:focus-visible {
  outline: 3px solid var(--crimson-500, #c9142d);
  outline-offset: 3px;
}

.launcher-icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.launcher-icon-wrap svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

.launcher-pulse-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background-color: var(--crimson-500, #c9142d);
  border: 2px solid var(--navy-900, #062a4d);
  border-radius: 50%;
  animation: pulseBeacon 2s infinite ease-in-out;
}

@keyframes pulseBeacon {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.8;
  }
}

/* Chat Dialog Container */
.awaken-chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 1000;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid var(--slate-200, #e2e8f0);
  box-shadow: 0 24px 60px -12px rgba(6, 42, 77, 0.25), 0 12px 24px -6px rgba(6, 42, 77, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 250ms cubic-bezier(0.16, 1, 0.3, 1), transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.awaken-chat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--navy-900, #062a4d);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.chat-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  flex-shrink: 0;
}

.chat-avatar svg {
  width: 20px;
  height: 20px;
}

.chat-title-group h3 {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  line-height: 1.2;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
}

.chat-close-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  border-radius: 8px;
  transition: background 150ms ease;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Disclaimer Banner */
.chat-disclaimer {
  padding: 8px 16px;
  background: var(--navy-50, #f3f8fd);
  border-bottom: 1px solid var(--slate-200, #e2e8f0);
  font-size: 0.76rem;
  color: var(--slate-600, #475569);
  text-align: center;
  line-height: 1.35;
}

/* Message History Scroll Area */
.chat-messages {
  flex-grow: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--warm-50, #fbfaf7);
  scroll-behavior: smooth;
}

.chat-bubble {
  max-width: 84%;
  padding: 12px 16px;
  font-size: 0.94rem;
  line-height: 1.5;
  border-radius: 16px;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: #ffffff;
  color: var(--navy-950, #031526);
  border: 1px solid var(--slate-200, #e2e8f0);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(6, 42, 77, 0.04);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--navy-900, #062a4d);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble a {
  color: var(--crimson-500, #c9142d);
  font-weight: 700;
  text-decoration: underline;
}

.chat-bubble.user a {
  color: #93c5fd;
}

/* Typing Indicator Animation */
.chat-typing {
  align-self: flex-start;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-typing.is-visible {
  display: flex;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--slate-400, #94a3b8);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
}

/* Quick Action Chips */
.chat-quick-chips {
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #ffffff;
  border-top: 1px solid var(--slate-200, #e2e8f0);
  max-height: 110px;
  overflow-y: auto;
}

.chip-btn {
  padding: 6px 12px;
  border: 1px solid var(--slate-300, #cbd5e1);
  border-radius: 9999px;
  background: var(--bg-subtle, #f8fafc);
  color: var(--navy-900, #062a4d);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.chip-btn:hover {
  background: var(--navy-50, #f3f8fd);
  border-color: var(--navy-900, #062a4d);
  color: var(--navy-900, #062a4d);
}

/* Chat Input Bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--slate-200, #e2e8f0);
}

.chat-input-bar input {
  flex-grow: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--slate-300, #cbd5e1);
  border-radius: 9999px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 150ms ease;
}

.chat-input-bar input:focus {
  border-color: var(--navy-900, #062a4d);
}

.chat-send-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--crimson-500, #c9142d);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.chat-send-btn:hover {
  background: var(--crimson-600, #b51227);
  transform: scale(1.05);
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

/* Mobile Screen Adaptation */
@media (max-width: 600px) {
  .awaken-chat-launcher {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.88rem;
  }

  .awaken-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 90vh;
    border-radius: 20px 20px 0 0;
  }
}
