.salam-chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* When the chatbot is open on small screens, prevent the page from scrolling. */
@media (max-width: 640px) {
  body.salam-chatbot-open {
    overflow: hidden;
    touch-action: none;
  }
  /* Dark overlay underneath the chatbot when open on mobile */
  body.salam-chatbot-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    pointer-events: auto;
    transition: opacity 0.18s ease;
    opacity: 1;
  }
}

.salam-chatbot *,
.salam-chatbot *::before,
.salam-chatbot *::after {
  box-sizing: border-box;
}

.salam-chatbot__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  box-shadow: 0 20px 40px rgba(15, 118, 110, 0.28);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.salam-chatbot__launcher:hover,
.salam-chatbot__launcher:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 24px 44px rgba(15, 118, 110, 0.34);
}

.salam-chatbot__launcher-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
}

.salam-chatbot--rtl {
  direction: rtl;
}

.salam-chatbot__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.2), transparent 35%),
    linear-gradient(180deg, #f7fffd, #ffffff 22%);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

/* Coach-mark / invitation popup (all screens) */
.salam-chatbot-coachmark {
  position: fixed;
  z-index: 10001;
  max-width: 320px;
  width: 320px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 12px 14px 14px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  pointer-events: auto;
  transform-origin: center bottom;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  font-size: 14px;
}

.salam-chatbot-coachmark.salam-chatbot-coachmark--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.salam-chatbot-coachmark__content {
  flex: 1 1 auto;
}

.salam-chatbot-coachmark__title {
  margin: 0 0 6px 0;
  font-weight: 700;
  font-size: 15px;
}

.salam-chatbot-coachmark__desc {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.3;
}

.salam-chatbot-coachmark__cta {
  margin-top: 12px;
  display: inline-block;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px !important;
}

.salam-chatbot-coachmark__close {
  background: transparent;
  border: 0;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  padding: 6px;
  cursor: pointer;
  margin-left: 8px;
}

.salam-chatbot-coachmark__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  left: 50%;
  bottom: -6px;
  margin-left: -6px;
  border-radius: 2px;
}

@keyframes salam-coach-float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
  100% {
    transform: translateY(0);
  }
}

.salam-chatbot-coachmark.salam-chatbot-coachmark--visible {
  animation: salam-coach-float 3.6s ease-in-out infinite;
}

.salam-chatbot__panel[hidden] {
  display: none !important;
}

.salam-chatbot__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.salam-chatbot__eyebrow {
  margin: 0 0 4px;
  color: #0f766e;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.salam-chatbot__title {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 500;
}

.salam-chatbot__subtitle {
  margin: 8px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

.salam-chatbot__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.salam-chatbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  background: transparent;
}

