/* Fixed manager contact FAB (TZ 2.1 / 2.1.2) */
.contact-fab {
  position: fixed;
  /* Align with .ui-to-top center: to-top right 40 + w/2 20 = 60; FAB w 60 → right 30 */
  right: 30px;
  bottom: 88px;
  z-index: 1100;
  font-family: "Open Sans", Arial, sans-serif;
}

.contact-fab__toggle {
  position: relative;
  width: 60px !important;
  height: 60px !important;
  min-width: 60px;
  max-width: 60px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #25d366 !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  line-height: 0 !important;
  font-size: 0 !important;
  font-weight: normal !important;
  transition: transform 0.2s ease, background 0.2s ease;
}

.contact-fab__toggle:hover {
  transform: scale(1.05);
}

.contact-fab.is-open .contact-fab__toggle {
  background: #1f9e4f;
}

.contact-fab__toggle-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.contact-fab__toggle-ico svg {
  display: block;
}

.contact-fab__toggle-ico--close {
  display: none;
  color: #fff;
  font-size: 34px !important;
  line-height: 1 !important;
}

.contact-fab.is-open .contact-fab__toggle-ico--chat {
  display: none;
}

.contact-fab.is-open .contact-fab__toggle-ico--close {
  display: flex;
}

.contact-fab__actions {
  position: absolute;
  right: 6px;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.contact-fab__bubble {
  width: 50px !important;
  height: 50px !important;
  min-width: 50px;
  max-width: 50px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  text-decoration: none !important;
  cursor: pointer;
  line-height: 0 !important;
  font-size: 0 !important;
  font-weight: normal !important;
  transition: transform 0.15s ease;
}

.contact-fab__bubble svg {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.contact-fab__bubble svg path {
  fill: #fff !important;
}

.contact-fab__bubble:hover {
  transform: scale(1.08);
  text-decoration: none;
}

.contact-fab__bubble--telegram {
  background: #2aabee;
}

.contact-fab__bubble--viber {
  background: #7360f2;
}

.contact-fab__bubble--phone {
  background: #2583c9;
}

.contact-fab__bubble--chat {
  background: #ff8a00;
}

.contact-fab__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 320px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #222;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  padding: 16px 16px 14px;
  box-sizing: border-box;
}

.contact-fab__head {
  position: relative;
  padding-right: 28px;
  margin-bottom: 12px;
  background: #fff;
}

.contact-fab__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.contact-fab__manager {
  margin-top: 2px;
  font-size: 13px;
  color: #666;
}

.contact-fab__close {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #888;
  cursor: pointer;
}

.contact-fab__channels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.contact-fab__channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #f4f6f8;
  color: #222;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.25;
  min-height: 52px;
}

.contact-fab__channel:hover {
  text-decoration: none;
  color: #222;
  background: #e8eef4;
}

.contact-fab__channel small {
  display: block;
  color: #666;
  font-size: 11px;
}

.contact-fab__ico {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-fab__channel--phone .contact-fab__ico,
.contact-fab__channel--phone2 .contact-fab__ico {
  color: #2583c9;
}

.contact-fab__channel--viber .contact-fab__ico {
  color: #7360f2;
}

.contact-fab__channel--telegram .contact-fab__ico {
  color: #2aabee;
}

.contact-fab__divider {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin: 4px 0 10px;
}

.contact-fab__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.contact-fab__optional {
  font-weight: 400;
  color: #888;
}

.contact-fab__label input,
.contact-fab__label textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid #cfd6dd;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.contact-fab__label textarea {
  resize: vertical;
  min-height: 72px;
}

.contact-fab__submit {
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: #2583c9 !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  padding: 10px 12px !important;
  cursor: pointer;
}

.contact-fab__submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.contact-fab__status {
  margin-top: 8px;
  font-size: 12px;
  min-height: 0;
}

.contact-fab__status.is-ok {
  color: #1f9e4f;
}

.contact-fab__status.is-error {
  color: #c62828;
}

.contact-fab.is-form-open .contact-fab__actions {
  display: none;
}

@media (max-width: 767px) {
  .contact-fab {
    right: 5px;
    bottom: 72px;
  }

  /* Dim page behind the form */
  .contact-fab.is-form-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
  }

  /*
   * Center in the visible viewport (not 100vh tricks).
   * Height = content; scroll only when taller than max-height.
   */
  .contact-fab__panel {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: calc(100vw - 24px);
    max-width: 400px;
    height: auto;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, -50%);
    z-index: 1102;
    padding: 14px 14px 12px;
  }

  .contact-fab__label textarea {
    min-height: 56px;
  }

  /* Keep green close button above the dimmed overlay */
  .contact-fab.is-form-open .contact-fab__toggle {
    z-index: 1103;
    position: relative;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .contact-fab {
    right: 30px;
  }
}

@media (min-width: 768px) {
  .contact-fab {
    right: 30px;
  }
}
