.form-field {
  margin: 10px 0;

  .input-field {
    position: relative;
    padding: 15px;
    border: 1px solid var(--course-color-medium, #C4D8C8);
    border-radius: 100px;
    background: $white;
    transition: border-color 0.2s ease;

    input {
      width: 100%;
      border: none;
      outline: none;
      background: transparent;
      padding: 0;
      font-size: 16px;
      line-height: 1.5;
      height: 100%;
      color: $black;
    }

    input[type="date"] {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
    }

    label {
      position: absolute;
      left: 15px;
      top: 50%;
      transform: translateY(-50%);
      transition: all 0.2s ease;
      pointer-events: none;
      font-size: 1.125rem;
      line-height: 1.75rem;

      &.form-label-icon {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 90%;
      }
    }

    // Styles for the select field
    &.select-field {
      cursor: pointer;

      &.disabled {
        cursor: none;
        opacity: 0.3;
        pointer-events: none;

        .select-trigger {
          cursor: none;
          pointer-events: none;
        }
      }

      // Hide the native select
      select {
        display: none;
      }

      // The visible trigger element
      .select-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
        padding: 0;
        font-size: 16px;
        line-height: 1.5;
        height: 100%;
        cursor: pointer;

        .selected-value {
          flex: 1;
          text-align: left;
        }

        .material-symbols {
          font-size: 24px;
        }
      }

      // Dropdown content
      .dropdown-content {
        display: none; // Initially hidden
        top: 100%;
        left: 0;
      }

      // Show dropdown when .dropdown-content has .show class
      .dropdown-content.show {
        display: block;
      }

      label {
        display: none;
      }

      // Floating label behavior for select field
      &.has-value label,
      &:focus-within label {
        display: block;
        top: 5px;
        transform: translateY(0);
        font-size: 0.75rem;
        font-weight: 500;
        line-height: 1rem;
        margin: 0;

        @media (min-width: $breakpoint_lg) {
          font-size: 0.875rem;
          line-height: 1.25rem;
        }
      }
    }

    input:focus + label,
    input:not(:placeholder-shown) + label {
      top: 5px;
      transform: translateY(0);
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 1rem;
      margin: 0;

      @media (min-width: $breakpoint_lg) {
        font-size: 0.875rem;
        line-height: 1.25rem;
      }
    }

    &:not(.input-error):hover label,
    &:not(.input-error):hover {
      color: $dark-orange;
      border-color: $dark-orange;
    }

    &:not(.input-error) input:focus + label,
    &:not(.input-error):focus-within {
      color: $dark-orange;
      border-color: $dark-orange;
    }

    &.input-error {
      border-color: $red;

      label {
        color: $red;
      }
    }
  }

  .error-message {
    color: $red;
  }



  .text-field {
    display: flex;
    gap: 20px;
    position: relative;

    textarea {
      padding: 20px 15px 10px;
      gap: 8px;
      flex: 1 0 0;
      align-self: stretch;
      border-radius: 30px;
      border: 1px solid var(--course-color-medium, #C4D8C8);
      background: $white;
    }

    label {
      font-size: 1.125rem;
      line-height: 1.75rem;
      position: absolute;
      left: 15px;
      top: 10px;
    }

    &:hover label {
      color: $dark-orange;
    }

    &:hover textarea {
      border-color: $dark-orange;
    }

    textarea:focus + label {
      color: $dark-orange;
    }

    textarea:focus {
      outline: none;
      border-color: $dark-orange;
    }

    textarea:focus + label,
    textarea:not(:placeholder-shown) + label {
      top: 5px;
      transform: translateY(0);
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 1rem;
      margin: 0;

      @media (min-width: $breakpoint_lg) {
        font-size: 0.875rem;
        line-height: 1.25rem;
      }
    }
  }

}

.file-input {
  display: flex;
  flex-direction: column;

  label {
    position: relative;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1.75rem;
  }

  ::-webkit-file-upload-button,
  ::file-selector-button {
    display: none;
  }
}

.radio-group {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;

  &.radio-group-column {
    flex-direction: column;
  }

  label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1.75rem;

    .radio-input {
      opacity: 0;
      position: absolute;
      width: 100%;
      height: 100%;
      margin: 0;
      cursor: pointer;
    }

    .radio-button {
      position: relative;
      width: 30px;
      height:30px;
      border-radius: 50%;
      border: 2px solid var(--course-color-medium, #C4D8C8);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 10px;
      transition: border-color 0.2s ease;
      flex-shrink: 0;

      &::after {
        content: '';
        position: absolute;
        width: 0;
        height: 0;
        border-radius: 50%;
        background-color: $dark_orange;
        transition: all 0.2s ease;
      }
    }

    &:hover .radio-button {
      border-color: $dark_orange;
    }

    .radio-input:focus + .radio-button {
      outline: 2px solid $dark_orange;
    }

    .radio-input:checked + .radio-button {
      border-color: $dark_orange;
      background-color: $dark_orange;

      &::after {
        width: 15px;
        height: 15px;
        background-color: $white;
      }
    }

    .radio-input:checked:hover + .radio-button {
      border-color: $dark_orange;

      &::after {
        background-color: $dark_orange;
      }
    }

    .radio-input:disabled + .radio-button {
      border-color: $light_grey;
      cursor: not-allowed;

      &::after {
        background-color: $light_grey;
      }
    }

    .radio-input:disabled ~ .radio-button {
      color: $light_grey;
      cursor: not-allowed;
    }
  }
}

.checkbox {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;

    input[type="checkbox"] {
      opacity: 0;
      position: absolute;
      width: 100%;
      height: 100%;
      margin: 0;
      cursor: pointer;
    }

    .checkbox-box {
        position: relative;
        width: 30px;
        height: 30px;
        border: 2px solid var(--course-color-medium, #C4D8C8);
        border-radius: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 10px;
        transition: border-color 0.2s ease, border-width 0.2s ease, background-color 0.2s ease;
        flex-shrink: 0;
        background-color: transparent;

        &::after {
          content: '';
          position: absolute;
          width: 0;
          height: 0;
          background-color: transparent;
          border-radius: 5px;
          transition: all 0.2s ease;
          left: 50%;
          top: 50%;
          transform: translate(-50%, -50%);
        }
    }

    label, a {
      font-size: 1.125rem;
    }

    a {
      position: relative;
      z-index: 10;
    }

    &:hover .checkbox-box {
        border-color: $dark_orange;
    }

    input[type="checkbox"]:focus + .checkbox-box {
        outline: 2px solid $dark_orange;
    }

    input[type="checkbox"]:checked + .checkbox-box {
        background-color: $dark_orange;
        border-color: $dark_orange;

        &::after {
          width: 20px;
          height: 20px;
          background-color: $white;
        }
    }

    input[type="checkbox"]:disabled + .checkbox-box {
        background-color: $light_grey;
        border-color: $light_grey;
        cursor: not-allowed;
    }

    input[type="checkbox"]:disabled ~ .checkbox-label {
        color: $light_grey;
        cursor: not-allowed;
    }
}

.form-errors {
    margin: 10px 0;
    padding: 10px;
    background-color: $red;
    color: $white;
    border-radius: 5px;
    font-size: 1rem;
    line-height: 1.5rem;
    margin-bottom: 20px;
}