/* Onicon callback: центрируем по классам самого виджета (каталог). */

#onicon .onc-callback:not(.onc-callback--stage-form):not(.onc-callback--stage-spinner):not(.tph-onc-open),
#onicon .onc-callback.tph-onc-closed {
  pointer-events: none !important;
}

#onicon .onc-callback.tph-onc-closed,
#onicon .onc-callback.tph-onc-closed.onc-callback--stage-form,
#onicon .onc-callback.tph-onc-closed.onc-callback--stage-spinner,
#onicon .onc-callback.tph-onc-closed.tph-onc-open {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#onicon .onc-callback__close {
  z-index: 2147483646 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

#onicon .onc-callback.onc-callback--stage-form:not(.tph-onc-closed),
#onicon .onc-callback.onc-callback--stage-spinner:not(.tph-onc-closed),
#onicon .onc-callback.tph-onc-open:not(.tph-onc-closed) {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.45) !important;
  z-index: 2147483640 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
}

#onicon .onc-callback.onc-callback--stage-form:not(.tph-onc-closed) .onc-callback__body,
#onicon .onc-callback.onc-callback--stage-spinner:not(.tph-onc-closed) .onc-callback__body,
#onicon .onc-callback.tph-onc-open:not(.tph-onc-closed) .onc-callback__body {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  margin: 0 auto !important;
  transform: none !important;
  width: auto !important;
  height: auto !important;
  max-width: min(720px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - 32px) !important;
  align-self: center !important;
  box-sizing: border-box !important;
  pointer-events: auto !important;
}

#onicon .onc-callback.onc-callback--stage-form:not(.tph-onc-closed),
#onicon .onc-callback.onc-callback--stage-form:not(.tph-onc-closed) *,
#onicon .onc-callback.onc-callback--stage-spinner:not(.tph-onc-closed),
#onicon .onc-callback.onc-callback--stage-spinner:not(.tph-onc-closed) *,
#onicon .onc-callback.tph-onc-open:not(.tph-onc-closed),
#onicon .onc-callback.tph-onc-open:not(.tph-onc-closed) * {
  pointer-events: auto !important;
}

@media (max-width: 768px) {
  #onicon .onc-callback.onc-callback--stage-form,
  #onicon .onc-callback.onc-callback--stage-spinner,
  #onicon .onc-callback.tph-onc-open {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 12px 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #onicon .onc-callback.onc-callback--stage-form .onc-callback__body,
  #onicon .onc-callback.onc-callback--stage-spinner .onc-callback__body,
  #onicon .onc-callback.tph-onc-open .onc-callback__body {
    max-width: 100% !important;
    width: 100% !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px !important;
  }

  #onicon .onc-callback.onc-callback--stage-form .onc-callback__columns,
  #onicon .onc-callback.tph-onc-open .onc-callback__columns {
    flex-direction: column !important;
  }

  #onicon .onc-callback.onc-callback--stage-form .onc-callback__empty,
  #onicon .onc-callback.tph-onc-open .onc-callback__empty {
    display: none !important;
  }

  #onicon .onc-callback.onc-callback--stage-form .onc-callback__bg-image,
  #onicon .onc-callback.tph-onc-open .onc-callback__bg-image {
    display: none !important;
    min-height: 0 !important;
  }

  #onicon .onc-callback.onc-callback--stage-form .onc-callback__content,
  #onicon .onc-callback.onc-callback--stage-form .onc-callback__form,
  #onicon .onc-callback.tph-onc-open .onc-callback__content,
  #onicon .onc-callback.tph-onc-open .onc-callback__form {
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  #onicon .onc-callback.onc-callback--stage-form textarea,
  #onicon .onc-callback.tph-onc-open textarea {
    min-height: 56px !important;
    max-height: 88px !important;
  }

  #onicon .onc-callback.onc-callback--stage-form button[type="submit"],
  #onicon .onc-callback.onc-callback--stage-form input[type="submit"],
  #onicon .onc-callback.onc-callback--stage-form .onc-callback__form button,
  #onicon .onc-callback.tph-onc-open button[type="submit"],
  #onicon .onc-callback.tph-onc-open input[type="submit"],
  #onicon .onc-callback.tph-onc-open .onc-callback__form button {
    position: sticky !important;
    bottom: 0 !important;
    margin-top: 8px !important;
    z-index: 3 !important;
  }

  #onicon input,
  #onicon textarea,
  #onicon select {
    font-size: 16px !important;
  }

  .onicon-chat-popup:not([style*="visibility: hidden"]):not([style*="visibility:hidden"]) {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px) !important;
    inset: auto 8px calc(8px + env(safe-area-inset-bottom, 0px)) 8px !important;
    top: auto !important;
  }

  .onicon-chat-popup__scrollable-wrapp {
    max-height: calc(100dvh - 280px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

#onicon .onicon-button-callback {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  overflow: visible !important;
  border-radius: 50% !important;
  z-index: 2147481995 !important;
}

#onicon .onicon-button-callback__animated {
  max-width: 52px !important;
  max-height: 52px !important;
  pointer-events: none !important;
}

