:root {
  --mp-brand: #25a79a;
  --mp-brand-dark: #1d857a;
  --mp-text: #555;
  --mp-shadow: rgba(0, 0, 0, 0.2);
  --mp-border: #ddd;
  --mp-radius: 10px;
  --mp-transition: 0.2s ease;
}

#medipill-chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background-color: var(--mp-brand);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--mp-shadow);
  z-index: 8000;
}

#medipill-chat-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  max-height: 500px;
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  box-shadow: 0 8px 24px var(--mp-shadow);
  font-family: sans-serif;
  z-index: 8000;
  overflow: hidden;
}

#medipill-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  height: 48px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  z-index: 20;
}

#medipill-chat-header img {
  height: 28px;
  object-fit: contain;
}

#medipill-chat-header span {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--mp-brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#medipill-chat-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--mp-transition);
}

#medipill-chat-close:hover {
  color: #333;
}

#medipill-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
}

#medipill-chat-messages h3,
#medipill-chat-messages h4 {
  margin: 10px 0;
}

.chat-bubble {
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  max-width: 85%;
  clear: both;
  line-height: 1.45;
}

.user-bubble {
  margin-left: auto;
  background-color: #e0f7f5;
}

.bot-bubble {
  margin-right: auto;
  background-color: #f3f3f3;
}

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

#medipill-chat-input-area {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-top: 1px solid #eee;
}

#medipill-chat-input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
}

#medipill-chat-send {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: var(--mp-brand);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background-color var(--mp-transition);
}

#medipill-chat-send:hover,
#medipill-chat-launcher:hover {
  background: var(--mp-brand-dark);
}

#chat-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  z-index: 15;
  padding: 16px;
  text-align: center;
}

.chat-option-button {
  margin: 10px;
  padding: 10px 14px;
  border: none;
  border-radius: 5px;
  background-color: #0078d4;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--mp-transition);
}

.chat-option-button:hover {
  background-color: #005fa3;
}

.travel-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  padding: 8px;
  border-radius: 4px;
  border-left: 5px solid #fbc02d;
  background-color: #fff8e1;
  color: #5d4037;
  font-weight: 500;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
}

.travel-alert::before {
  content: "⚠️";
  font-size: 1.2rem;
}

.mp-book {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--mp-brand);
  color: #fff;
  cursor: pointer;
}

.mp-list {
  padding-inline-start: 16px;
}

.typing-indicator {
  display: none;
  position: relative;
  align-items: center;
  gap: 6px;
  height: 24px;
  margin: 0 16px 16px;
  color: var(--mp-text);
}

.typing-indicator.is-active {
  display: flex;
}

.typing-indicator .dots-container,
.typing-indicator .thinking-text {
  animation-play-state: paused;
}

.typing-indicator.is-active .dots-container,
.typing-indicator.is-active .thinking-text {
  animation-play-state: running;
}

.dots-container {
  display: flex;
  align-items: center;
  gap: 4px;
  animation: dot-visibility 9s linear infinite;
}

.dots-container span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mp-text);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.dots-container span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots-container span:nth-child(3) {
  animation-delay: 0.4s;
}

.thinking-text {
  position: absolute;
  left: 0px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  animation: thinking-visibility 9s linear infinite, shimmer 1.5s ease-in-out infinite;
  animation-delay: 0s, 3s;
}

@keyframes dot-bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dot-visibility {
  0%,
  33% {
    opacity: 1;
  }
  34%,
  100% {
    opacity: 0;
  }
}

@keyframes thinking-visibility {
  0%,
  33% {
    opacity: 0;
  }
  34%,
  98% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes shimmer {
  0%,
  100% {
    color: var(--mp-text);
  }
  50% {
    color: #000;
  }
}