@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

#rm-widget-iframe {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 600px;
  height: 400px;
  border: none;
  visibility: hidden;
  opacity: 0;
  transform: scale(0);
  transform-origin: var(--origin-x, 100%) var(--origin-y, 100%);
  transition: none;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 9998;
  will-change: transform, opacity;
  contain: strict;
}

#rm-widget-iframe.opening {
  visibility: visible;
  animation: iframe-open 0.48s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes iframe-open {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  60% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#rm-widget-iframe.open {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

#rm-widget-iframe.closing {
  animation: iframe-close 0.48s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes iframe-close {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  40% {
    opacity: 0.4;
    transform: scale(0.6);
  }
  70% {
    opacity: 0.1;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(0);
    visibility: hidden;
  }
}

#rm-widget-toggle {
  position: fixed;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
  padding: 0;
  overflow: hidden;
  will-change: transform;
  contain: layout style;
}

#rm-widget-toggle:hover {
  transform: scale(1.05);
}

#rm-widget-toggle img[style*="scaleX(-1)"] {
  transform: scaleX(-1);
  transition: transform 0.3s ease;
}

#rm-widget-toggle:hover img[style*="scaleX(-1)"] {
  transform: scaleX(-1) scale(1.05);
}

#rm-widget-toggle.show {
  display: block;
  animation: button-appear 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes button-appear {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#rm-widget-toggle.dragging {
  transition: none;
  transform: scale(1.1);
}

#rm-widget-toggle.swipe-animating {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#rm-widget-toggle img {
  object-position: center;
  pointer-events: none;
  display: block;
  margin: 0;
  padding: 0;
  height: 76px;
  width: 76px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#rm-widget-toggle.bg-variant {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#rm-widget-toggle.bg-variant img {
  display: none;
}

#rm-greeting-widget {
  position: fixed;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transform-origin: var(--origin-x, 100%) var(--origin-y, 100%);
  transition: none;
  display: flex;
  justify-content: center;
  width: 100%;
  will-change: transform, opacity;
  contain: layout style;
}

#rm-greeting-widget.appearing {
  visibility: visible;
  animation: widget-appear 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes widget-appear {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  60% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#rm-greeting-widget.hiding {
  animation: widget-hide 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes widget-hide {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  40% {
    opacity: 0.4;
    transform: scale(0.6);
  }
  70% {
    opacity: 0.1;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(0);
    visibility: hidden;
  }
}

#rm-greeting-widget.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0);
}

.plain-text {
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 24px;
}

@media (max-width: 768px) {
  .plain-text {
    font-size: 14px;
    line-height: 20px;
  }
}

.rm-widget {
  display: flex;
  align-items: flex-end;
  background: linear-gradient(183deg, #1F6FE8 20.95%, #7996F0 134.42%), #D2DFFB;
  border-radius: 24px;
  padding: 16px 16px 20px 16px;
  width: 572px;
  height: 172px;
  position: relative;
  box-shadow: -8px 4px 50px 0 rgba(44, 123, 240, 0.48), 0 -12px 24px 0 rgba(121, 134, 167, 0.25);
  box-sizing: border-box;
  font-family: 'Lato', sans-serif;
}

.rm-widget-img {
  flex: 0 0 110px;
  min-width: 110px;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rm-robot-image {
  width: 128px;
  height: 128px;
  max-width: unset;
}

.rm-widget-content {
  flex: 1;
  position: relative;
  padding-left: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rm-widget-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(19, 92, 202, 1);
  z-index: 2;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: unset;
  min-height: unset;
  padding: 4px;
}

.rm-widget-close svg {
  width: 12px;
  height: 12px;
}

.rm-widget-close:hover {
  opacity: 0.8;
  transform: rotate(90deg);
}

.rm-widget-title {
  color: #fff;
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
}

.rm-widget-text {
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.8;
}

.rm-widget-buttons {
  display: flex;
  margin-top: 4px;
  gap: 8px;
}

.rm-widget-btn {
  max-width: max-content;
  background: rgba(255, 255, 255, 0.15);
  color: rgb(255, 255, 255);
  border-radius: 4px 32px 32px 24px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: unset;
  min-height: unset;
  border: none;
}

.rm-widget-btn.main {
  background: linear-gradient(305deg, #1D5DEB -37.02%, #1349BE 51.26%);
}

.rm-widget-btn:not(.main) {
  background: rgba(13, 76, 211, 0.55);
}

.rm-widget-btn:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.rm-widget-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  #rm-widget-toggle {
    touch-action: none;
    cursor: grab;
  }

  #rm-widget-toggle img {
    width: 80px;
    height: 80px;
  }

  #rm-widget-toggle:active {
    cursor: grabbing;
  }

  .rm-widget {
    min-width: 386px;
    width: 386px;
    height: 140px;
    padding: 12px;
    border-radius: 20px;
    right: 0;
  }

  .rm-widget-img {
    flex: 0 0 80px;
    min-width: 80px;
    height: 100px;
  }

  .rm-robot-image {
    width: 100px;
    height: 100px;
  }

  .rm-widget-content {
    padding-left: 12px;
  }

  .rm-widget-close {
    width: 20px;
    height: 20px;
    top: 12px;
    right: 12px;
    padding: 3px;
  }

  .rm-widget-close svg {
    width: 10px;
    height: 10px;
  }

  .rm-widget-title {
    font-size: 20px;
    line-height: 24px;
  }

  .rm-widget-btn {
    padding: 6px 12px;
    border-radius: 4px 20px 20px 20px;
    flex: 1;
    font-weight: 400;
    height: 32px;
  }

  .rm-widget-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
  }
}

@media (min-width: 769px) {
  .rm-greeting-widget[data-position*="middle-"] {
    transform-origin: center;
  }
}


@media (prefers-reduced-motion: reduce) {
  #rm-widget-iframe,
  #rm-greeting-widget,
  #rm-widget-toggle {
    animation: none !important;
    transition: none !important;
  }

  #rm-widget-iframe.opening,
  #rm-widget-iframe.open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  #rm-greeting-widget.appearing,
  #rm-greeting-widget:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  #rm-widget-toggle.show {
    opacity: 1;
    transform: none;
  }
}
