.fbma-chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.fbma-chatbot,
.fbma-chatbot * {
  box-sizing: border-box;
}

html[dir="rtl"] .fbma-chatbot {
  right: auto;
  left: 24px;
}

.fbma-chatbot-toggle {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #f06434;
  color: #fff;
  box-shadow: 0 10px 26px rgba(240, 100, 52, 0.35);
  cursor: pointer;
  font-size: 24px;
  margin-left: auto;
}

.fbma-chatbot-panel {
  width: clamp(340px, 30vw, 430px);
  height: min(640px, calc(100vh - 120px));
  max-height: calc(100vh - 120px);
  margin-bottom: 12px;
  background: #f9fbfd;
  border: 1px solid #d7deea;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(18, 34, 67, 0.2);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.fbma-chatbot-panel.is-open {
  display: flex;
}

.fbma-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(120deg, #121d34 0%, #202e4f 100%);
  color: #fff;
  padding: 20px;
}

.fbma-chatbot-header h3 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  color: #fff;
  font-weight: 600;
}

.fbma-chatbot-close {
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.fbma-chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.fbma-chatbot-quick {
  border: 1px solid #d7deea;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  margin-bottom: 12px;
}

.fbma-chatbot-quick h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #51607a;
}

.fbma-chatbot-quick p {
  margin: 0 0 12px;
  color: #6a7690;
  font-size: 0.95rem;
}

.fbma-chatbot-q {
  display: block;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #d7deea;
  background: #f9fbfd;
  color: #2f3a51;
  border-radius: 999px;
  padding: 10px 14px;
  margin: 0 0 10px;
  cursor: pointer;
  text-align: start;
}

.fbma-chatbot-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fbma-chatbot-message {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.45;
  font-size: 1rem;
  word-break: break-word;
}

.fbma-chatbot-message.user {
  align-self: flex-end;
  background: #f06434;
  color: #fff;
}

html[dir="rtl"] .fbma-chatbot-message.user {
  align-self: flex-start;
}

.fbma-chatbot-message.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #d7deea;
  color: #2f3a51;
}

html[dir="rtl"] .fbma-chatbot-message.bot {
  align-self: flex-end;
}

.fbma-chatbot-message .fbma-chatbot-wa-link {
  color: #fff;
  background: #25d366;
  padding: 8px 14px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

.fbma-chatbot-message:has(.fbma-chatbot-map) {
  width: 100%;
  max-width: 100%;
}

.fbma-chatbot-map iframe {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: 8px;
}

.fbma-chatbot-map a {
  display: inline-block;
  margin-top: 8px;
  color: #f06434;
  font-weight: 600;
}

.fbma-chatbot-message .fbma-chatbot-page-link {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  background: #f06434;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.fbma-chatbot-footer {
  border-top: 1px solid #d7deea;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
}

.fbma-chatbot-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d7deea;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font-size: 1rem;
}

.fbma-chatbot-send {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: #f06434;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
}

@media (max-width: 1366px) and (min-width: 1025px) {
  .fbma-chatbot-panel {
    width: 400px;
    height: min(610px, calc(100vh - 112px));
  }
}

@media (max-width: 1024px) and (min-width: 641px) {
  .fbma-chatbot {
    right: 16px;
    bottom: 16px;
  }

  html[dir="rtl"] .fbma-chatbot {
    left: 16px;
  }

  .fbma-chatbot-panel {
    width: min(380px, calc(100vw - 24px));
    height: min(590px, calc(100vh - 100px));
  }
}

@media (max-width: 640px) {
  .fbma-chatbot {
    right: 12px;
    bottom: 12px;
  }

  html[dir="rtl"] .fbma-chatbot {
    left: 12px;
  }

  .fbma-chatbot-panel {
    width: calc(100vw - 24px);
    height: min(620px, calc(100vh - 94px));
    max-height: calc(100vh - 94px);
  }

  .fbma-chatbot-header {
    padding: 14px 16px;
  }

  .fbma-chatbot-header h3 {
    font-size: 1rem;
  }
}