.salam-chatbot__status {
  padding: 4px 18px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.salam-chatbot__status-copy {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.salam-chatbot__status-label,
.salam-chatbot__status-text {
  margin: 0;
}

.salam-chatbot__status-label {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.salam-chatbot__status-text {
  color: #64748b;
  font-size: 12px;
}

.salam-chatbot__progress {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
}

.salam-chatbot__progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
  transition: width 0.28s ease;
}

.salam-chatbot__message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.salam-chatbot__message--user {
  justify-content: flex-end;
}

.salam-chatbot__avatar {
  display: inline-grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.salam-chatbot__avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.salam-chatbot__message--user .salam-chatbot__avatar {
  order: 2;
  background: #1d4ed8;
}

.salam-chatbot__bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 18px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.salam-chatbot__message--user .salam-chatbot__bubble {
  background: #0f766e;
  color: #fff;
}

.salam-chatbot__bubble--typing {
  color: #64748b;
  font-style: italic;
}

.salam-chatbot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 18px 16px;
}

.salam-chatbot__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px 18px 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.salam-chatbot__form[hidden] {
  display: none !important;
}

.salam-chatbot__input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
}

.salam-chatbot--rtl .salam-chatbot__launcher {
  flex-direction: row-reverse;
}

.salam-chatbot--rtl .salam-chatbot__header,
.salam-chatbot--rtl .salam-chatbot__status,
.salam-chatbot--rtl .salam-chatbot__messages,
.salam-chatbot--rtl .salam-chatbot__form,
.salam-chatbot--rtl .salam-chatbot__input,
.salam-chatbot--rtl .salam-chatbot__bubble,
.salam-chatbot--rtl .salam-chatbot__title,
.salam-chatbot--rtl .salam-chatbot__subtitle,
.salam-chatbot--rtl .salam-chatbot__eyebrow {
  text-align: right;
}

.salam-chatbot--rtl .salam-chatbot__header {
  flex-direction: row-reverse;
}

.salam-chatbot--rtl .salam-chatbot__status-copy {
  flex-direction: row-reverse;
}

.salam-chatbot--rtl .salam-chatbot__message {
  flex-direction: row-reverse;
}

.salam-chatbot--rtl .salam-chatbot__message--user {
  justify-content: flex-start;
}

.salam-chatbot--rtl .salam-chatbot__message--user .salam-chatbot__avatar {
  order: 0;
}

.salam-chatbot--rtl .salam-chatbot__form {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
}

.salam-chatbot--rtl .salam-chatbot__input {
  direction: rtl;
}

.salam-chatbot__action {
  flex: 1 1 calc(50% - 10px);
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 12px;
  padding: 4px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-size: 14px !important;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.salam-chatbot__action--primary {
  flex-basis: 100%;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  border-color: transparent;
  font-size: 15px !important;
}

.salam-chatbot__action:hover,
.salam-chatbot__action:focus-visible {
  outline: none;
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.16);
}

.salam-chatbot__send {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.salam-chatbot__close:hover,
.salam-chatbot__close:focus-visible,
.salam-chatbot__action:hover,
.salam-chatbot__action:focus-visible,
.salam-chatbot__send:hover,
.salam-chatbot__send:focus-visible,
.salam-chatbot__input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

@media (max-width: 640px) {
  .salam-chatbot {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .salam-chatbot__launcher {
    margin-left: auto;
  }

  .salam-chatbot__launcher-text {
    display: none;
  }

  .salam-chatbot__panel {
    width: min(100%, 420px);
    height: min(100dvh, 600px);
  }

  /*.salam-chatbot__action {
    flex-basis: 100%;
  }*/

  /* Coach-mark / invitation popup */
  .salam-chatbot-coachmark {
    position: fixed;
    z-index: 10001;
    max-width: 320px;
    width: 92%;
    background: #ffffff;
    color: #0f172a;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    padding: 12px 14px 14px 14px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    pointer-events: auto;
    transform-origin: center bottom;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition:
      opacity 220ms ease,
      transform 220ms ease;
    font-size: 14px;
  }

  .salam-chatbot-coachmark.salam-chatbot-coachmark--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  .salam-chatbot-coachmark__content {
    flex: 1 1 auto;
  }

  .salam-chatbot-coachmark__title {
    margin: 0 0 6px 0;
    font-weight: 700;
    font-size: 16px;
  }

  .salam-chatbot-coachmark__desc {
    margin: 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.3;
  }

  .salam-chatbot-coachmark__cta {
    margin-top: 8px;
    display: inline-block;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
  }

  .salam-chatbot-coachmark__close {
    background: transparent;
    border: 0;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    margin-left: 8px;
  }

  .salam-chatbot-coachmark__arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    left: 50%;
    bottom: -6px;
    margin-left: -6px;
    border-radius: 2px;
  }

  /* gentle float animation */
  @keyframes salam-coach-float {
    0% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-6px);
    }
    100% {
      transform: translateY(0);
    }
  }

  .salam-chatbot-coachmark.salam-chatbot-coachmark--visible {
    animation: salam-coach-float 3.6s ease-in-out infinite;
  }
}
