/* Form popup — from Decowelder task form */

.popup {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.popup.is-open {
  display: flex;
}

.popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.popup__dialog {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 890px;
  background: #fff;
  border-radius: 8px;
  padding: 48px;
}

.popup__close {
  position: absolute;
  top: 24px;
  right: 23px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #18181b;
  cursor: pointer;
}

.popup__close img {
  width: 16px;
  height: 16px;
  display: block;
}

.popup-form__hp {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.popup-form {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.popup-form__cols {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 48px;
}

.popup-form__left {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.popup-form__divider {
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
  background: #e4e4e7;
}

.popup-form__right {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-form__left h3 {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: #18181b;
}

.popup-form__thanks {
  padding: 24px 0 8px;
  text-align: center;
}

.popup-form__thanks-title {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 32px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: #18181b;
}

.popup-form__thanks-text {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: #52525b;
}

.popup-form__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  width: 100%;
}

.popup-form__submit {
  position: relative;
  width: 100%;
  height: 56px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 9px;
  background: #fff;
  color: #000;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.16px;
  margin: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.popup-form__submit-text {
  display: inline-block;
}

.popup-form__submit-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: #000;
  border-radius: 50%;
  animation: popup-form-spin 0.8s linear infinite;
}

.popup-form__submit.is-loading .popup-form__submit-spinner {
  display: block;
}

.popup-form__submit.is-loading .popup-form__submit-text {
  visibility: hidden;
}

@keyframes popup-form-spin {
  to {
    transform: rotate(360deg);
  }
}

.popup-form__submit:hover:not(:disabled) {
  background: #f5f5f5;
}

.popup-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.popup-form__submit:not(.popup-form__submit_ready):not(:disabled) {
  opacity: 0.75;
}

.popup-form .input {
  gap: 4px;
}

.popup-form .input__label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: -0.14px;
  color: #18181b;
}

.popup-form .input__wrap {
  border-color: #e4e4e7;
}

.popup-form .input__field {
  font-family: 'Inter', sans-serif;
}

.popup-form .input_variant_textarea .input__wrap {
  min-height: auto;
}

.popup-form .input_variant_textarea .input__field {
  height: 127px;
  min-height: 127px;
  resize: none;
}

.popup-form__consent {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.popup-form__consent-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.popup-form__consent_error .popup-form__consent-checkbox {
  border-color: #e24545;
}

.popup-form__consent_pending .popup-form__consent-checkbox {
  border-color: #18181b;
  box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.12);
}

.popup-form__consent_pending .popup-form__consent-text {
  color: #18181b;
}

.popup-form__consent-label {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.14px;
  color: #18181b;
  max-width: 100%;
}

.popup-form__consent-input {
  position: absolute;
  top: 2px;
  left: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.popup-form__consent-checkbox {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1px solid #18181b;
  border-radius: 2px;
  background: #fff;
  transition: background-color 0.2s, border-color 0.2s;
}

.popup-form__consent-input:checked + .popup-form__consent-checkbox {
  background: #18181b;
  border-color: #18181b;
}

.popup-form__consent-icon {
  opacity: 0;
  transition: opacity 0.2s;
}

.popup-form__consent-input:checked + .popup-form__consent-checkbox .popup-form__consent-icon {
  opacity: 1;
}

.popup-form__consent-text {
  flex: 1;
  min-width: 0;
}

.popup-form__consent-text a {
  text-decoration: underline;
  color: inherit;
}

.popup-form__consent-text a:hover {
  color: #71717a;
}

.input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input__label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.input__wrap {
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #fff;
}

.input__field {
  border: 0;
  outline: none;
  width: 100%;
  background: transparent;
  font-size: 14px;
  color: #18181b;
  line-height: 20px;
  font-family: 'Inter', sans-serif;
}

.input_variant_textarea .input__wrap {
  min-height: 92px;
  align-items: start;
  padding-top: 8px;
  padding-bottom: 8px;
}

.input_variant_textarea .input__field {
  resize: vertical;
  min-height: 72px;
}

.input_error .input__wrap {
  border-color: #e24545;
}

.input__error {
  color: #d22f2f;
  font-size: 12px;
  line-height: 16px;
  min-height: 16px;
  margin: 0;
}

.input__error.input__error_hidden {
  visibility: hidden;
}

#task-error.input__error_hidden {
  display: none;
}

.popup-form__consent .input__error.input__error_hidden {
  display: block;
  visibility: hidden;
}

.popup-form__consent .input__error {
  min-height: 16px;
}

.popup-form .topic-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-form .topic-group__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popup-form .topic-group_error .popup-form__consent-checkbox {
  border-color: #e24545;
}

.popup-form__topic-label {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: -0.14px;
  color: #18181b;
  max-width: 100%;
  margin: 0;
}

.popup-form__topic-input {
  position: absolute;
  top: 2px;
  left: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.popup-form__topic-input:checked + .popup-form__consent-checkbox {
  background: #18181b;
  border-color: #18181b;
}

.popup-form__topic-input:checked + .popup-form__consent-checkbox .popup-form__consent-icon {
  opacity: 1;
}

.popup-form__topic-text {
  flex: 1;
  min-width: 0;
}

/* ===== Tablet + Mobile (≤1023px) — Decowelder ===== */
@media (max-width: 1023px) {
  .popup__dialog {
    padding: 32px 24px;
  }

  .popup-form__cols {
    flex-direction: column;
    gap: 32px;
  }

  .popup-form__divider {
    width: 100%;
    height: 1px;
  }

  .popup-form__right {
    padding-top: 0;
  }

  .popup-form__topic-label {
    font-size: 24px;
  }
}

/* ===== Tablet only (768–1023px) — Decowelder ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .popup__dialog {
    padding: 48px;
  }

  .popup-form__cols {
    flex-direction: row;
    gap: 32px;
    align-items: stretch;
  }

  .popup-form__divider {
    width: 1px;
    height: auto;
    align-self: stretch;
  }

  .popup-form__right {
    padding-top: 24px;
  }

  .popup-form__topic-label {
    font-size: 14px;
    line-height: 20px;
  }

  .popup-form .input_variant_textarea .input__field {
    min-height: 60px;
    height: auto;
  }
}

/* ===== Mobile only (≤767px) — Decowelder ===== */
@media (max-width: 767px) {
  .popup {
    padding: 20px;
    overflow: hidden;
    align-items: stretch;
  }

  .popup__dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    margin: 0;
    padding: 32px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .popup-form {
    flex: 0 0 auto;
    gap: 24px;
  }

  .popup-form__cols {
    flex: 0 0 auto;
  }

  .popup-form__left {
    flex: 0 0 auto;
    gap: 24px;
  }

  .popup-form__right {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: flex-start;
  }

  .popup-form__divider {
    flex-shrink: 0;
  }

  .popup-form__consent {
    align-items: flex-start;
  }

  .popup-form__left h3 {
    font-size: 24px;
    line-height: 32px;
  }

  .popup-form__topic-label {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: -0.14px;
  }

  .popup-form__submit {
    font-size: 16px;
    line-height: 24px;
    height: 52px;
    min-height: 52px;
    box-sizing: border-box;
  }

  .popup-form .input:not(.input_variant_textarea) .input__wrap {
    min-height: 52px;
    box-sizing: border-box;
  }
}

@media (min-width: 1024px) and (max-width: 1367px) {
  .popup-form__left h3 {
    font-size: 22px;
    letter-spacing: -0.22px;
  }
}
