.form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  --link-color: var(--light-green-300);
  --link-hover-color: var(--green);
  --main-color-300: var(--light-green-300);
  --main-color: var(--light-green);
  --main-color-500: var(--light-green-500);
  --main-color-600: var(--light-green-600);
  --background-color: var(--cream);
  --text-color: var(--black);
  --radio-selected-color: var(--white);
  --options-hover-color: rgba(170, 219, 114, 0.3);
}

.form p {
  margin: 0;
}

.form input:-webkit-autofill,
.form textarea:-webkit-autofill {
  -webkit-background-clip: text;
  -webkit-text-fill-color: var(--text-color);
  background-color: var(--background-color) !important;
  box-shadow: inset 0 0 20px 100vw var(--background-color) !important;
  color: var(--text-color) !important;
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}

@media screen and (max-width: 650px) {
  .fields-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  position: relative;
  margin-top: 10px; /* space for floating label */
}

.form-info,
.form-info-right {
  opacity: 0.7;
  font-style: italic;
  font-size: 0.9rem;
}

.form-info-right {
  text-align: right;
  margin-top: -5px;
}

/* floating labels */

.field > label {
  position: absolute;
  left: 5px;
  color: var(--text-color);
  font-weight: 300;
  opacity: 0.6;
  top: calc(50% - 0.45rem);
  font-size: 1rem;
  line-height: 1rem;
  pointer-events: none;
  max-width: calc(100% - 10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--helvetica);
  transition:
    font-size 0.2s ease-in-out,
    transform 0.2s ease-in-out,
    top 0.2s ease-in-out,
    line-height 0.2s ease-in-out;
}

.field input {
  width: 100%;
  color: var(--text-color);
  padding: 3px 5px;
  font-family: var(--helvetica);
}

.field select + label {
  left: 8px;
  top: calc(50% - 0.45rem + 3px);
  max-width: calc(100% - 24px - 0.8rem);
}

.field textarea + label {
  left: 10px;
  top: 17px;
  max-width: calc(100% - 16px);
}

.field input:focus + label,
.field input.filled + label,
.field select.filled + label,
.field textarea:focus + label,
.field textarea.filled + label {
  transform: translate(-3px, -100%);
  top: 0;
  line-height: 0.7rem;
  font-size: 0.7rem;
}

.field select.filled + label,
.field textarea.filled + label,
.field textarea:focus + label {
  transform: translate(-6px, -65%);
}

/* textarea */

.field textarea {
  width: 100%;
  border: 1px solid var(--main-color);
  border-radius: 5px;
  margin-top: 7px;
  padding: 5px 8px;
  resize: vertical;
  min-height: 4.3em;
}

/* select */

.field select {
  pointer-events: none;
  appearance: none;
  opacity: 0;
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
}

.select {
  margin-top: 7px;
  position: relative;
  width: 100%;
  max-width: 600px;
}

