/* ========== NURSE CHATBOT WIDGET ========== */

.chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary, #5E8E62);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 16px rgba(94, 142, 98, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(94, 142, 98, 0.45);
}

/* Shockwave pulse rings */
.chat-bubble::before,
.chat-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary, #5E8E62);
  opacity: 0;
  pointer-events: none;
}
.chat-bubble::before {
  animation: shockwave 2.5s ease-out infinite;
}
.chat-bubble::after {
  animation: shockwave 2.5s ease-out 1.25s infinite;
}
.chat-bubble.open::before,
.chat-bubble.open::after {
  animation: none;
  opacity: 0;
}
@keyframes shockwave {
  0% { transform: scale(1); opacity: 0.6; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}
.chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-bubble .chat-bubble-close {
  display: none;
}
.chat-bubble.open .chat-bubble-icon { display: none; }
.chat-bubble.open .chat-bubble-close { display: block; font-size: 1.5rem; line-height: 1; }

/* Unread badge */
.chat-bubble-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rose, #D4727A);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark, #FDF8F4);
}
.chat-bubble-badge.hidden { display: none; }

/* ========== CHAT WINDOW ========== */

.chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--bg-card, #fff);
  border-radius: var(--radius-lg, 20px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border, #E8DDD4);
}
.chat-window.open {
  display: flex;
  animation: chatSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.chat-header {
  background: var(--bg-darker, #F5EDE6);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border, #E8DDD4);
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary, #5E8E62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.chat-header-info {
  flex: 1;
}
.chat-header-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary, #2C2420);
}
.chat-header-status {
  font-size: 0.7rem;
  color: var(--primary, #5E8E62);
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #5E8E62);
  display: inline-block;
}
.chat-header-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #A09080);
  font-size: 1.2rem;
  padding: 4px;
  line-height: 1;
}

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

/* Message bubbles */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.55;
  word-wrap: break-word;
}
.chat-msg-bot {
  align-self: flex-start;
  background: var(--bg-darker, #F5EDE6);
  color: var(--text-primary, #2C2420);
  border-bottom-left-radius: 4px;
}
.chat-msg-user {
  align-self: flex-end;
  background: var(--primary, #5E8E62);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
  align-self: flex-start;
  padding: 12px 18px;
  background: var(--bg-darker, #F5EDE6);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: none;
  gap: 4px;
  align-items: center;
}
.chat-typing.visible { display: flex; }
.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #A09080);
  animation: chatTyping 1.4s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
.chat-typing-label {
  font-size: 0.7rem;
  color: var(--text-muted, #A09080);
  margin-left: 4px;
  font-style: italic;
}

@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #E8DDD4);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-card, #fff);
}
.chat-input {
  flex: 1;
  border: 1px solid var(--border, #E8DDD4);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  color: var(--text-primary, #2C2420);
  background: var(--bg-dark, #FDF8F4);
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus {
  border-color: var(--primary, #5E8E62);
}
.chat-input::placeholder {
  color: var(--text-muted, #A09080);
}
.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #5E8E62);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send:hover {
  background: var(--primary-dark, #4A7350);
}
.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chat-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Disclaimer */
.chat-disclaimer {
  padding: 6px 16px 8px;
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-muted, #A09080);
  line-height: 1.4;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border-light, #F0E6DD);
  flex-shrink: 0;
}

/* ========== MOBILE RESPONSIVE ========== */

@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100dvh;
  }
  .chat-bubble {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
  .chat-bubble svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  .chat-window {
    height: 100%;
  }
}

/* ========== DID YOU KNOW PREVIEW BUBBLE ========== */
.chat-preview-bubble {
  position: fixed;
  bottom: 96px;
  right: 24px;
  max-width: 280px;
  background: #fff;
  border: 1px solid var(--border, #E8DDD4);
  border-radius: 16px 16px 4px 16px;
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  cursor: pointer;
}
.chat-preview-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.chat-preview-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary, #5E8E62);
  margin-bottom: 6px;
}
.chat-preview-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary, #2C2420);
  margin: 0;
}
.chat-preview-text strong {
  color: var(--primary, #5E8E62);
  font-weight: 700;
}
@media (max-width: 480px) {
  .chat-preview-bubble {
    right: 16px;
    bottom: 88px;
    max-width: 240px;
    padding: 12px 14px;
  }
}
