/* Callback popup — Figma Basic form + success */

.sp-callback,
.sp-callback * {
  box-sizing: border-box;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

.white-popup-block.sp-callback-wrap,
.sp-callback-wrap.white-popup-block {
  width: 512px !important;
  max-width: calc(100vw - 32px);
  height: auto !important;
  min-height: 0;
  margin: 24px auto;
  padding: 0;
  background: transparent;
  text-align: left;
  border: none;
  box-shadow: none;
}

.sp-callback {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 512px;
  max-width: 100%;
  padding: 32px;
  gap: 32px;
  background: #fff;
  border: 1px solid #e6e8ec;
  box-shadow: 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: 24px;
}

.sp-callback.is-success {
  align-items: center;
  gap: 40px;
  padding: 40px 32px 32px;
  min-height: 400px;
  justify-content: center;
}

.sp-callback__form,
.sp-callback__success {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 32px;
}

.sp-callback__form {
  align-items: stretch;
}

.sp-callback__success {
  align-items: center;
}

.sp-callback.is-success .sp-callback__success {
  gap: 40px;
}

.sp-callback__form[hidden],
.sp-callback__success[hidden] {
  display: none !important;
}

.sp-callback__form-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  text-align: left;
}

.sp-callback__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  padding: 22px;
  background: #e6f4ff;
  border-radius: 40px;
  flex: none;
}

.sp-callback__icon svg {
  display: block;
  width: 36px;
  height: 36px;
}

.sp-callback__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: center;
}

.sp-callback__heading {
  margin: 0;
  width: 100%;
  font-weight: 500;
  font-size: 40px;
  line-height: 52px;
  text-align: center;
  color: #111827;
}

.sp-callback__heading--form {
  font-size: 40px;
  line-height: 52px;
  text-align: left;
  color: #111827;
}

.sp-callback__detail {
  margin: 0;
  width: 100%;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  color: #4d5461;
}

.sp-callback__form-head .sp-callback__detail {
  text-align: left;
  font-size: 16px;
  line-height: 24px;
  color: #111827;
}