.select-head {
  width: 100%;
  overflow: hidden;
  border-radius: 5px;
  border: 1px solid var(--main-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  outline: none;
  transition:
    background-color 0.2s ease-in-out,
    border-radius 0.2s ease-in-out;
}

.select-head:focus-visible {
  outline: 1px solid var(--main-color);
}

.select-head p {
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select.active .select-head {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.select .select-head svg {
  height: 0.6rem;
  width: auto;
  transition: transform 0.2s ease-in-out;
}

.select.active .select-head svg {
  transform: rotate(180deg);
}

.select-options {
  position: absolute;
  background-color: var(--background-color);
  width: 100%;
  border: 1px solid var(--main-color);
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  border-top: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  overflow: auto;
  max-height: 300px;
  transition:
    opacity 0.2s ease-in-out,
    transform 0.2s ease-in-out;
}

.select.active .select-options {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  z-index: 2;
}

.option {
  padding: 10px 8px;
  cursor: pointer;
  outline: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease-in-out;
}

.option > p {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
  text-overflow: ellipsis;
}

.option > div {
  height: 14px;
  width: 14px;
  min-width: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-color);
  overflow: hidden;
  border-radius: 3px;
}

.option > div > span {
  background-color: var(--main-color);
  transform: scale(0);
  width: 100%;
  height: 100%;
  transition: transform 0.2s ease-in-out;
}

.option.active > div > span {
  transform: scale(1);
}

.option.active {
  font-weight: 600;
  background-color: var(--main-color-600);
}

.option:hover,
.option:focus-visible {
  background-color: var(--options-hover-color);
}

.option.active:hover,
.option.active:focus-visible {
  background-color: var(--main-color-500);
}

/* files */

.file {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-color);
  transition: color 0.2s ease-in-out;
}

.file .btn {
  position: relative;
}

.file input {
  opacity: 0;
  pointer-events: none;
  appearance: none;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  padding: 0;
}

.file .btn {
  min-width: unset;
  margin: 0;
}

.file.active .btn {
  background-color: var(--main-color);
  color: var(--cream);
}

.file.active .btn:hover,
.file.active .btn:focus-visible {
  background-color: var(--main-color-500);
}

.file.active .btn:active {
  background-color: var(--main-color-300);
}

.file > div {
  display: flex;
  cursor: pointer;
  position: relative;
  outline: none;
  max-width: 100%;
  overflow: hidden;
}

.file svg {
  display: inline-block;
  position: absolute;
  left: calc(100% - 15px);
  top: 50%;
  transform: translateY(-50%);
  height: 1rem;
  width: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.file svg path {
  fill: currentColor;
  transition: fill 0.2s ease-in-out;
}

.file > div > p {
  color: inherit;
  padding-right: 25px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  transition: color 0.2s ease-in-out;
}

.file > div > p:empty {
  padding: 0;
}

.file div:hover,
.file div:focus-visible {
  color: var(--red);
}

.file > div:hover svg,
.file > div:focus-visible svg {
  opacity: 1;
  pointer-events: all;
  color: var(--red);
}

.form .file + p {
  color: var(--red);
  margin-top: -5px;
  font-size: 0.8rem;
}

.file + p:empty {
  display: none;
}

@media screen and (max-width: 650px) {
  .file {
    flex-direction: column;
    gap: 5px;
  }
  .file > div > p {
    padding-left: 25px;
  }
}

/* attachments */

.attachments > input {
  opacity: 0;
  appearance: none;
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
}

.attachments .btn {
  min-width: unset;
  max-width: 100%;
  margin: 0 !important;
}

.attachments .btn:hover,
.attachments .btn:focus-visible,
.attachments.active .btn {
  background-color: var(--main-color);
  color: var(--cream);
}

.attachments .btn:active {
  background-color: var(--main-color-500);
}

.attachment {
  color: var(--text-color);
  transition:
    color 0.2s ease-in-out,
    border-color 0.2s ease-in-out,
    padding 0.2s ease-in-out;
  cursor: pointer;
  padding: 2px 10px;
  border: 1px solid var(--main-color);
  border-radius: 9000px;
  width: max-content;
  position: relative;
  margin-bottom: 5px;
  outline: none;
}

.attachment:hover,
.attachment:focus-visible {
  color: var(--red);
  border-color: var(--red);
  padding-right: calc(20px + 0.6rem);
}

.attachment svg {
  height: 0.8rem;
  width: auto;
  opacity: 0;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.2s ease-in-out;
  color: var(--red);
}

.attachment svg path {
  fill: currentColor;
}

.attachment:hover svg,
.attachment:focus-visible svg {
  opacity: 1;
}

.form .attachments-error {
  color: var(--red);
  font-size: 0.9rem;
  margin: 5px 0;
}

/* checkboxes */

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid var(--main-color);
  padding: 10px;
  border-radius: 10px;
  position: relative;
  font-size: 0.9rem;
}

.checkbox p {
  margin: 0;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  height: 20px;
  width: 20px;
  min-width: 20px;
  margin: 0;
  pointer-events: none;
  border: 1px solid var(--text-color);
}

.checkbox div {
  border: 1px solid var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 20px;
  min-width: 20px;
  border-radius: 5px;
}

.checkbox div > span {
  background-color: var(--main-color);
  display: block;
  height: calc(100% - 6px);
  width: calc(100% - 6px);
  transition: transform 0.2s ease-in-out;
  transform: scale(0);
  border-radius: 2px;
}

.checkbox input:checked ~ div > span {
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.checkbox input:focus-visible ~ div {
  outline: 1px solid var(--main-color);
}

.checkbox.disabled {
  filter: grayscale(1) brightness(0) opacity(0.5);
}

.checkbox a {
  color: var(--link-color);
  transition: color 0.2s ease-in-out;
}

.checkbox a:hover {
  color: var(--link-hover-color);
}

/* radios */
.field.radios-field > label {
  position: relative;
  top: unset;
  left: unset;
  margin-bottom: 5px;
  display: block;
  pointer-events: all;
  cursor: unset;
}

.radios {
  display: flex;
  gap: 5px 10px;
  flex-wrap: wrap;
}

.radio {
  position: relative;
  cursor: pointer;
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--main-color);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  transition:
    background-color 0.2s ease-in-out,
    color 0.2s ease-in-out;
}

.radio p {
  line-height: 1;
}

.radio:focus-visible {
  outline: 1px solid var(--main-color);
}

.field .radio input {
  position: absolute;
  opacity: 0;
  appearance: none;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 12px;
  margin: 0;
  width: 12px;
  min-width: 12px;
  pointer-events: none;
}

.radio div {
  height: 12px;
  width: 12px;
  min-width: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio div span {
  background-color: currentColor;
  height: calc(100% - 4px);
  width: calc(100% - 4px);
  border-radius: 50%;
  transition: transform 0.2s ease-in-out;
  transform: scale(0);
}

.radio.checked {
  background-color: var(--main-color);
  color: var(--radio-selected-color);
}

.radio.checked div span {
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
