#r1-chat-wrapper {
  position: fixed;
  bottom: 90px;
  right: 20px;
  top: auto;
  left: auto;
  z-index: 999999;
}

#r1-chat-wrapper.is-left {
  left: 20px;
  right: auto;
}

#r1-chat-wrapper.is-right {
  right: 20px;
  left: auto;
}

html[dir="rtl"] #r1-chat-wrapper {
  right: auto;
  left: 20px;
}

#r1-chat-wrapper,
#r1-chat-wrapper *,
#r1-chat-wrapper *::before,
#r1-chat-wrapper *::after,
.r1-chat-shortcode,
.r1-chat-shortcode *,
.r1-chat-shortcode *::before,
.r1-chat-shortcode *::after {
  box-sizing: border-box;
}

.r1-chat-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.r1-chat-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.r1-chat-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.r1-chat-item {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: var(--r1-chat-button-radius, 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  overflow: hidden;
  position: relative;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  vertical-align: middle;
  line-height: 1;
  flex: 0 0 auto;
}

.r1-chat-item:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.r1-chat-item:focus {
  outline: none;
}

.r1-chat-item:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.r1-chat-menu .r1-chat-item,
.r1-chat-shortcode .r1-chat-item {
  background: var(--r1-chat-social-icon-bg-color, #1f2937);
  color: var(--r1-chat-social-icon-color, #ffffff);
}

.r1-chat-menu .r1-chat-item:hover,
.r1-chat-shortcode .r1-chat-item:hover {
  background: var(--r1-chat-social-icon-bg-hover-color, #111827);
  color: var(--r1-chat-social-icon-hover-color, #ffffff);
}

.r1-chat-main {
  background: var(--r1-chat-main-button-bg-color, #2563eb);
  color: var(--r1-chat-main-button-icon-color, #ffffff);
}

.r1-chat-main:hover {
  background: var(--r1-chat-main-button-bg-hover-color, #1d4ed8);
  color: var(--r1-chat-main-button-icon-color, #ffffff);
}

.r1-chat-main.has-pulse {
  animation: mfb-pulse 2s infinite;
}

@keyframes mfb-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.r1-chat-icon {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-image: var(--r1-chat-icon-url);
  mask-image: var(--r1-chat-icon-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.r1-chat-main-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.r1-chat-main-icon-chat .r1-chat-icon {
  width: 24px;
  height: 24px;
  background-color: currentColor;
}

.r1-chat-main-icon-close {
  display: none;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  color: currentColor;
}

.r1-chat-main.is-open .r1-chat-main-icon-chat {
  display: none;
}

.r1-chat-main.is-open .r1-chat-main-icon-close {
  display: flex;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Shortcode layout */
.r1-chat-shortcode,
.r1-chat-shortcode-horizontal {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 10px !important;
  gap: 12px !important;
  row-gap: 12px !important;
  column-gap: 12px !important;
  flex-wrap: nowrap !important;
  width: auto !important;
  max-width: 100%;
  vertical-align: middle;
}

.r1-chat-shortcode .r1-chat-item, .r1-chat-shortcode-horizontal .r1-chat-item {
  box-shadow: none !important;
}

.r1-chat-shortcode-vertical {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  row-gap: 12px !important;
  column-gap: 12px !important;
  flex-wrap: nowrap !important;
  width: auto !important;
  max-width: 100%;
}

.r1-chat-shortcode .r1-chat-item,
.r1-chat-shortcode-horizontal .r1-chat-item,
.r1-chat-shortcode-vertical .r1-chat-item {
  flex: 0 0 auto !important;
  display: inline-flex !important;
}

/* Fix when theme wraps shortcode output */
.r1-chat-shortcode > strong,
.r1-chat-shortcode-horizontal > strong {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  row-gap: 12px !important;
  column-gap: 12px !important;
  flex-wrap: nowrap !important;
  font-weight: inherit !important;
}

.r1-chat-shortcode-vertical > strong {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  row-gap: 12px !important;
  column-gap: 12px !important;
  flex-wrap: nowrap !important;
  font-weight: inherit !important;
}

.r1-chat-shortcode strong .r1-chat-item,
.r1-chat-shortcode-horizontal strong .r1-chat-item,
.r1-chat-shortcode-vertical strong .r1-chat-item {
  display: inline-flex !important;
  flex: 0 0 auto !important;
}

/* Extra theme conflict protection */
.r1-chat-shortcode a.r1-chat-item,
.r1-chat-shortcode-horizontal a.r1-chat-item,
.r1-chat-shortcode-vertical a.r1-chat-item {
  float: none !important;
  clear: none !important;
  max-width: none !important;
  margin: 0 !important;
}

.r1-chat-shortcode p,
.r1-chat-shortcode-horizontal p,
.r1-chat-shortcode-vertical p,
.r1-chat-shortcode div,
.r1-chat-shortcode-horizontal div,
.r1-chat-shortcode-vertical div {
  margin: 0;
}

@media (max-width: 768px) {
  #r1-chat-wrapper {
    bottom: 72px;
  }

  .r1-chat-item {
    width: 50px;
    height: 50px;
  }

  .r1-chat-icon,
  .r1-chat-main-icon-chat .r1-chat-icon {
    width: 22px;
    height: 22px;
  }

  .r1-chat-main-icon-close {
    font-size: 26px;
  }

  .r1-chat-menu {
    gap: 10px;
  }

  .r1-chat-column {
    gap: 10px;
  }

  .r1-chat-shortcode,
  .r1-chat-shortcode-horizontal,
  .r1-chat-shortcode > strong,
  .r1-chat-shortcode-horizontal > strong {
    gap: 10px !important;
    row-gap: 10px !important;
    column-gap: 10px !important;
  }

  .r1-chat-shortcode-vertical,
  .r1-chat-shortcode-vertical > strong {
    gap: 10px !important;
    row-gap: 10px !important;
    column-gap: 10px !important;
  }
}