.sp-callback__fields {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.sp-callback__field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.sp-callback__label {
  display: block;
  margin: 0;
  padding: 0;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #5a616c !important;
  text-align: left;
}

.sp-callback__req {
  color: #006ab5;
  font-weight: 400;
}

.sp-callback__field input.inputtext,
.sp-callback__field textarea,
.sp-callback__field textarea.inputtextarea,
.sp-callback__captcha input.inputtext {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 52px;
  margin: 0;
  padding: 14px 18px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f5f6f8;
  color: #131927;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 24px;
  outline: none;
  resize: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-callback__field.is-textarea textarea,
.sp-callback__field--coment textarea,
.sp-callback__field textarea.inputtextarea {
  height: auto;
  min-height: 141px;
  padding: 14px 18px;
  line-height: 28px;
  resize: vertical;
}

.sp-callback__field input.inputtext::placeholder,
.sp-callback__field textarea::placeholder,
.sp-callback__captcha input.inputtext::placeholder {
  color: #4d5461;
  opacity: 1;
}

.sp-callback__field input.inputtext:focus::placeholder,
.sp-callback__field textarea:focus::placeholder,
.sp-callback__captcha input.inputtext:focus::placeholder {
  color: transparent;
  opacity: 0;
}

.sp-callback__field input.inputtext:hover:not(:disabled):not(:focus),
.sp-callback__field textarea:hover:not(:disabled):not(:focus),
.sp-callback__captcha input.inputtext:hover:not(:disabled):not(:focus) {
  background: #ebedf0;
}

.sp-callback__field input.inputtext:focus,
.sp-callback__field input.inputtext:active,
.sp-callback__field textarea:focus,
.sp-callback__field textarea:active,
.sp-callback__captcha input.inputtext:focus {
  background: #fff;
  border-color: #006ab5;
}

.sp-callback__field.has-error input.inputtext,
.sp-callback__field.has-error textarea,
.sp-callback__field input.is-error,
.sp-callback__field textarea.is-error,
.sp-callback__field input.field_error,
.sp-callback__field textarea.field_error,
.sp-callback__captcha.has-error input.inputtext {
  border-color: #ee443f !important;
  background: #fdecec;
}

.sp-callback__field-error {
  margin: 0;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #ee443f;
}

.sp-callback__field-error[hidden] {
  display: none !important;
}

.sp-callback.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.sp-callback__agreements {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.sp-callback__check {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  margin: 0;
}

.sp-callback__check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sp-callback__check-box {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid #d2d5db;
  border-radius: 4px;
  background: transparent;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-callback__check:hover .sp-callback__check-box {
  border-color: #9ea2ae;
  background: center / 9px 7px no-repeat
    url("data:image/svg+xml,%3Csvg width='9' height='7' viewBox='0 0 9 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4L3 6L8 1' stroke='%23D2D5DB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sp-callback__check input:checked + .sp-callback__check-box {
  border-color: #006ab5;
  background: #006ab5 center / 9px 7px no-repeat
    url("data:image/svg+xml,%3Csvg width='9' height='7' viewBox='0 0 9 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4L3 6L8 1' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sp-callback__check:hover input:checked + .sp-callback__check-box {
  border-color: #00528c;
  background-color: #00528c;
}

.sp-callback__check input:disabled + .sp-callback__check-box {
  border-color: transparent;
  background: #ebedf0;
}

.sp-callback__check input:disabled:checked + .sp-callback__check-box {
  border-color: transparent;
  background-color: #9ea2ae;
  background-image: url("data:image/svg+xml,%3Csvg width='9' height='7' viewBox='0 0 9 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4L3 6L8 1' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-size: 9px 7px;
  background-repeat: no-repeat;
}

.sp-callback__check input:checked + .sp-callback__check-box::after {
  content: none;
}

.sp-callback__check-text {
  font-size: 15px;
  line-height: 22px;
  color: #4d5461;
  font-weight: 400;
}

.sp-callback__check-text a {
  color: #006ab5;
  text-decoration: none;
  font-weight: 400;
}

.sp-callback__check-text a:hover {
  text-decoration: underline;
}

.sp-callback__agreements.is-error .sp-callback__check-box {
  border-color: #ee443f;
}

.sp-callback__error {
  font-size: 12px;
  line-height: 16px;
  color: #ee443f;
}

.sp-callback__btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 52px;
  padding: 14px 24px;
  border: 0;
  border-radius: 10px;
  background: #006ab5;
  color: #fff;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.sp-callback__actions {
  width: 100%;
}

input.sp-callback__btn {
  display: block;
  text-align: center;
}

.sp-callback__btn:hover {
  background: #005a9a;
}

.sp-callback__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sp-callback__captcha {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Magnific overlay for callback */
.mfp-bg.sp-mfp-callback {
  background: #111827;
  opacity: 0.8;
  border-radius: 0;
}

.mfp-wrap.sp-mfp-callback .mfp-content {
  width: 512px;
  max-width: calc(100vw - 32px);
}

.mfp-wrap.sp-mfp-callback .mfp-close,
.sp-callback-wrap .mfp-close {
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  color: #9ea2ae;
  font-size: 0;
  line-height: 0;
  text-indent: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.mfp-wrap.sp-mfp-callback .mfp-close svg,
.sp-callback-wrap .mfp-close svg {
  display: block;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.mfp-wrap.sp-mfp-callback .mfp-close:hover,
.sp-callback-wrap .mfp-close:hover,
.mfp-wrap.sp-mfp-callback .mfp-close:focus,
.sp-callback-wrap .mfp-close:focus {
  color: #131927;
  opacity: 1;
}

@media (max-width: 776px) {
  /* Затемнение фона — Figma */
  .mfp-bg.sp-mfp-callback {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: #111827;
    opacity: 0.6;
    border-radius: 0;
  }

  .mfp-wrap.sp-mfp-callback {
    position: fixed !important;
    inset: 0;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh;
    overflow: hidden !important;
  }

  /* Bottom sheet: 8px по бокам и снизу (без calc(100vw - 32px)) */
  .mfp-wrap.sp-mfp-callback .mfp-container {
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box;
  }

  .mfp-wrap.sp-mfp-callback .mfp-container:before {
    display: none !important;
  }

  .mfp-wrap.sp-mfp-callback .mfp-content {
    vertical-align: bottom;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100%;
    margin: 0 !important;
  }

  .white-popup-block.sp-callback-wrap,
  .sp-callback-wrap.white-popup-block {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100%;
    margin: 0 !important;
  }

  .sp-callback {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 20px;
    gap: 32px;
    border-radius: 20px;
  }

  .sp-callback__form {
    gap: 16px;
  }

  .sp-callback.is-success {
    min-height: 0;
    gap: 24px;
    padding: 20px;
  }

  .sp-callback__heading {
    font-size: 24px;
    line-height: 32px;
  }

  .sp-callback__heading--form {
    font-size: 24px;
    line-height: 32px;
  }

  .sp-callback__form-head {
    gap: 16px;
  }

  .sp-callback__form-head .sp-callback__detail {
    font-size: 15px;
    line-height: 20px;
    color: #4d5461;
  }

  .sp-callback__fields {
    gap: 16px;
  }

  .sp-callback__field {
    gap: 6px;
  }

  .sp-callback__label {
    font-size: 13px;
    line-height: 18px;
  }

  .sp-callback__field input.inputtext,
  .sp-callback__field textarea,
  .sp-callback__field textarea.inputtextarea,
  .sp-callback__captcha input.inputtext {
    height: 48px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 24px;
  }

  .sp-callback__field.is-textarea textarea,
  .sp-callback__field--coment textarea,
  .sp-callback__field textarea.inputtextarea {
    min-height: 141px;
    line-height: 24px;
  }

  .sp-callback__icon {
    width: 64px;
    height: 64px;
    padding: 16px;
  }

  .sp-callback__check {
    gap: 16px;
  }

  .sp-callback__check-text {
    font-size: 13px;
    line-height: 18px;
  }

  .sp-callback__btn {
    height: 48px;
    padding: 12px 24px;
    font-size: 16px;
    line-height: 24px;
  }

  .mfp-wrap.sp-mfp-callback .mfp-close,
  .sp-callback-wrap .mfp-close {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
  }
}
