/* Floating bubble button */
.fmde-bubble-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.fmde-bubble-btn:hover {
  opacity: 0.9;
}

/* Chat panel container */
.fmde-panel {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 380px;
  max-width: 100%;
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.38);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.fmde-panel.fmde-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Mobile: full screen */
@media (max-width: 768px) {
  .fmde-panel {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .fmde-bubble-btn {
    bottom: 20px;
    right: 20px;
  }
}

/* Header */
.fmde-header {
  flex: 0 0 auto;
  padding: 10px 12px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fmde-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fmde-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.fmde-header-text-main {
  font-size: 15px;
  font-weight: 600;
}

.fmde-header-text-sub {
  font-size: 12px;
  opacity: 0.85;
}

.fmde-header-close {
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.fmde-header-close:hover {
  color: #ffffff;
}

/* Messages area */
.fmde-body {
  flex: 1 1 auto;
  padding: 10px 10px 8px;
  background: #f3f4f6;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.fmde-msg {
  display: flex;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.fmde-msg-assistant {
  justify-content: flex-start;
}

.fmde-msg-user {
  justify-content: flex-end;
}

.fmde-msg-bubble {
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  background: #ffffff;
  color: #111827;
  white-space: pre-wrap;
}

.fmde-msg-assistant .fmde-msg-bubble {
  border-bottom-left-radius: 4px;
  background: #ffffff;
}

.fmde-msg-user .fmde-msg-bubble {
  border-bottom-right-radius: 4px;
  background: #2563eb;
  color: #ffffff;
}

/* Initial language choice block */
.fmde-lang-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.fmde-lang-title {
  font-weight: 600;
  font-size: 13px;
}

.fmde-lang-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fmde-lang-btn {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 5px 10px;
  font-size: 12px;
  background: #ffffff;
  cursor: pointer;
  color: #111827;        /* ✅ text now dark, readable */
  font-weight: 500;      /* optional: thoda bold for clarity */
}

.fmde-lang-btn:hover {
  background: #e5e7eb;
}

/* Composer */
.fmde-footer {
  flex: 0 0 auto;
  padding: 8px 10px 9px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.fmde-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.fmde-input {
  flex: 1 1 auto;
  min-height: 34px;
  max-height: 100px;
  resize: none;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
}

.fmde-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.fmde-send-btn {
  flex: 0 0 auto;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.fmde-send-btn:hover {
  opacity: 0.9;
}

/* Typing indicator */
.fmde-typing {
  display: inline-block;
  min-width: 18px;
}
.fmde-typing span {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 1px;
  border-radius: 999px;
  background: #9ca3af;
  animation: fmde-bounce 1s infinite ease-in-out;
}
.fmde-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.fmde-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes fmde-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

