/* =============================================
   Bluewater Medical — AI Chatbot Widget Styles
   ============================================= */

/* ---------- Toggle Button ---------- */
.bw-chat-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1a3a8c 0%, #1a8ecf 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26, 58, 140, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.bw-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26, 58, 140, 0.5);
}

.bw-chat-toggle svg {
  width: 26px;
  height: 26px;
  transition: all 0.3s ease;
}

.bw-chat-icon-close {
  display: none;
}

.bw-chat-toggle--active .bw-chat-icon-open {
  display: none;
}

.bw-chat-toggle--active .bw-chat-icon-close {
  display: block;
}

/* Notification badge */
.bw-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #00c87a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: bw-badge-pulse 2s ease-in-out infinite;
}

@keyframes bw-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- Chat Panel ---------- */
.bw-chat-panel {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  z-index: 9998;
  width: 400px;
  max-width: calc(100vw - 2rem);
  height: 560px;
  max-height: calc(100vh - 8rem);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

.bw-chat-panel--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.bw-chat-header {
  background: linear-gradient(135deg, #0f2464 0%, #1a3a8c 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bw-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bw-chat-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.bw-chat-header-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.bw-chat-header-status {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.bw-status-dot {
  width: 7px;
  height: 7px;
  background: #00c87a;
  border-radius: 50%;
  display: inline-block;
}

.bw-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-chat-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

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

/* ---------- Messages Area ---------- */
.bw-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

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

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

.bw-chat-messages::-webkit-scrollbar-thumb {
  background: #ced4da;
  border-radius: 10px;
}

/* ---------- Message Bubbles ---------- */
.bw-chat-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.bw-chat-bubble--assistant {
  background: #f0f4ff;
  color: #1a1a2e;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bw-chat-bubble--user {
  background: linear-gradient(135deg, #1a3a8c, #1a6ecf);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.bw-chat-bubble--animate {
  animation: bw-bubble-in 0.3s ease-out;
}

@keyframes bw-bubble-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bw-chat-bubble strong {
  font-weight: 600;
}

.bw-bullet {
  color: #00c87a;
  font-weight: 700;
}

/* ---------- Typing Indicator ---------- */
.bw-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.85rem 1.25rem;
}

.bw-dot {
  width: 8px;
  height: 8px;
  background: #ced4da;
  border-radius: 50%;
  animation: bw-typing-bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes bw-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    background: #ced4da;
  }
  30% {
    transform: translateY(-6px);
    background: #1a3a8c;
  }
}

/* ---------- Suggestions ---------- */
.bw-chat-suggestions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.bw-suggestion-btn {
  background: #fff;
  border: 1px solid #e0e6f0;
  border-radius: 20px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  color: #1a3a8c;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.bw-suggestion-btn:hover {
  background: #1a3a8c;
  color: #fff;
  border-color: #1a3a8c;
}

/* ---------- Input Form ---------- */
.bw-chat-input-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e9ecef;
  flex-shrink: 0;
  background: #fff;
}

.bw-chat-input {
  flex: 1;
  border: 1px solid #e0e6f0;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
  color: #1a1a2e;
}

.bw-chat-input::placeholder {
  color: #adb5bd;
}

.bw-chat-input:focus {
  border-color: #1a3a8c;
  box-shadow: 0 0 0 3px rgba(26, 58, 140, 0.1);
}

.bw-chat-send {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, #1a3a8c, #1a6ecf);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.bw-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(26, 58, 140, 0.3);
}

.bw-chat-send svg {
  width: 18px;
  height: 18px;
}

/* ---------- Footer ---------- */
.bw-chat-footer {
  text-align: center;
  padding: 0.4rem;
  font-size: 0.65rem;
  color: #adb5bd;
  background: #fafbfc;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .bw-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .bw-chat-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 54px;
    height: 54px;
  }

  .bw-chat-toggle svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .bw-chat-panel {
    width: calc(100vw - 2rem);
    height: calc(100vh - 8rem);
  }
}