#onicon .onicon-button,
#onicon .onicon-chat-button {
  max-width: calc(100vw - 24px) !important;
  z-index: 2147481995 !important;
}

#onicon {
  pointer-events: none !important;
}

#onicon .onicon-button,
#onicon .onicon-button-callback,
#onicon .onicon-chat-button,
#onicon .onicon-chat-popup:not([style*="visibility: hidden"]):not([style*="visibility:hidden"]),
#onicon .onicon-menu__overlay:not([style*="display: none"]):not([style*="display:none"]),
#onicon .onc-callback.onc-callback--stage-form:not(.tph-onc-closed),
#onicon .onc-callback.onc-callback--stage-spinner:not(.tph-onc-closed),
#onicon .onc-callback.tph-onc-open:not(.tph-onc-closed) {
  pointer-events: auto !important;
}

#onicon .onicon-chat-popup[style*="visibility: hidden"],
#onicon .onicon-chat-popup[style*="visibility:hidden"],
#onicon .onicon-menu__overlay[style*="display: none"],
#onicon .onicon-menu__overlay[style*="display:none"],
#onicon .onicon-menu__overlay[style*="opacity: 0"],
#onicon .onicon-menu__overlay[style*="opacity:0"] {
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .onicon-button-callback {
    left: auto !important;
    right: 12px !important;
    top: auto !important;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px) + var(--tph-dock-lift, 0px) + var(--tph-bottomnav-h, 0px)) !important;
    transition: bottom .45s cubic-bezier(.22, 1, .36, 1) !important;
  }

  #onicon .onc-callback__columns {
    flex-direction: column !important;
  }
  #onicon .onc-callback__empty {
    display: none !important;
  }
  #onicon .onc-callback__content {
    width: 100% !important;
  }

  .onicon-button,
  .onicon-chat-button {
    right: 10px !important;
    left: auto !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--tph-dock-lift, 0px) + var(--tph-bottomnav-h, 0px)) !important;
    max-width: calc(100vw - 20px) !important;
    transition: bottom .45s cubic-bezier(.22, 1, .36, 1) !important;
  }
  body.tph-has-selbar .onicon-button__title {
    display: none !important;
  }
  .onicon-button__title {
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  #onicon input,
  #onicon textarea,
  #onicon select,
  .onicon-textarea {
    font-size: 16px !important;
  }

  .onicon-chat-popup {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    height: auto !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px) !important;
    inset: auto 8px calc(8px + env(safe-area-inset-bottom, 0px)) 8px !important;
    top: auto !important;
    border-radius: 14px !important;
  }
  .onicon-chat-popup__main {
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 48px) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .onicon-chat-popup__scroll-hidden,
  .onicon-chat-popup .onicon-js-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
  }
  .onicon-chat-popup__scrollable-wrapp {
    max-height: calc(100dvh - 280px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .onicon-chat-popup__bar {
    display: none !important;
  }
  .onicon-copyright {
    font-size: 11px !important;
    padding: 6px 8px !important;
  }
  .onicon-textarea,
  .onicon-toolbar {
    flex-shrink: 0;
  }

  body.tph-onc-form-open .onicon-button-callback,
  body.tph-onc-form-open .onicon-button,
  body.tph-onc-form-open .onicon-chat-button,
  body.tph-onc-form-open .float-btns {
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
